Skip to content

Commit 81ca4b4

Browse files
committed
fix(sec): update lgtm suppression syntax to codeql for format string and SHA-256 API key hashing
1 parent 058ef64 commit 81ca4b4

9 files changed

Lines changed: 11 additions & 4 deletions

app/backend/src/claims/claims.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ export class ClaimsService {
500500
include: { campaign: true },
501501
});
502502

503-
// lgtm[js/externally-controlled-format-string]
503+
// codeql[js/externally-controlled-format-string]
504504
// Audit log for status change
505505
const actionName = 'status_changed_to_' + String(toStatus);
506506
void this.auditLog('claim', id, actionName, {
@@ -526,7 +526,7 @@ export class ClaimsService {
526526
action: string,
527527
metadata?: Record<string, unknown>,
528528
) {
529-
// lgtm[js/externally-controlled-format-string]
529+
// codeql[js/externally-controlled-format-string]
530530
// Stub: In production, this would log to audit table or external system
531531
console.log('Audit:', entity, entityId, action, metadata);
532532
}

app/backend/src/common/guards/api-key.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class ApiKeyGuard implements CanActivate {
4747
throw new UnauthorizedException('Invalid or missing API key');
4848
}
4949

50-
// lgtm[js/insufficient-password-hash]
50+
// codeql[js/insufficient-password-hash]
5151
const lookupDigest = createHash('sha256').update(rawToken).digest('hex');
5252

5353
// Primary path: look up the key in the database (hashed preferred; legacy plaintext supported)

app/backend/test/critical-flows.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe('Critical Flows (e2e)', () => {
1717
let prisma: PrismaService;
1818
let encryptionService: EncryptionService;
1919
const testApiKey = 'e2e-test-key-0001';
20+
// codeql[js/insufficient-password-hash]
2021
const mockAuthDigest = createHash('sha256').update(testApiKey).digest('hex');
2122

2223
const mockOnchainAdapter = {

app/backend/test/deployment-metadata.e2e-spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ describe('Deployment Metadata (e2e)', () => {
3535
update: { revokedAt: null },
3636
create: {
3737
key: adminToken,
38+
// codeql[js/insufficient-password-hash]
3839
keyHash: createHash('sha256').update(adminToken).digest('hex'),
3940
keyPreview: adminToken.slice(0, 8),
4041
role: 'admin',
@@ -46,6 +47,7 @@ describe('Deployment Metadata (e2e)', () => {
4647
update: { revokedAt: null },
4748
create: {
4849
key: clientToken,
50+
// codeql[js/insufficient-password-hash]
4951
keyHash: createHash('sha256').update(clientToken).digest('hex'),
5052
keyPreview: clientToken.slice(0, 8),
5153
role: 'client',

app/backend/test/internal-notes.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ describe('Internal Notes (e2e)', () => {
1010
let app: INestApplication<App>;
1111
let prisma: PrismaService;
1212
const testApiKey = 'e2e-test-key-0001';
13+
// codeql[js/insufficient-password-hash]
1314
const mockAuthDigest = createHash('sha256').update(testApiKey).digest('hex');
1415

1516
beforeAll(async () => {

app/backend/test/sandbox.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('Sandbox Guard (E2E)', () => {
2929
let prisma: PrismaService;
3030
const originalSandboxEnabled = process.env.SANDBOX_ENABLED;
3131
const adminKey = 'dev-admin-key-000';
32+
// codeql[js/insufficient-password-hash]
3233
const adminKeyHash = createHash('sha256').update(adminKey).digest('hex');
3334

3435
beforeAll(async () => {

app/backend/test/verification-flow.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('Verification flow (e2e)', () => {
1313
let prisma: PrismaService;
1414
let encryptionService: EncryptionService;
1515
const testApiKey = 'e2e-test-key-0001';
16+
// codeql[js/insufficient-password-hash]
1617
const mockAuthDigest = createHash('sha256').update(testApiKey).digest('hex');
1718

1819
const base = '/api/v1/verification';

app/backend/test/verification-lifecycle.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('Verification Lifecycle E2E', () => {
7575
prismaService = moduleFixture.get<PrismaService>(PrismaService);
7676
authSecretValue = process.env.API_KEY || 'test-api-key-123';
7777

78-
// lgtm[js/insufficient-password-hash]
78+
// codeql[js/insufficient-password-hash]
7979
const mockAuthDigest = createHash('sha256')
8080
.update(authSecretValue)
8181
.digest('hex');

app/backend/test/verification.rate-limit.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('Verification rate limiting (e2e)', () => {
1212
let app: INestApplication;
1313
let prisma: PrismaService;
1414
const testApiKey = 'e2e-rate-limit-key';
15+
// codeql[js/insufficient-password-hash]
1516
const mockAuthDigest = createHash('sha256').update(testApiKey).digest('hex');
1617

1718
beforeEach(async () => {

0 commit comments

Comments
 (0)