From b27e899aa017f6cdd21c05c1609f92d41f71c0b4 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 6 Nov 2026 09:04:44 +1100 Subject: [PATCH 1/2] Require verified email through shared JWT verifier --- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 74ff783..d3384c6 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "rxjs": "^7.8.1", "superagent": "^10.3.0", "swagger-ui-express": "^4.1.3", - "tc-core-library-js": "github:topcoder-platform/tc-core-library-js#v4.0.0-rc.2", + "tc-core-library-js": "https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4", "uuid": "^14.0.1", "winston": "^3.2.1", "xss": "^1.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0df76f6..89c30fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -125,8 +125,8 @@ importers: specifier: ^4.1.3 version: 4.6.3(express@4.22.1(supports-color@5.5.0)) tc-core-library-js: - specifier: github:topcoder-platform/tc-core-library-js#v4.0.0-rc.2 - version: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6(supports-color@5.5.0) + specifier: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4 + version: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4(supports-color@5.5.0) uuid: specifier: ^14.0.1 version: 14.0.1 @@ -3260,9 +3260,9 @@ packages: resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} engines: {node: '>=6'} - tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6: - resolution: {gitHosted: true, tarball: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6} - version: 4.0.0-rc.2 + tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4: + resolution: {gitHosted: true, integrity: sha512-4xzx6ycEdy8Rs5BpIOUhg/YX0cUUQpOCtTM60vcb9JF4XvqI1fLfIDmHNvZNek49dBo1Il1Lp8O/HLhKfLhhVg==, tarball: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4} + version: 4.0.0-rc.4 engines: {node: '>=22.13'} teleport-javascript@1.0.0: @@ -7007,7 +7007,7 @@ snapshots: tapable@2.3.3: {} - tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/58de37670180e183e8378c3d203df0112a0414f6(supports-color@5.5.0): + tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4(supports-color@5.5.0): dependencies: '@types/jsonwebtoken': 9.0.10 jsonwebtoken: 9.0.3 From 79d84a1f8bcb025e08ff6b6f49f9d8236c709568 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 6 Nov 2026 09:22:21 +1100 Subject: [PATCH 2/2] Use compatible v4 verification backport and verified JWT fixtures --- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ test/unit/jwt-configuration.test.ts | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index d3384c6..688cd3b 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "rxjs": "^7.8.1", "superagent": "^10.3.0", "swagger-ui-express": "^4.1.3", - "tc-core-library-js": "https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4", + "tc-core-library-js": "https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a", "uuid": "^14.0.1", "winston": "^3.2.1", "xss": "^1.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89c30fc..10d648a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -125,8 +125,8 @@ importers: specifier: ^4.1.3 version: 4.6.3(express@4.22.1(supports-color@5.5.0)) tc-core-library-js: - specifier: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4 - version: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4(supports-color@5.5.0) + specifier: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a + version: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a(supports-color@5.5.0) uuid: specifier: ^14.0.1 version: 14.0.1 @@ -3260,9 +3260,9 @@ packages: resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} engines: {node: '>=6'} - tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4: - resolution: {gitHosted: true, integrity: sha512-4xzx6ycEdy8Rs5BpIOUhg/YX0cUUQpOCtTM60vcb9JF4XvqI1fLfIDmHNvZNek49dBo1Il1Lp8O/HLhKfLhhVg==, tarball: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4} - version: 4.0.0-rc.4 + tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a: + resolution: {gitHosted: true, integrity: sha512-n+4KUOeV4LEIsTI/R216dBc6bUkbSyO/2O0LpoY3Hk7eqKsRQFUHloB3y0hfK/v1rzf8qYQxTdv8ikeRGBn4pQ==, tarball: https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a} + version: 4.0.0-rc.2.1 engines: {node: '>=22.13'} teleport-javascript@1.0.0: @@ -7007,7 +7007,7 @@ snapshots: tapable@2.3.3: {} - tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/2067e74f73d7fe3442c96f375fc97f8486f79be4(supports-color@5.5.0): + tc-core-library-js@https://codeload.github.com/topcoder-platform/tc-core-library-js/tar.gz/c2df92b2227089909ab6e229df0ec6b658bb431a(supports-color@5.5.0): dependencies: '@types/jsonwebtoken': 9.0.10 jsonwebtoken: 9.0.3 diff --git a/test/unit/jwt-configuration.test.ts b/test/unit/jwt-configuration.test.ts index a4cb8fc..060b1c7 100644 --- a/test/unit/jwt-configuration.test.ts +++ b/test/unit/jwt-configuration.test.ts @@ -66,7 +66,7 @@ describe('route JWT configuration', () => { } it('accepts browser RSA tokens using JWT_AUDIENCE', async () => { - const token = jwt.sign({ userId: '42', roles: ['User'] }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'browser-client', expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42', roles: ['User'] }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'browser-client', expiresIn: 300 }); const result = await verify(token); assert.equal(result.status, 200); assert.equal(result.user.isMachine, false); @@ -80,12 +80,12 @@ describe('route JWT configuration', () => { }); it('retains legacy HS256 human tokens without an audience', async () => { - const token = jwt.sign({ userId: '42', roles: ['User'] }, secret, { issuer, expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42', roles: ['User'] }, secret, { issuer, expiresIn: 300 }); assert.equal((await verify(token)).status, 200); }); it('rejects an untrusted audience', async () => { - const token = jwt.sign({ userId: '42' }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'another-api', expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42' }, privateKey, { algorithm: 'RS256', keyid: 'test-key', issuer, audience: 'another-api', expiresIn: 300 }); assert.equal((await verify(token)).status, 401); }); @@ -95,7 +95,7 @@ describe('route JWT configuration', () => { }); it('rejects an invalid signature', async () => { - const token = jwt.sign({ userId: '42' }, 'incorrect-secret-at-least-32-bytes', { issuer, expiresIn: 300 }); + const token = jwt.sign({ emailVerified: true, userId: '42' }, 'incorrect-secret-at-least-32-bytes', { issuer, expiresIn: 300 }); assert.equal((await verify(token)).status, 401); }); });