Skip to content

Commit

Permalink
Return 403 for non-exist container during blob SAS authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoningLiu authored and vinjiang committed May 9, 2019
1 parent 4346aab commit a1d2695
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"name": "Azurite Blob Service",
"cwd": "${workspaceFolder}",
"runtimeArgs": ["-r", "ts-node/register"],
"args": ["${workspaceFolder}/src/blob/main.ts"],
"args": ["${workspaceFolder}/src/blob/main.ts", "-d", "debug.log"],
"outputCapture": "std"
},
{
Expand Down
6 changes: 4 additions & 2 deletions src/blob/authentication/BlobSASAuthenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ export default class BlobSASAuthenticator implements IAuthenticator {

const containerName = blobContext.container;
if (containerName === undefined) {
throw RangeError(
`BlobSASAuthenticator:validate() container name is undefined in context.`
this.logger.error(
`BlobSASAuthenticator:validate() container name is undefined in context.`,
context.contextID
);
return undefined;
}

const blobName = blobContext.blob;
Expand Down
4 changes: 2 additions & 2 deletions src/blob/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ async function main() {
const beforeCloseMessage = `Azurite Blob service is closing...`;
const afterCloseMessage = `Azurite Blob service successfully closed`;
process
.on("message", msg => {
.once("message", msg => {
if (msg === "shutdown") {
console.log(beforeCloseMessage);
server.close().then(() => {
console.log(afterCloseMessage);
});
}
})
.on("SIGINT", () => {
.once("SIGINT", () => {
console.log(beforeCloseMessage);
server.close().then(() => {
console.log(afterCloseMessage);
Expand Down

0 comments on commit a1d2695

Please sign in to comment.