Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azurebs/client/storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func (dsc DefaultStorageClient) SignedUrl(
return "", err
}

permissions := sas.BlobPermissions{Read: requestType == "GET", Create: requestType == "PUT", Write: requestType == "PUT"}
permissions := sas.BlobPermissions{Read: requestType == "GET", Create: requestType == "PUT"}
url, err := client.GetSASURL(permissions, time.Now().Add(expiration), nil)
if err != nil {
return "", err
Expand Down
4 changes: 2 additions & 2 deletions azurebs/client/storage_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ var _ = Describe("SignedUrl permissions", func() {
Expect(url).To(MatchRegexp(`[?&]sp=r(&|$)`), "GET URL must grant read only, got: %s", url)
})

It("grants create+write permission for a PUT request (sp=cw)", func() {
It("grants create-only permission for a PUT request (sp=c)", func() {
c, err := client.NewStorageClient(baseConfig())
Expect(err).ToNot(HaveOccurred())

url, err := c.SignedUrl("PUT", "some-blob", time.Minute)
Expect(err).ToNot(HaveOccurred())
Expect(url).To(MatchRegexp(`[?&]sp=cw(&|$)`), "PUT URL must grant create+write, got: %s", url)
Expect(url).To(MatchRegexp(`[?&]sp=c(&|$)`), "PUT URL must grant create only, got: %s", url)
})

It("does not grant create or write permission for a GET request", func() {
Expand Down
2 changes: 1 addition & 1 deletion azurebs/integration/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func AssertOnSignedURLs(cliPath string, cfg *config.AZStorageConfig) {

putUrl := bytes.NewBuffer(cliSession.Out.Contents()).String()
Expect(putUrl).To(MatchRegexp(regex))
Expect(putUrl).To(MatchRegexp(`[?&]sp=cw(&|$)`), "PUT signed URL should grant create+write permission")
Expect(putUrl).To(MatchRegexp(`[?&]sp=c(&|$)`), "PUT signed URL should grant create-only permission")
}

func AssertOnListDeleteLifecyle(cliPath string, cfg *config.AZStorageConfig) {
Expand Down
Loading