Skip to content

fix(security): close four P0 launch-readiness findings#1586

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/p0-security-hardening
Jun 5, 2026
Merged

fix(security): close four P0 launch-readiness findings#1586
xuyushun441-sys merged 1 commit into
mainfrom
fix/p0-security-hardening

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Fixes the four code-level P0 blockers from docs/launch-readiness.md. Each was hand-verified against main before fixing (per the checklist's Verify-before-fix rule) — all four confirmed real.

ID Package Fix
P0-1 plugin-auth generateSecret() throws (fails boot) when OS_AUTH_SECRET is unset and NODE_ENV==='production' — no more predictable dev-secret-<timestamp> (session forgery). Dev/test fallback unchanged.
P0-2 plugin-security Permission-resolution catch now fails closed: logs ERROR + throws PermissionDeniedError instead of return next(). A degraded metadata service can no longer let authenticated requests bypass RBAC/RLS. System ops still bypass (decided + recorded).
P0-3 driver-sql contains/$contains escapes LIKE metacharacters (% _ \) and binds an explicit ESCAPE '\' (SQLite has no default escape char). A % value now matches literally, not every row.
P0-4 driver-mongodb Field-operator translator rejects unknown $-operators instead of passing them through — blocks $where/$function/$expr (server-side JS / query-intent bypass). All legitimate ObjectQL operators stay allowlisted.

Tests

+12 regression tests (all four packages green): auth secret prod-throw / dev-fallback / env-set; security fail-closed-denies + system-bypass-preserved; SQL %/_ literal-match; Mongo $where/$function/$expr rejected + allowlist still works.

Docs

docs/launch-readiness.md P0-1..4 marked Verify ✅ (fixed); Sign-off left blank for a human reviewer — the doc's two-gate model is preserved.

Notes

  • P0-4 open question (in the doc): confirm whether MongoDB is a v1 launch driver.
  • P0-5 (in-memory realtime/feed in clusters) is a deployment-topology decision, not a code fix — intentionally not in this PR.

🤖 Generated with Claude Code

P0-1 plugin-auth: generateSecret() throws (fails boot) when OS_AUTH_SECRET is
  unset and NODE_ENV==='production' instead of using a predictable
  dev-secret-<ts> (session forgery). Dev/test fallback unchanged.
P0-2 plugin-security: permission-resolution catch now FAILS CLOSED — logs ERROR
  and throws PermissionDeniedError rather than return next(), so a degraded
  metadata service can't bypass RBAC/RLS. System ops still bypass.
P0-3 driver-sql: contains/$contains escapes LIKE metacharacters (% _ \) and
  binds explicit ESCAPE '\' (SQLite needs it) so '%' matches literally, not
  every row (filter bypass).
P0-4 driver-mongodb: field-operator translator rejects unknown $-operators
  instead of passing them through, blocking $where/$function/$expr (server-side
  JS execution / query-intent bypass).

Each finding was hand-verified against main first. +12 regression tests across
the four packages. docs/launch-readiness.md updated: P0-1..4 marked Verify ✅
(fixed), Sign-off left for the team.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 5, 2026 12:23am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/m labels Jun 5, 2026
@xuyushun441-sys xuyushun441-sys merged commit 1e8b680 into main Jun 5, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the fix/p0-security-hardening branch June 5, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants