-
Notifications
You must be signed in to change notification settings - Fork 10
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
Store api-key values in hashed format #158
base: master
Are you sure you want to change the base?
Conversation
0e200a0
to
d5343e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks OK but I really wonder if there are other people where this will impact, I expect some to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a template migration that can be used for the major upgrade
src/sbvr-api/permissions.coffee
Outdated
@@ -47,6 +56,12 @@ parsePermissions = do -> | |||
if value?.bind? | |||
return { bind: value.bind + bindsLength } | |||
|
|||
exports.hashApiKey = hashApiKey = (apiKey) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be replaced with sbvrUtils.sbvrTypes.SHA.validate
really, to make sure it has the same behaviour (although it might make sense to have a validateSync
or something)
This stores the api key values as sha256 hashes. The database values are prefixed with 'SHA256:HEX:' to indicate, which hash algorithm and which encoding are used. Change-Type: major Signed-off-by: Andreas Fitzek <andreas@resin.io>
bab7d64
to
ccf9a2b
Compare
@afitzek please let’s discuss what we’re going to do with the delta server before merging this, this is a serious blocker for the new deltas. |
@@ -42,6 +42,8 @@ memoizedCompileRule = memoize( | |||
|
|||
db = null | |||
|
|||
exports.hashApiKey = permissions.hashApiKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything from permissions
is already exported below via an _.extend(exports, permissions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No-op review to dismiss stale review request
This stores the api key values as sha256 hashes. The database values are prefixed with 'SHA256:HEX:' to indicate, which hash algorithm and which encoding are used.
Depends-On: balena-io-modules/sbvr-types#14
Change-Type: major
Signed-off-by: Andreas Fitzek andreas@resin.io