fix(cloud): close P0/P1 audit findings (agent auth, SSRF, reliability) - #424
Draft
mohabbis wants to merge 3 commits into
Draft
fix(cloud): close P0/P1 audit findings (agent auth, SSRF, reliability)#424mohabbis wants to merge 3 commits into
mohabbis wants to merge 3 commits into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the actionable P0/P1 findings from
cloud/docs/ARCHITECTURE_DECISIONS.mdthat 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
fillsteps markedsensitiveso OTP/card pixels never hit the artifact storeTouches network: yes —
navigateURLs are checked against a public-URL policy (blocks cloud metadata + RFC1918; loopback allowed for fixtures; other private hosts only if they matchAPP_URL)Touches authentication / secrets: yes —
/api/agent/*is bearer-only (session cookies refused); Auth.js routes are rate-limited; minting agent credentials requires OWNER/ADMINTouches app / window state: none
Risky actions remain deny-by-default
No silent delete or silent overwrite
Experimental features stay gated / out of scope
Changes
resolveAgentPrincipalrefuses session cookies — agents must use a minted API keycheckPublicHttpUrl+ author-time (authoredSteps) and runtime (applyStep) enforcementGHOST_RUN_TIMEOUT_MSwall-clock budget (default 30m); heartbeat stops renewing past deadlinescripts/require-test-env.mjsgatespnpm test;@ghost/coretestdepends onbuildARCHITECTURE_DECISIONS.mdupdated with statusStill 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 typecheckcd cloud && pnpm test— core 241, web 115, worker 120, mcp 1 (all passed; local Postgres+Redis)cd cloud && pnpm buildRisks / follow-up
pnpm testwithout DB now fails unlessGHOST_ALLOW_SKIP_DB_TESTS=1.APP_URL.