File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1511,7 +1511,7 @@ async function get_taskbar_items(user) {
1511
1511
return taskbar_items ;
1512
1512
}
1513
1513
1514
- function validate_signature_auth ( url , action ) {
1514
+ function validate_signature_auth ( url , action , options = { } ) {
1515
1515
const query = new URL ( url ) . searchParams ;
1516
1516
1517
1517
if ( ! query . get ( 'uid' ) )
@@ -1522,6 +1522,12 @@ function validate_signature_auth(url, action) {
1522
1522
throw { message : '`expires` is required for signature-based authentication.' }
1523
1523
else if ( ! query . get ( 'signature' ) )
1524
1524
throw { message : '`signature` is required for signature-based authentication.' }
1525
+
1526
+ if ( options . uid ) {
1527
+ if ( query . get ( 'uid' ) !== options . uid ) {
1528
+ throw { message : 'Authentication failed. `uid` does not match.' }
1529
+ }
1530
+ }
1525
1531
1526
1532
const expired = query . get ( 'expires' ) && ( query . get ( 'expires' ) < Date . now ( ) / 1000 ) ;
1527
1533
Original file line number Diff line number Diff line change @@ -96,7 +96,9 @@ module.exports = eggspress('/writeFile', {
96
96
return ;
97
97
}
98
98
try {
99
- validate_signature_auth ( req . body . destination_write_url , 'write' ) ;
99
+ validate_signature_auth ( req . body . destination_write_url , 'write' , {
100
+ uid : req . body . destination_uid ,
101
+ } ) ;
100
102
} catch ( e ) {
101
103
res . status ( 403 ) . send ( e ) ;
102
104
return ;
You can’t perform that action at this time.
0 commit comments