Skip to content

chore: production roadmap + P0 security hardening#29

Merged
DevCalebR merged 1 commit intomainfrom
chore/p0-security-roadmap
Mar 9, 2026
Merged

chore: production roadmap + P0 security hardening#29
DevCalebR merged 1 commit intomainfrom
chore/p0-security-roadmap

Conversation

@DevCalebR
Copy link
Copy Markdown
Owner

Summary

  • Adds docs/PRODUCTION_ROADMAP.md with DoPR + P0/P1/P2 roadmap and verification steps.
  • Implements P0 hardening:
    • /api/health endpoint
    • baseline security headers via middleware
    • same-origin checks for Stripe checkout/portal routes
    • correlation/error instrumentation
    • lightweight audit logs for key actions
  • Adds tests:
    • tests/request-origin.test.ts
    • tests/security-headers.test.ts

Validation

  • npm test
  • npm run lint
  • npm run typecheck
  • npm run build

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 2, 2026

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

Project Deployment Actions Updated (UTC)
callbackcloser Building Building Preview, Comment Mar 2, 2026 6:33pm

Request Review

Copy link
Copy Markdown

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

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: 51796f76a9

ℹ️ 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 on lines +29 to +31
const originHeader = parseOrigin(request.headers.get('origin'));
if (originHeader) {
return originHeader === expectedOrigin;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject unparseable Origin headers

In isAllowedRequestOrigin, a present but unparseable Origin value (for example Origin: null, which browsers can send from sandboxed contexts) is treated as if no origin was provided and is therefore allowed. Since the Stripe checkout/portal POST handlers rely on this helper in production, that fallthrough can bypass the new same-origin protection and still run with authenticated cookies. Requests that include an invalid origin header should be rejected rather than accepted as "missing".

Useful? React with 👍 / 👎.

Comment on lines +44 to +45
const detail = error instanceof Error ? error.message : 'db_probe_failed';
return { ok: false as const, detail };
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 Avoid exposing DB error details in health response

The new unauthenticated /api/health endpoint stores error.message from the DB probe and returns it to clients via checks.database.detail. Connection/library error strings commonly include internal diagnostics (hostnames, driver details, schema hints), so this leaks operational information to any caller. For a public health check, return a generic failure detail and keep the raw error only in server logs.

Useful? React with 👍 / 👎.

@DevCalebR DevCalebR merged commit 0048be9 into main Mar 9, 2026
3 checks passed
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