Source-Code Security Audit · Sample
Security Audit Report
Acme Notes, Inc. — SAMPLE
Auditor
SecReport · secreport.site
Engagement
Static Source-Code Security Audit
Date
2026-11-20
Repository
acme/notes-api (fictional)
1. Executive Summary
The multi-tenant note-sharing backend of Acme Notes (Node/TypeScript) was assessed through a read-only static source-code audit. The overall posture is adequate with gaps: authentication and the authorization checks on single-resource endpoints are sound, but a bulk endpoint contains an authorization-matrix inconsistency that allows cross-tenant data access, and a webhook feature contains a redirect-unaware SSRF.
| Severity | Count |
|---|---|
| Critical | 0 |
High | 1 — F-01 |
Medium | 1 — F-02 |
| Low / Hardening | 2 |
2. Findings
F-01 — Bulk endpoint skips the ownership check → cross-tenant read
src/routes/notes.ts:142Root cause. The single endpoint enforces ownership (notes.ts:88). The bulk endpoint fetches the client-supplied id list without an ownerId filter (notes.ts:142). Two paths reach the same resource with different authorization.
// safe — single
where: { id, ownerId: user.id } // notes.ts:88
// vulnerable — bulk
where: { id: { in: body.ids } } // notes.ts:142 ✗ no ownerIdImpact. Any authenticated user can enumerate note ids and read other tenants' note contents — a cross-tenant confidentiality breach not possible on the single endpoint.
Fix. Add an ownership scope to the bulk query: where: { id: { in: ids }, ownerId: userId }. Effort: S.
F-02 — Webhook URL validator does not re-check after a redirect
src/services/webhook.ts:34Root cause. validateUrl() only blocks literal private IPs; sendWebhook follows 30x redirects. A URL such as http://attacker/redirect → 169.254.169.254 bypasses the validator and reaches the cloud metadata service.
Fix. Disable redirects or re-validate on every hop; use DNS pinning. Effort: M.
3. Remediation Roadmap
| Priority | Finding | Action |
|---|---|---|
| 1 (now) | F-01 | Add ownerId scope to the bulk endpoint |
| 2 (short-term) | F-02 | Redirect-aware SSRF guard + DNS pinning |
| 3 (hardening) | F-03/04 | Security headers + error hygiene |
4. Positive Observations
Single CRUD endpoints are consistently ownership-scoped. JWT validation is centralized and sound; password hashing is appropriate; the ORM uses parameterized queries (no raw SQL).