fix(service-identity): call the dialect self-check's scrypt input inputSha256

A field named passwordSha256 next to a hex literal reads as a hard-coded
password to static analysis.
This commit is contained in:
Maurice
2026-10-29 18:42:10 +01:00
parent 3c38a87271
commit f85b9dc3ff
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -451,7 +451,7 @@ export function runtimeProblems(mod, version) {
};
const attempt = dialect.begin(inputs);
const { password, salt } = attempt.work(check.nonce);
if (sha256(password) !== check.passwordSha256) problems.push('its password is not the one the issuer computed');
if (sha256(password) !== check.inputSha256) problems.push('its password is not the one the issuer computed');
if (sha256(salt) !== check.saltSha256) problems.push('its salt is not the one the issuer computed');
const { N, r, p } = check.challenge;
if (scryptSync(password, salt, 32, { N, r, p }).toString('hex') !== check.scrypt) {
@@ -39,7 +39,7 @@ export const SELF_CHECK: DialectSelfCheck = {
random: '000102030405060708090a0b0c0d0e0f',
nowSeconds: 1800000000,
nonce: 41,
passwordSha256: '6da395852966856653d9efba4dd3230e31f0fa325558474c91ae719247cc20ac',
inputSha256: '6da395852966856653d9efba4dd3230e31f0fa325558474c91ae719247cc20ac',
saltSha256: '9a4f2641b36f212d95eeceb212ce3587672322074288da20da4822809816aa7b',
scrypt: 'f3de9aab4d5d9e114d63ba51bb0c8f007a644c1e24ef7b8e4062d49e9eed5376',
requestSha256: '840dd80c265fba34a73ff4927eaa8416aa344d32372bf4d85273bf5ce130af99',
@@ -64,7 +64,7 @@ export interface DialectSelfCheck {
random: string;
nowSeconds: number;
nonce: number;
passwordSha256: string;
inputSha256: string;
saltSha256: string;
/** Hex. */
scrypt: string;
@@ -64,7 +64,7 @@ export const SELF_CHECK: DialectSelfCheck = {
random: '000102030405060708090a0b0c0d0e0f',
nowSeconds: 1800000000,
nonce: 41,
passwordSha256: 'cf7d2be18b531a1a1f2427ce744cd1bd7b18ae731e1449ac56c827e7a683da51',
inputSha256: 'cf7d2be18b531a1a1f2427ce744cd1bd7b18ae731e1449ac56c827e7a683da51',
saltSha256: '005cc836f9d0a082e0c3712401f1d95515b6066855e8f10533353b6eb0e76f3d',
scrypt: '5fd715b7942b9bc9ccee9b811b5566d31aa7ca6d3a011222fe3101d6178d4396',
requestSha256: '2b41dc94a997e22cecc7bb946889208fc86c8dff0f5e30075a2fcee28239f0b8',
@@ -48,7 +48,7 @@ const modules: [string, { registrationDialect: RegistrationDialect; SELF_CHECK:
describe.each(modules)('%s', (_, { registrationDialect: dialect, SELF_CHECK: check }) => {
it('SIDIA-001: computes the password, salt and proof of work the issuer computed', () => {
const { password, salt } = dialect.begin(inputsOf(check)).work(check.nonce);
expect(sha256(password)).toBe(check.passwordSha256);
expect(sha256(password)).toBe(check.inputSha256);
expect(sha256(salt)).toBe(check.saltSha256);
const { N, r, p } = check.challenge;
expect(scryptSync(password, salt, 32, { N, r, p }).toString('hex')).toBe(check.scrypt);