Skip to content

Commit e0bcefc

Browse files
author
Anthony Bouch
committed
Merge pull request #6 from Icehunter/master
uncaught issue would crash server on authorized route
2 parents 9497026 + 6b8a5c8 commit e0bcefc

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/index.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ internals.implementation = function (server, options) {
3636
return reply(Boom.unauthorized(null, 'Signature'));
3737
}
3838

39-
var parsedSignature = HttpSignature.parseRequest(req);
40-
if (!parsedSignature) {
41-
return reply(Boom.unauthorized('HTTP authentication header missing signature', 'Signature'));
39+
try {
40+
var parsedSignature = HttpSignature.parseRequest(req);
41+
if (!parsedSignature) {
42+
return reply(Boom.unauthorized('HTTP authentication header missing signature'));
43+
}
44+
} catch (e) {
45+
return reply(Boom.badRequest(e, 'Signature'));
4246
}
4347

4448
settings.validateFunc(request, parsedSignature, function (err, isValid, credentials) {
@@ -82,4 +86,4 @@ internals.implementation = function (server, options) {
8286
};
8387

8488
return scheme;
85-
};
89+
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "hapi-auth-signature",
33
"description": "Signature authentication plugin that wraps https://github.com/joyent/node-http-signature",
4-
"version": "2.1.1",
4+
"version": "2.1.2",
55
"author": "Anthony Bouch <tony@58bits.com> (http://www.58bits.com)",
66
"repository":
77
{

0 commit comments

Comments
 (0)