Skip to content

fix(security): residual session mint + ops router authz - #953

Open
dhnpmp-tech wants to merge 1 commit into
mainfrom
security/dcp-hardening-2026-07-22
Open

fix(security): residual session mint + ops router authz#953
dhnpmp-tech wants to merge 1 commit into
mainfrom
security/dcp-hardening-2026-07-22

Conversation

@dhnpmp-tech

Copy link
Copy Markdown
Collaborator

Summary

  • Residual H1: validate credential before minting signed session cookie
  • Residual L1/M1: admin-gate fallback + recovery routers
  • Archives security review docs under docs/security/

Deferred

  • C3 per-provider HMAC, H2 renter key hashing, H5 deps

Test plan

  • POST /api/session without apiKey -> 401
  • Valid key mints cookie; invalid key 401
  • GET /api/fallback/* and /api/recovery/* require admin

Merging does not deploy backend (founder approval required).

Review of stale hardening commit 041129ff against current origin/main found
most findings already fixed (login-email 410, reconciliation admin, v1
settleInferenceOnce, HTTPS defaults, standup gate, signed session cookie).

Residual gaps closed here:
- H1: POST /api/session still minted any role without credential proof;
  require apiKey and validate against backend before signing cookie.
- L1/M1: fallback GET diagnostics and recovery GET status were open;
  gate both routers with requireAdminAuth.

Also archives June/July security review docs under docs/security/ and adds
a residual review note explaining what was already fixed vs deferred
(C3 per-provider HMAC, H2 renter key hashing, H5 deps).

Not included: CLAUDE.md / .claude/settings.local.json (local agent config).
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
dc1-platform Ready Ready Preview, Comment Jul 22, 2026 1:53pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07a6e884ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/lib/auth.ts
Comment on lines 22 to 26
await fetch('/api/session', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ role: metadata.role }),
body: JSON.stringify({ role: metadata.role, apiKey }),
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle failed session mint before redirecting

Now that /api/session can return 401 when the backend credential check fails, this helper still treats any HTTP response as success because fetch only throws on network errors. In those cases the caller continues to save dc1_user_data and redirect to /admin, /renter/*, or /provider/* without the httpOnly cookie, so middleware immediately bounces the user back to auth instead of showing the real sign-in error; check res.ok and throw before persisting local user data.

Useful? React with 👍 / 👎.


// SECURITY: ops diagnostics + simulate trigger - no external consumer.
// Gate the whole router (GET status/bottlenecks/disconnects were open).
router.use(requireAdminAuth);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update fallback status checks for the new admin gate

This router-level middleware now runs before GET /api/fallback/status, but the launch readiness integration app mounts this router without setting DC1_ADMIN_TOKEN or sending an admin token, and requireAdminAuth returns 503 when that env var is absent. The existing backend/tests/integration/launch-health-status.test.js still asserts an unauthenticated status request returns 200, so this change breaks that readiness test unless the test/setup is updated to authenticate or the endpoint remains exempt.

Useful? React with 👍 / 👎.

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