Security assessment
Last updated: 2026-11-27T14:16:11-03:00 (UTC-3)
Security and trust · Threat model · Vulnerability disclosure
The penetration tests done on m7gtw, what they found and what changed. This is a self-assessment: done by the team itself, with open tools, not an independent pentest.
2026-10-27
Section titled “2026-10-27”Scope and environment
Section titled “Scope and environment”- The gateway built from the assessed commit, in an isolated instance:
- its own disposable PostgreSQL database;
- a local fake OpenAI-compatible provider, so the attacks would not generate cost;
- secrets generated for the test and deleted afterwards.
- Two teams with their own keys (
platformandother), one admin and one console viewer, to test the separation between teams and roles. - Surface: the public
/v1API, the admin API, the console, the documentation site and Swagger.
Method
Section titled “Method”- Automated active scan with OWASP ZAP 2.17 (
zap-api-scan), driven by the OpenAPI document:- 383 operations imported and 943 URLs exercised, authenticated with one team’s key;
- active rules for SQL injection (including the time-based PostgreSQL variant), CRLF, path traversal, command injection, SSTI, XSS, external redirect, Log4Shell and others, plus the passive header and leakage rules.
- Targeted manual tests against the threats in the threat model, each with the expected response from the defense (below).
- Code, dependency, secret and configuration scanning (secure development), in the same round.
Manual tests
Section titled “Manual tests”| Attack | Result |
|---|---|
| Call with no key and with a made-up key | 401 |
| Model outside the key’s allowlist | 403 |
| Route outside the scope (embeddings with a chat-only key) | 403 |
| Admin API without a session | 401 |
| Console write without a CSRF token | 403 |
| Write from another origin with the CSRF token (cross-site CSRF) | 403 |
| Tampered session cookie | 401 |
| Console viewer trying to write, with a valid CSRF token | 403 |
Provider pointing to the cloud metadata endpoint, to the internal network over HTTP and to file:// |
422, rejected at validation |
X-Request-Id with control characters and HTML |
Replaced by a generated ID; nothing echoed |
Path traversal in /docs/ and /ui/ (four encodings) |
404, no file from outside |
| JSON with a duplicate key at login | 400 |
| 2 MiB body on chat (1 MiB limit) | 413 (was 400; see below) |
Console with CSP, nosniff and no-referrer |
Present |
| Admin configuration without secrets | No key or token in the response |
What was found and fixed
Section titled “What was found and fixed”| Finding | Severity | Fix |
|---|---|---|
| Chat and token counting returned 400 for a body over the limit, while the other endpoints return 413. The client could not tell invalid JSON from a large body | Low | Now 413 request_too_large; test TestOversizedBodyIsRequestTooLarge |
API responses, /metrics and /openapi.yaml without X-Content-Type-Options: nosniff; no response with Cross-Origin-Resource-Policy, Cross-Origin-Opener-Policy or Permissions-Policy |
Low | All four headers on every response; test TestBaselineSecurityHeadersOnEveryAnswer |
In the same round, the code and dependency scan found and fixed more serious issues, recorded in ADR 0169:
- SQL injection and memory flaws in
pgx; - a JWE panic in
go-jose; - the Go 1.25 standard library in the image;
- a critical flaw in
astro; - a realtime meter panic on an invalid WebSocket frame.
It also removed from the deployment the Swagger Pod that ran as root (hardening).
After the fixes
Section titled “After the fixes”- ZAP: 118 rules passed, with no failures.
- Manual tests: all 23 defenses held in three consecutive rounds.
- Console, site and Swagger: checked in the browser with the new headers.
The remaining alerts, assessed one by one:
- “Source Code Disclosure - Java”: false positive. It is a
classin the console’s minified JavaScript. - “Unexpected Content-Type”: the MCP OAuth callback returns HTML on purpose, because it is a page opened by the browser.
- “Sensitive Information in URL”: these are the names of the
end_userandsession_idfilters in admin queries, not secret values. - Missing
Cross-Origin-Embedder-Policy: accepted. It would block the images that providers return by external URL in the Playground.
Limits of this assessment
Section titled “Limits of this assessment”- Self-assessment, with no outside review.
- ZAP tested the public API authenticated with one team’s key. The admin API was covered by the manual tests, not by the active scan.
- Out of scope: SSO with a real IdP, real vaults and providers, load and denial of service.