Sprint 1 security hardening: secrets, SSRF, SQLi, IDOR, CORS, deps#101
Merged
Conversation
- Remove hardcoded JWT_SECRET / ENCRYPTION_KEY fallbacks; validate at boot - Add SSRF guard with DNS resolution + RFC1918/loopback/cloud-metadata blocklist and integrate it across REST, GraphQL, SOAP, MCP-client, OAuth2 token, mcp-oauth, and OpenAPI/Postman/GraphQL parsers - Refactor DatabaseEngine to use prepared statements (pg/mysql/mssql/oracle/sqlite) - Fix prototype pollution / template injection in REST bodyTemplate - Enforce per-organization scoping on tools, roles, users, invitations - Helmet middleware, harden CORS (reject '*' with credentials in prod), per-endpoint rate limiting on login / register / password-reset - Update vulnerable deps (path-to-regexp, @nestjs/core, xmldom, axios, serialize-javascript, nodemailer); add Dependabot config
Merged
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
First batch of security blockers from the full project review. All seven Sprint 1 tasks completed.
JWT_SECRET/ENCRYPTION_KEYfallbacks; newsecrets.util.tsvalidates required secrets at boot (length ≥ 32, rejects known placeholders) — app refuses to start otherwise.ssrf.util.tswith DNS-aware host check (resolves the hostname before allowing the request, so DNS rebinding to private IPs is also blocked). Covers loopback / 169.254 metadata / RFC1918 / link-local / IPv4-mapped IPv6. Integrated into REST, GraphQL, SOAP, MCP-client, OAuth2 token, mcp-oauth, and the OpenAPI / Postman / GraphQL spec fetchers. Auto-disabled in jest.DatabaseEnginenow compiles templates to driver-specific prepared statements ($1pg,?mysql/sqlite,@p0mssql,:b0oracle); values are bound, never inlined. The legacy${query}raw-mode is kept for admin SELECT-only introspection.bodyTemplaterejects__proto__/constructor/prototypeparam keys, escapes string values JSON-safely, and re-validates the parsed result.update/deleteare pinned toconnectorIdviaupdateMany/deleteMany; roles service has newfindByIdForOrg,update,delete,setToolAccess,assignRoleToUseroverloads that takeorganizationIdand refuse cross-tenant operations; users admin endpoints (role change, delete, invitation revoke) confined to the requesting org.'*' + credentialsin production, per-endpoint throttle (auth-strict5/min on login / register / password-reset,auth10/min on resend-verification).npm audit fixbrings vulnerabilities from 43 (1 critical, 22 high, 20 moderate) down to 11 (1 high, 10 moderate, all transitive dev tooling). Dependabot config added.Test plan
tsc --noEmit -p packages/backend/tsconfig.jsoncleannest buildproduces distnpm testbaseline 5 failures (pre-existing, unrelated to this PR) — same 5 after; 7 new tests added passhttp://169.254.169.254/...→ blocked by SSRF guardWHERE name = \$nameand param"x'; DROP TABLE users; --"→ bound as parameter, no SQL executed