Skip to content

feat: account lockout + AI egress guard + crypto/SSRF primitives (SEC-01/02/03)#2

Merged
Martinez1991 merged 2 commits into
mainfrom
sec/hardening
Jun 28, 2026
Merged

feat: account lockout + AI egress guard + crypto/SSRF primitives (SEC-01/02/03)#2
Martinez1991 merged 2 commits into
mainfrom
sec/hardening

Conversation

@Martinez1991

Copy link
Copy Markdown
Owner

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.18 com @nestjs/common/platform-express em 10.x, violando o peer de @nestjs/core e quebrando npm ci na main. Este PR restaura @nestjs/* consistente em 10.4.x (+ lockfile).

Follow-up: re-rodar o Dependabot propondo o upgrade @nestjs 10→11 como um PR coerente (todos os pacotes juntos), verificado antes do merge.

2. Hardening (SEC-01/02/03)

  • SEC-03 account lockout (AuthService.login): 5 falhas → janela exponencial (15→60min); sucesso zera; MFA conta. Novas colunas failedLoginAttempts/lockedUntil + migration.
  • SEC-02 egress/anti-SSRF do AI plane (apps/agents/app/egress.py): só http/https, IMDS sempre bloqueado, faixas privadas salvo allowlist (host do Ollama confiável); aplicado antes de cada chamada httpx.
  • SEC-01 primitives reusáveis em common/ (cifra AES-256-GCM KMS-ready + assertPublicHttpUrl), que a Enterprise liga aos segredos de integração/SSO (vêm via sync-from-core).

Verificação

  • npm ci + nest build limpos; 116/116 testes unit da API; 14/14 pytest dos agents (cob. 94%).

🤖 Generated with Claude Code

Martinez1991 and others added 2 commits June 27, 2026 22:30
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>
@Martinez1991
Martinez1991 merged commit 70227d3 into main Jun 28, 2026
3 checks passed
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.

1 participant