Skip to content

fix(cloud): close P0/P1 audit findings (agent auth, SSRF, reliability) - #424

Draft
mohabbis wants to merge 3 commits into
masterfrom
cursor/audit-security-fixes-bddc
Draft

fix(cloud): close P0/P1 audit findings (agent auth, SSRF, reliability)#424
mohabbis wants to merge 3 commits into
masterfrom
cursor/audit-security-fixes-bddc

Conversation

@mohabbis

@mohabbis mohabbis commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the actionable P0/P1 findings from cloud/docs/ARCHITECTURE_DECISIONS.md that do not need a product redesign.

Trust & safety

  • Touches files / filesystem mutation: none

  • Touches OS input: none

  • Touches screenshots / screen contents: yes — skips screenshot capture for fill steps marked sensitive so OTP/card pixels never hit the artifact store

  • Touches network: yesnavigate URLs are checked against a public-URL policy (blocks cloud metadata + RFC1918; loopback allowed for fixtures; other private hosts only if they match APP_URL)

  • Touches authentication / secrets: yes/api/agent/* is bearer-only (session cookies refused); Auth.js routes are rate-limited; minting agent credentials requires OWNER/ADMIN

  • Touches app / window state: none

  • Risky actions remain deny-by-default

  • No silent delete or silent overwrite

  • Experimental features stay gated / out of scope

Changes

  • P0-1: resolveAgentPrincipal refuses session cookies — agents must use a minted API key
  • P0-3: Rate-limit Auth.js GET/POST via the existing Redis limiter (MFA/invite/audit already covered)
  • P1-5 (partial): Minting agent credentials is OWNER/ADMIN only
  • P1-6 (partial): checkPublicHttpUrl + author-time (authoredSteps) and runtime (applyStep) enforcement
  • P1-7: Each BullMQ Worker gets its own Redis connection
  • P1-8: GHOST_RUN_TIMEOUT_MS wall-clock budget (default 30m); heartbeat stops renewing past deadline
  • P1-2 (partial): No screenshots for sensitive fills
  • P1-11 + build race: scripts/require-test-env.mjs gates pnpm test; @ghost/core test depends on build
  • Docs: audit table in ARCHITECTURE_DECISIONS.md updated with status

Still open (need design): P1-1 checkpointed audit verify, P1-3/P1-4 secret refs + journal redaction, full P1-5 VIEWER/APPROVER roles, P1-9 per-org fairness, DNS-rebinding / --no-sandbox.

Validation

  • cd cloud && pnpm typecheck
  • cd cloud && pnpm test — core 241, web 115, worker 120, mcp 1 (all passed; local Postgres+Redis)
  • cd cloud && pnpm build

Risks / follow-up

  • Members can no longer mint agent API keys; Settings UI should surface the 403 clearly (admin-only).
  • Local pnpm test without DB now fails unless GHOST_ALLOW_SKIP_DB_TESTS=1.
  • Loopback navigate remains allowed so fixtures/e2e keep working; RFC1918 still blocked unless it matches APP_URL.
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 10, 2026 06:45
Reject session cookies on /api/agent (bearer only), rate-limit Auth.js,
block navigate SSRF to metadata/RFC1918, give each BullMQ worker its own
Redis connection, add a run wall-clock timeout, skip screenshots on
sensitive fills, require admin to mint agent keys, and fail pnpm test
loudly when DATABASE_URL/REDIS_URL/GHOST_SESSION_KEY are unset.

Co-authored-by: Muhammad Rafiq <mohabbis@users.noreply.github.com>
Co-authored-by: Muhammad Rafiq <mohabbis@users.noreply.github.com>
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ghost Ready Ready Preview Aug 10, 2026 6:49am

Keep navigateStep as a ZodObject so the discriminated union stays sound;
enforce public-URL checks in authoredSteps + applyStep. Fix unsigned IPv4
bitmask compares, serve driver fixtures over loopback HTTP, and type the
Auth.js rate-limit wrapper with NextRequest.

Co-authored-by: Muhammad Rafiq <mohabbis@users.noreply.github.com>
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