Skip to content

fix(security): harden service request boundaries - #327

Merged
ty-everett merged 2 commits into
mainfrom
codex/program-wave-2-service-edge
Jul 25, 2026
Merged

fix(security): harden service request boundaries#327
ty-everett merged 2 commits into
mainfrom
codex/program-wave-2-service-edge

Conversation

@ty-everett

@ty-everett ty-everett commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wave 2 of the repository health program in #324 hardens three service boundaries that currently produce CodeQL findings:

The UHRP MIME detector now shares the same runtime CDN root as uploads and the service's express.static('public') mount, avoiding the former source-vs-compiled __dirname mismatch.

CodeQL #120 is intentionally not claimed here. The existing authenticated limiter runs after authentication, so the authentication middleware itself remains unbounded. That finding belongs in the next shared pre-auth and post-auth rate-limiting wave with the related service alerts.

Security end state

  • quote work is bounded before any attacker-controlled loop or recipient lookup
  • accepted UHRP IDs match the format generated by the service itself and cannot contain separators, encodings, NULs, absolute paths, or traversal segments
  • CDN objects are created with wx, so an existing file or symlink cannot be followed or overwritten
  • expected configuration failures receive a stable public message; unexpected errors are logged only on the server and receive generic responses
  • create-bsv-app now has a standard LCOV-producing coverage script so Sonar and Codecov receive its test evidence on this and future PRs

Verification

  • message-box: build, lint, 36/36 tests, and coverage run
  • UHRP Lite: build, lint, 20/20 tests, and zero npm audit findings
  • create-bsv-app: build, lint, 237/237 tests; 95.52% line / 92.5% statement coverage, including every changed error-handling line
  • repository health: 37 projects, 242 ratcheted findings (one fewer), 5 active exceptions, 0 control errors
  • cross-package version consistency: clean
  • root high/critical audit gate: clean (only 2 low and 4 moderate advisories remain for later dependency waves)
  • first hosted analysis on commit 394c9327d: all CI lanes green, no CodeQL PR alerts, Sonar quality gate passed with zero issues/hotspots and A ratings; the follow-up commit adds LCOV ingestion to replace Sonar's initial 0% new-code-coverage result

No package versions are changed or published by this PR.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ty-everett
ty-everett marked this pull request as ready for review July 25, 2026 08:05
@ty-everett
ty-everett merged commit 7278be1 into main Jul 25, 2026
30 checks passed
@ty-everett
ty-everett deleted the codex/program-wave-2-service-edge branch July 25, 2026 08:05
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.

1 participant