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

Change the SHA1 validation to be case insensitive #7780

Merged
merged 2 commits into from
Dec 30, 2022
Merged
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
6 changes: 3 additions & 3 deletions lib/server/enclave.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const init = function init () {
function genHash(data, algorihtm) {
const hash = crypto.createHash(algorihtm);
data = hash.update(data, 'utf-8');
return data.digest('hex');
return data.digest('hex').toLowerCase();
}

enclave.setApiKey = function setApiKey (keyValue) {
Expand All @@ -48,7 +48,7 @@ const init = function init () {
}

enclave.isApiKey = function isApiKey (keyValue) {
return keyValue == secrets[apiKeySHA1] || keyValue == secrets[apiKeySHA512];
return keyValue.toLowerCase() == secrets[apiKeySHA1] || keyValue == secrets[apiKeySHA512];
}

enclave.setJWTKey = function setJWTKey (keyValue) {
Expand All @@ -72,7 +72,7 @@ const init = function init () {
var shasum = crypto.createHash('sha1');
shasum.update(secrets[apiKeySHA1]);
shasum.update(id);
return shasum.digest('hex');
return shasum.digest('hex').toLowerCase();
}

return enclave;
Expand Down