Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization problem when including a library #10614

Closed
caotic123 opened this issue Aug 13, 2020 · 5 comments
Closed

Authorization problem when including a library #10614

caotic123 opened this issue Aug 13, 2020 · 5 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)

Comments

@caotic123
Copy link

@azure/storage-blob - 12.2.0-preview.1
Operating system : Debian
nodejs : v12.16.1

Hi, I am facing a problem with azure storage authorization. It works well if I don't include a particular library https://github.com/pagarme/pagarme-js
If and only if I include the library above in the files I get the following error :

azure:core-http:info ServiceClient: using custom request policies
azure:storage-blob:info RetryPolicy: =====> Try=1 Primary
azure:storage-blob:info Request: {
  "streamResponseBody": false,
  "url": "https://versatyou.blob.core.windows.net/closet?restype=container",
  "method": "GET",
  "headers": {
    "_headersMap": {
      "x-ms-version": "2019-12-12",
      "user-agent": "azsdk-js-storageblob/12.2.0-preview.1 (NODE-VERSION v12.16.1; Linux 4.19.0-6-amd64)",
      "x-ms-client-request-id": "5638202a-9f54-4364-8c58-c5bb37b306d8"
    }
  },
  "withCredentials": false,
  "timeout": 0,
  "keepAlive": true,
  "requestId": "5638202a-9f54-4364-8c58-c5bb37b306d8"
}
azure:storage-blob:info Response status code: 200
azure:storage-blob:info Headers: {
  "_headersMap": {
    "content-length": "0",
    "last-modified": "Tue, 21 Apr 2020 03:38:19 GMT",
    "etag": "\"0x8D7E5A56F3C61E3\"",
    "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
    "x-ms-request-id": "c65f3bee-401e-0063-1587-71d2b4000000",
    "x-ms-client-request-id": "5638202a-9f54-4364-8c58-c5bb37b306d8",
    "x-ms-version": "2019-12-12",
    "x-ms-lease-status": "unlocked",
    "x-ms-lease-state": "available",
    "x-ms-has-immutability-policy": "false",
    "x-ms-has-legal-hold": "false",
    "x-ms-blob-public-access": "blob",
    "x-ms-default-encryption-scope": "$account-encryption-key",
    "x-ms-deny-encryption-scope-override": "false",
    "date": "Thu, 13 Aug 2020 15:36:41 GMT"
  }
}
azure:core-http:info ServiceClient: using custom request policies
azure:storage-blob:info RetryPolicy: =====> Try=1 Primary
azure:storage-blob:info Request: {
  "streamResponseBody": false,
  "url": "https://versatyou.blob.core.windows.net/closet/372-1597333001317.jpg",
  "method": "PUT",
  "headers": {
    "_headersMap": {
      "content-type": "application/octet-stream",
      "content-length": "47953",
      "x-ms-version": "2019-12-12",
      "x-ms-blob-type": "BlockBlob",
      "user-agent": "azsdk-js-storageblob/12.2.0-preview.1 (NODE-VERSION v12.16.1; Linux 4.19.0-6-amd64)",
      "x-ms-client-request-id": "844fb675-976f-4f45-a280-272c6429cc19"
    }
  },
  "withCredentials": false,
  "timeout": 0,
  "keepAlive": true,
  "requestId": "844fb675-976f-4f45-a280-272c6429cc19"
}
azure:storage-blob:info Response status code: 403
azure:storage-blob:info Headers: {
  "_headersMap": {
    "content-length": "777",
    "content-type": "application/xml",
    "server": "Microsoft-HTTPAPI/2.0",
    "x-ms-request-id": "c65f3c3e-401e-0063-5f87-71d2b4000000",
    "x-ms-error-code": "AuthenticationFailed",
    "date": "Thu, 13 Aug 2020 15:36:41 GMT"
  }
}
RestError: <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:c65f3c3e-401e-0063-5f87-71d2b4000000
Time:2020-08-13T15:36:41.9145879Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request '/GQQJkZV5RJOrZsHeCXDRhomWgDQEvS74tBkEa8BPSU=' is not the same as any computed signature. Server used following string to sign: 'PUT




application/octet-stream






x-ms-blob-type:BlockBlob
x-ms-date:Thu, 13 Aug 2020 15:36:41 GMT
x-ms-version:2019-12-12
/versatyou/closet/372-1597333001317.jpg'.</AuthenticationErrorDetail></Error> 
 {
  "name": "RestError",
  "statusCode": 403,
  "request": {
    "streamResponseBody": false,
    "url": "https://versatyou.blob.core.windows.net/closet/372-1597333001317.jpg",
    "method": "PUT",
    "headers": {
      "_headersMap": {
        "content-type": "application/octet-stream",
        "x-ms-version": "REDACTED",
        "x-ms-blob-type": "REDACTED",
        "user-agent": "azsdk-js-storageblob/12.2.0-preview.1 (NODE-VERSION v12.16.1; Linux 4.19.0-6-amd64)",
        "x-ms-date": "REDACTED",
        "authorization": "REDACTED",
        "cookie": "REDACTED"
      }
    },
    "withCredentials": false,
    "timeout": 0,
    "keepAlive": true,
    "decompressResponse": false,
    "requestId": "844fb675-976f-4f45-a280-272c6429cc19"
  },
  "details": {
    "date": "2020-08-13T15:36:41.000Z",
    "errorCode": "AuthenticationFailed",
    "content-length": "777",
    "content-type": "application/xml",
    "server": "Microsoft-HTTPAPI/2.0",
    "message": "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:c65f3c3e-401e-0063-5f87-71d2b4000000\nTime:2020-08-13T15:36:41.9145879Z",
    "Code": "AuthenticationFailed",
    "AuthenticationErrorDetail": "The MAC signature found in the HTTP request '/GQQJkZV5RJOrZsHeCXDRhomWgDQEvS74tBkEa8BPSU=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\napplication/octet-stream\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-client-request-id:844fb675-976f-4f45-a280-272c6429cc19\nx-ms-date:Thu, 13 Aug 2020 15:36:41 GMT\nx-ms-version:2019-12-12\n/versatyou/closet/372-1597333001317.jpg'."
  },
  "message": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:c65f3c3e-401e-0063-5f87-71d2b4000000\nTime:2020-08-13T15:36:41.9145879Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request '/GQQJkZV5RJOrZsHeCXDRhomWgDQEvS74tBkEa8BPSU=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\napplication/octet-stream\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-client-request-id:844fb675-976f-4f45-a280-272c6429cc19\nx-ms-date:Thu, 13 Aug 2020 15:36:41 GMT\nx-ms-version:2019-12-12\n/versatyou/closet/372-1597333001317.jpg'.</AuthenticationErrorDetail></Error>"
}

I just have to include the library using require in my files, and stop working!
That behavior is weird. Javascript is supposed to be a memory-safe language, so adding a new library won't change anything.

I need to know is there some internal problems that might cause this.

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 13, 2020
@ramya-rao-a ramya-rao-a added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Aug 14, 2020
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Aug 14, 2020
@ghost ghost added the needs-team-attention This issue needs attention from Azure service team or SDK team label Aug 14, 2020
@jiacfan jiacfan self-assigned this Aug 14, 2020
@jiacfan
Copy link
Member

jiacfan commented Aug 14, 2020

Hi, @caotic123

Thanks for reaching us. This issue is similar to #9300, when library https://github.com/pagarme/pagarme-js is used, Content-Length header is not added when request is sent, per following log segment for Put blob:

'PUT\n\n\n\n\napplication/octet-stream\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-client-request-id:844fb675-976f-4f45-a280-272c6429cc19\nx-ms-date:Thu, 13 Aug 2020 15:36:41 GMT\nx-ms-version:2019-12-12\n/versatyou/closet/372-1597333001317.jpg'

The fix for #9300 has already been merged to master, and we'll update further when it's released.

Thanks,
Jiachen

@caotic123
Copy link
Author

caotic123 commented Aug 14, 2020

Thank you @jiacfan.
However, I built the last version on the master and still getting the same error.

@jiacfan
Copy link
Member

jiacfan commented Aug 21, 2020

Hi, @caotic123

Are you building the latest code in master branch? Or using the latest npm package? As we've not yet released the fix, it's expected to repro the same issue in existing latest release. If you're building the latest code in master branch, would you share the request/response for the error?

Thanks,
Jiachen

@jiacfan jiacfan added this to the [2020] September milestone Aug 27, 2020
@caotic123
Copy link
Author

I built the lastest code in the master branch, however, I still getting conflicts with the header. As a workaround, I just moved the import to some local context like :

  function then() {
   import {} from conflict_library;
   ....
}

Well, now it works.

@jiacfan
Copy link
Member

jiacfan commented Aug 31, 2020

Good to know the workaround works.

Thanks,
Jiachen

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

4 participants