Skip to content

Commit

Permalink
update region-checker, check encoded key and length
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase Coalwell committed Dec 13, 2018
1 parent ea264e5 commit c5a4982
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion lib/services/s3.js
Expand Up @@ -240,7 +240,9 @@ AWS.util.update(AWS.S3.prototype, {
var bucket = httpRequest.virtualHostedBucket;
if (bucket && httpRequest.path) {
if (req.params && req.params.Key) {
if (httpRequest.path.indexOf('/' + AWS.util.uriEscapePath(req.params.Key)) === 0 && req.params.Key.indexOf(req.params.Bucket) >= 0) {
var encodedS3Key = '/' + AWS.util.uriEscapePath(req.params.Key);
if (httpRequest.path.indexOf(encodedS3Key) === 0 && (httpRequest.path.length === encodedS3Key.length || httpRequest.path[encodedS3Key.length] === '?')) {
//path only contains key for path contains only key and querystring
return;
}
}
Expand Down
14 changes: 7 additions & 7 deletions scripts/region-checker/whitelist.js
Expand Up @@ -27,17 +27,17 @@ var whitelist = {
'/services/s3.js': [
68,
69,
510,
513,
515,
634,
645,
646,
517,
516,
636,
647,
652
648,
649,
654
]
};

module.exports = {
whitelist: whitelist
};
};

0 comments on commit c5a4982

Please sign in to comment.