requireAuth middleware only verifies the JWT is valid — it does NOT check whether the authenticated user owns or has permission to access the resource. Every endpoint in documents.ts, projects.ts, projectChat.ts, chat.ts, downloads.ts, and tabular.ts is vulnerable to Insecure Direct Object Reference (IDOR). An authenticated user can access, modify, or delete any document, chat, project, or tabular review by simply guessing or enumerating UUIDs. The ensureDocAccess function in access.ts is called inconsistently and has a critical gap: documents without a project_id are never checked. This means any user can read any document that isn't explicitly scoped to a project.Critical: Weak Download Token Signing
downloadTokens.ts uses a hardcoded fallback secret ("dev-secret-do-not-use-in-production") when the environment variable DOWNLOAD_SECRET is not set. This allows any attacker who knows this default secret to forge download tokens for any file in the system. The token payload is also not validated for structure, enabling injection attacks. The download endpoint (downloads.ts) does not verify tenant membership, so a forged token can be used to exfiltrate any document.Critical: Denial of Wallet (Unbounded LLM Usage)
Multiple endpoints (chat.ts, projectChat.ts, tabular.ts, gemini.ts, claude.ts) stream LLM responses with no max_tokens, no token budget, no cost caps, and no iteration limits. An attacker can send a single request that triggers an infinite or extremely long LLM response, incurring unbounded API costs. The frontend also has no client-side limits.Critical: Secrets & Credentials Exposure
frontend/src/lib/storage.ts exposes R2 (Cloudflare) credentials directly in client-side code. This is a catastrophic leak — anyone who inspects the frontend JavaScript can read and use these credentials to access the storage bucket directly.frontend/src/contexts/UserProfileContext.tsx fetches user API keys (Claude, Gemini) from the database and exposes them to the client. These keys are stored in plaintext in the user_profiles table.backend/src/lib/llm/gemini.ts has a hardcoded fallback API key.backend/src/lib/downloadTokens.ts has a hardcoded fallback signing secret.AssistantMessage.tsx and EditCard.tsx send the user's Supabase session token (Authorization: Bearer <token>) in fetch requests to arbitrary URLs derived from LLM output. An attacker who can control the LLM response (via prompt injection) can make the frontend send the user's auth token to an attacker-controlled server, enabling session hijacking and account takeover.High: Widespread Input Validation Failures
Nearly every endpoint lacks input validation on parameters like document_id, version_id, project_id, folder_id, chat_id, display_name, email, etc. This enables SQL injection via Supabase query builder (though parameterized, the dynamic filter construction in chat.ts:33 is a direct injection vector), path traversal in download routes, and XXE via DOCX XML parsing.High: Unsafe File Processing
convert.ts uses LibreOffice without sandboxing, enabling RCE if a crafted document is uploaded.docxTrackedChanges.ts parses XML without disabling external entity resolution, enabling XXE attacks.upload.ts loads entire files into memory, enabling DoS via large uploads.user_profiles database table. They are fetched and exposed to the frontend, and can be modified by any authenticated user via the account models page.AssistantMessage.tsx) sends the user's auth token to that URL. The attacker now has the user's session token and can impersonate them to access all their documents, chats, and API keys.max_tokens or cost caps, this generates unbounded API costs. The attacker can parallelize this across multiple endpoints (chat, projectChat, tabular) to rapidly exhaust the victim's budget.requireAuth middleware is insufficient; every resource access must verify ownership or permission.max_tokens and rate limiting, financial DoS is trivial.Consensus from 180 reviewer(s): Syringe, Cipher, Harbor, Deadbolt, Entropy, Mirage, Gateway, Vault, Recon, Egress, Supply, Lockdown, Blacklist, Fuse, Passkey, Warden, Weights, Razor, Siege, Tripwire, Trace, Wallet, Tenant, Prompt, Specter, Provenance, Chaos, Pedant, Vector, Sentinel, Gatekeeper, Sanitizer, Phantom, Compliance, Exploit, Infiltrator, Cipher, Harbor, Vault, Deadbolt, Supply, Weights, Fuse, Passkey, Gateway, Sanitizer, Gatekeeper, Blacklist, Siege, Razor, Entropy, Infiltrator, Exploit, Compliance, Trace, Egress, Sentinel, Syringe, Tripwire, Phantom, Lockdown, Pedant, Chaos, Tenant, Provenance, Specter, Prompt, Recon, Vector, Wallet, Mirage, Warden, Passkey, Syringe, Harbor, Cipher, Specter, Sanitizer, Deadbolt, Supply, Recon, Egress, Exploit, Tripwire, Lockdown, Blacklist, Warden, Wallet, Prompt, Gateway, Entropy, Vault, Siege, Compliance, Weights, Gatekeeper, Chaos, Phantom, Fuse, Pedant, Mirage, Trace, Provenance, Sentinel, Razor, Infiltrator, Tenant, Vector, Syringe, Harbor, Passkey, Deadbolt, Weights, Specter, Gateway, Vault, Exploit, Cipher, Phantom, Supply, Trace, Mirage, Sanitizer, Wallet, Warden, Siege, Egress, Fuse, Prompt, Gatekeeper, Blacklist, Entropy, Compliance, Infiltrator, Chaos, Provenance, Razor, Sentinel, Pedant, Vector, Lockdown, Tripwire, Recon, Tenant, Harbor, Entropy, Gatekeeper, Deadbolt, Passkey, Egress, Gateway, Sanitizer, Mirage, Recon, Prompt, Weights, Trace, Vault, Cipher, Fuse, Supply, Warden, Compliance, Provenance, Tripwire, Chaos, Siege, Blacklist, Sentinel, Pedant, Specter, Phantom, Syringe, Wallet, Lockdown, Infiltrator, Tenant, Exploit, Razor, Vector Total findings: 1060 Severity breakdown: 23 critical, 361 high, 369 medium, 206 low, 101 info
API Cost: $2.1379 | Platform Fee: $1.0721 | $3.21 total charged
Generated by ShipItClean.com — Autonomous Adversarial Code Validation