{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/1475","repository_url":"https://api.github.com/repos/mozilla/fxa-auth-server","labels_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/1475/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/1475/comments","events_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/1475/events","html_url":"https://github.com/mozilla/fxa-auth-server/issues/1475","id":179429455,"number":1475,"title":"Invalid request on any endpoint which requires hawk authentication","user":{"login":"vityafx","id":1146369,"avatar_url":"https://avatars.githubusercontent.com/u/1146369?v=3","gravatar_id":"","url":"https://api.github.com/users/vityafx","html_url":"https://github.com/vityafx","followers_url":"https://api.github.com/users/vityafx/followers","following_url":"https://api.github.com/users/vityafx/following{/other_user}","gists_url":"https://api.github.com/users/vityafx/gists{/gist_id}","starred_url":"https://api.github.com/users/vityafx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vityafx/subscriptions","organizations_url":"https://api.github.com/users/vityafx/orgs","repos_url":"https://api.github.com/users/vityafx/repos","events_url":"https://api.github.com/users/vityafx/events{/privacy}","received_events_url":"https://api.github.com/users/vityafx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-27T08:35:43Z","updated_at":"2016-09-27T14:02:30Z","closed_at":null,"body":"The server throws strange 401 error which I can see in it's log as:\r\n\r\n>  fxa-auth-server.INFO: request.summary {\"op\":\"request.summary\",\"code\":401,\"errno\":109,\"rid\":\"1474964165351:msk1wst010:24068:itl7k9v0:10001\",\"path\":\"/v1/session/status\",\"lang\":\"en-US,*\",\"agent\":\"Mozilla/5.0\",\"remoteAddressChain\":[\"127.0.0.1\"],\"t\":14,\"uid\":\"00\"}\r\n\r\n\r\nI make a request from Qt5's network access manager and  the only thing I may get from it is:\r\n\r\n```\r\nQDEBUG :  HTTP Code:  401\r\nQDEBUG :  HTTP Message:  \"Unauthorized\"\r\nQDEBUG :  Qt error message:  \"Host requires authentication\"\r\n```\r\n\r\nHere is an example of `GET` request to `/v1/session/status` with my local server. I can't see any message in the body of answer so I can't know where is the problem. \r\n```\r\nGET /v1/session/status HTTP/1.1\r\nContent-Type: application/json\r\nAuthorization: Hawk id=\"c834f3ae60e2ffeb02b1c08f0e0e346a316bb99c9fd11797cd989c153ece7418\", ts=\"1474964165\", nonce=\"176b70\", mac=\"qeaVcUnZnGU8Tryrlf7hPDIRUX+DOq2vdUyayXwYfpA=\"\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: en-US,*\r\nUser-Agent: Mozilla/5.0\r\nHost: localhost:9000\r\n\r\nHTTP/1.1 401 Unauthorized\r\nTimestamp: 1474964165\r\nvary: origin,accept-encoding\r\ncontent-type: application/json; charset=utf-8\r\nstrict-transport-security: max-age=15552000; includeSubDomains\r\nx-frame-options: DENY\r\nx-xss-protection: 1; mode=block\r\nx-download-options: noopen\r\nx-content-type-options: nosniff\r\ncache-control: no-cache\r\ncontent-encoding: gzip\r\nDate: Tue, 27 Sep 2016 08:16:05 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n```\r\nI've tested my crypt functions to be correct by `Test Vectors` of both fxa-auth-server and hawk reference, everything seems to be okay. So I just don't know what can be the problem.\r\n\r\nI am also unable to set `trace` logging level: `README` says that in order to change logging level you must change the setting in `config.json` file but here is no file like that, here is `config/index.js` file instead, but any change in it has no result. Trying to set `LOG_LEVEL` environment variable also does not help. So I decided to put it into the `packages.json` file in `start` section but even that does not change logging mode. I am stuck."},"comment":{"url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/comments/249873967","html_url":"https://github.com/mozilla/fxa-auth-server/issues/1475#issuecomment-249873967","issue_url":"https://api.github.com/repos/mozilla/fxa-auth-server/issues/1475","id":249873967,"user":{"login":"vityafx","id":1146369,"avatar_url":"https://avatars.githubusercontent.com/u/1146369?v=3","gravatar_id":"","url":"https://api.github.com/users/vityafx","html_url":"https://github.com/vityafx","followers_url":"https://api.github.com/users/vityafx/followers","following_url":"https://api.github.com/users/vityafx/following{/other_user}","gists_url":"https://api.github.com/users/vityafx/gists{/gist_id}","starred_url":"https://api.github.com/users/vityafx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vityafx/subscriptions","organizations_url":"https://api.github.com/users/vityafx/orgs","repos_url":"https://api.github.com/users/vityafx/repos","events_url":"https://api.github.com/users/vityafx/events{/privacy}","received_events_url":"https://api.github.com/users/vityafx/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T14:02:29Z","updated_at":"2016-09-27T14:02:29Z","body":"Finally found it. Here is my story:\r\n\r\nI have debugged the code above and also wrote my own `test.js` with `createHmac`. If I pass a string instead of `credentials.key` here everything works okay but in fxa-auth-server `credentials.key` is of type `Buffer` and half-sized of string (32 vs 64). So here were 2 solutions:\r\n\r\n1. Change fxa-auth-server code to use a string instead of `Buffer` in `credentials.key`.\r\n2. Change my code to use `byte`-type array as key in my `hmac_sha256` function. It worked with a string before.\r\n\r\nSo I did second, changed my code to work with byte array instead of a hex-string. But here is interesting fact - my code was good for hawk-reference tests so I guess there is a problem too."}}
{"actor":{"display_login":"vityafx"}}