feat: account lockout + AI egress guard + crypto/SSRF primitives (SEC-01/02/03)#2
Merged
Conversation
The Dependabot group merge (#1) left a partial bump: apps/api had @nestjs/core@11.1.18 while @nestjs/common/platform-express stayed on 10.x, violating @nestjs/core's peer (@nestjs/common@^11) and breaking `npm ci` on main. This restores the last consistent state (all @nestjs/* on 10.4.x + matching lockfile), so `npm ci` + build + tests pass again. Follow-up: re-run Dependabot to propose the @nestjs 10→11 upgrade as a single coherent PR (all @nestjs packages together), verified before merge. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-01/02/03) Open-core security hardening (ported from the internal monorepo to the public source of truth): - SEC-03 account lockout in AuthService.login: after 5 consecutive failures the account locks for an exponential window (15→60min); success resets; MFA failures count. New User columns failedLoginAttempts/lockedUntil + migration. - SEC-02 AI egress/anti-SSRF guard (apps/agents/app/egress.py): http/https only, always blocks IMDS (169.254.169.254), blocks private/loopback/link-local unless allowlisted (Ollama host trusted). Wired before each httpx call in llm.py. - SEC-01 reusable primitives in common/ for the Enterprise edition to wire onto its integration/SSO secrets: secret-cipher (AES-256-GCM column transformer, KMS-ready) and ssrf-guard (assertPublicHttpUrl). Verified: npm ci + nest build clean; 116/116 api unit tests; 14/14 agents pytest (coverage 94%). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
Porta o hardening de segurança dos módulos abertos (do monorepo interno para a fonte da verdade pública) e destrava o CI.
1. fix(deps) — destrava o CI
O merge do grupo Dependabot (#1) deixou um bump parcial:
@nestjs/core@11.1.18com@nestjs/common/platform-expressem 10.x, violando o peer de@nestjs/coree quebrandonpm cina main. Este PR restaura@nestjs/*consistente em 10.4.x (+ lockfile).2. Hardening (SEC-01/02/03)
AuthService.login): 5 falhas → janela exponencial (15→60min); sucesso zera; MFA conta. Novas colunasfailedLoginAttempts/lockedUntil+ migration.apps/agents/app/egress.py): só http/https, IMDS sempre bloqueado, faixas privadas salvo allowlist (host do Ollama confiável); aplicado antes de cada chamadahttpx.common/(cifra AES-256-GCM KMS-ready +assertPublicHttpUrl), que a Enterprise liga aos segredos de integração/SSO (vêm viasync-from-core).Verificação
npm ci+nest buildlimpos; 116/116 testes unit da API; 14/14 pytest dos agents (cob. 94%).🤖 Generated with Claude Code