Skip to content

fix(security): remaining code-scanning and Dependabot alerts - #603

Merged
sirpy merged 5 commits into
masterfrom
security/alert-followup
Nov 16, 2026
Merged

sirpy merged 5 commits into
masterfrom
security/alert-followup

Conversation

@sirpy

@sirpy sirpy commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #602 after switch-to-viem was merged: handles the alerts that were still open on master.

Code scanning (38 open)

  • Log injection: new sanitizeLog helper strips line breaks from user-provided values in the flagged log calls (+ test)
  • Flow type-only imports are now import type (CodeQL could not see annotation usage): Router, UserRecord, IdScan*
  • Removed useless assignments / always-true conditions (last_claim, methodToInvoke, !code, alreadyIndexed), the duplicate resolve key in webpack.dev.config.js, and dead functions in scripts/docs.js; file names passed to exec are now shell-quoted
  • Vendored flow-typed/ excluded from CodeQL (.github/codeql/codeql-config.yml)
  • NoSQL guards: queries now also wrap the validated value in String() so CodeQL recognises it; if it does not, those alerts are false positives (inputs are already rejected unless strings)

Dependabot (60 open)

  • @axelar-network/axelarjs-sdk 0.22; overrides for protobufjs, toml, zod, esbuild
  • Not fixable here (waiting for kms-ethereum-signing, no patch, or dev-only tooling): listed in docs/security-triage-2026-11-15.md

Tests: 281 pass (29 skipped), pnpm lint clean, production build OK.

🤖 Generated with Claude Code

Summary by Sourcery

Resolve the remaining actionable CodeQL and Dependabot security findings while documenting alerts that require upstream fixes or larger upgrades.

New Features:

  • Add log sanitization to prevent user-controlled values from forging log entries.

Bug Fixes:

  • Address remaining code-scanning findings across logging, database queries, type imports, shell commands, and unused or misleading code.
  • Apply patched versions of vulnerable transitive dependencies and upgrade the Axelar SDK.

Enhancements:

  • Configure CodeQL to exclude vendored Flow definitions and document unresolved security alerts and their remediation status.

CI:

  • Update CodeQL workflow configuration to use the repository security scan exclusions.

Documentation:

  • Document the follow-up security triage, including fixed, deferred, unpatched, and development-only dependency alerts.

Tests:

  • Add coverage for log sanitization behavior.

sirpy and others added 3 commits November 15, 2026 23:04
- sanitize user-provided values before logging (log injection)
- type-only imports for Flow annotations, drop dead code and useless assignments
- shell-quote file names in the docs script
- CodeQL: ignore vendored flow-typed definitions

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- @axelar-network/axelarjs-sdk 0.22
- override protobufjs, toml, zod, esbuild to patched versions

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment thread src/server/goodid/goodid-middleware.js Dismissed
Comment thread src/server/login/login-middleware.js Dismissed
Comment thread src/server/storage/storageAPI.js Fixed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Fixed security issues:

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/server/db/mongo/user-privat-provider.js" line_range="112" />
<code_context>
     assertString('identifier', identifier)

-    return await this.model.findOne({ identifier }).lean()
+    return await this.model.findOne({ identifier: String(identifier) }).lean()
   }

</code_context>
<issue_to_address>
**Hash lookup remains uncoerced**

`getByIdentifierHash` still passes `identifier` directly into each `$or` query value after `assertString`; because the query values are not converted to primitives at the query site, the NoSQL-scanning alert for this path remains despite the other query changes.

Convert `identifier` to a primitive string in each `$or` query value in `getByIdentifierHash`.
</issue_to_address>

### Comment 2
<location path=".github/codeql/codeql-config.yml" line_range="4" />
<code_context>
+name: GoodServer CodeQL config
+paths-ignore:
+  # vendored third-party Flow library definitions (not our code, and not valid plain JS)
+  - flow-typed
</code_context>
<issue_to_address>
**Flow definitions remain scanned**

When codeQL evaluates files beneath the `flow-typed/` directory, codeQL matches repository file paths against `paths-ignore`, but `flow-typed` does not match files such as `flow-typed/npm/babel-core_vx.x.x.js`, so the vendored definitions remain in the scan and the reported alerts are not excluded.

Use a glob that matches the directory’s contents, such as `flow-typed/**`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and if code can be absent, removing its guard may let the verification-email path proceed with a missing code; reverting would not unsend emails already delivered. The dependency and query changes are otherwise reversible, but this outbound side effect can outlive the revert.

Blocking findings: src/server/db/mongo/user-privat-provider.js:112, .github/codeql/codeql-config.yml:4


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/codeql/codeql-config.yml Resolved
- codeql: ignore flow-typed/** (glob matches the files)
- getByIdentifierHash: coerce every $or value to a string
- sanitizeLog: always replace on a string so CodeQL recognises the sanitizer
- drop the redundant email check (already validated above)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Nov 16, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sourcery-ai
sourcery-ai Bot dismissed their stale review November 16, 2026 09:01

Sourcery withdrew this approval because the latest commits introduced blocking findings.

@sirpy
sirpy merged commit 8377a01 into master Nov 16, 2026
13 of 14 checks passed
@sirpy
sirpy deleted the security/alert-followup branch November 16, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants