Security Audit
Priority: P0 (CRITICAL)
1. Scan for Hardcoded Secrets
See implementation examples for secrets scanning commands.
Covers: Backend source, frontend bundles (REACT_APP_, NEXT_PUBLIC_, VITE_), mobile configs (BuildConfig, iOS configurations, strings.xml).
2. Detect Data Leakage in Logs
See implementation examples for log leakage scanning commands across Node, Go, Dart, Java, Swift.
3. Map Injection Surfaces & Auth Coverage
See implementation examples for injection detection and auth coverage. Static SAST/SCA identifies candidate gaps but is not dynamic authorization proof; dynamic API tests must exercise real policy chains across authentication (401), role permissions (403), tenant isolation (403/404), and mass-assignment immutability with synthetic identities.
4. Run Dependency CVE Scans
- Node/Python/Rust:
npm audit --audit-level=high | pip-audit | cargo audit
- Go/Dart:
go list -m -u all | dart pub outdated --json
- Java/Mobile:
mvn dependency:list / ./gradlew dependencies | pod audit / Gradle scan
5. Infrastructure & Adversarial Entry Points
See implementation examples for RCE/SSRF/Path Traversal and infrastructure hardening (Docker/K8s).
6. Frontend-Specific Audit
- Exposed Secrets:
grep -rE "(REACT_APP_|NEXT_PUBLIC_|VITE_)" . --include="*.ts*" --include="*.env*"
- DOM Sinks & Source Maps: Check
dangerouslySetInnerHTML, innerHTML, eval, and .map files in prod builds.
7. Mobile-Specific Audit
See mobile audit commands for insecure storage (credential stores/Keystore), cert pinning, debug flags, and deep links.
8. Business Logic & Advanced Attacks
- BOLA/IDOR: Verify entity lookups always enforce tenant/owner ownership checks (e.g. any
findById without an owner filter is a P0 IDOR vulnerability).
- JWT / Mass Assignment: Check missing
exp, weak keys, and uncontrolled property spread (...req.body).
- Race / GraphQL: Verify atomic DB transactions, introspection disabled, and query depth limits.
Scoring Impact
| Finding |
Threshold |
Severity |
Deduction |
| Hardcoded Secrets |
Any match |
P0 |
-25 |
| Plain-text PII in Logs |
Any match |
P0 |
-20 |
| Unguarded Routes > 20% |
> 0.2 |
P0 |
-15 |
| Raw SQL Concatenation |
Any match |
P1 |
-10 |
| Response Leakage (Stack) |
> 0 |
P1 |
-10 |
| Insecure Mobile Storage |
Token in plaintext |
P1 |
-15 |
| Missing Cert Pinning |
No pinning detected |
P2 |
-8 |
| DOM XSS Sinks |
Any match |
P1 |
-10 |
CAUTION: P0 finding immediately caps Security score at 40/100. Immediate actions for leaked secrets: rotate the credential NOW and purge from history.
Anti-Patterns
- No equating SAST/SCA with authorization proof: Static scans flag candidate flaws; dynamic API execution with real guards across auth, role, tenant, and mutation boundaries is required to prove access control.
- No applying generic patterns over project-specific rules: Respect existing security constraints.
- No ignoring error handling or edge cases: Audit must cover boundary conditions.
- No backend-only audit: Always check frontend AND mobile when in-scope.
References
- Vulnerability Remediation Protocols
- Mobile Audit Commands
1---2name: common-security-audit3description: Probe for hardcoded secrets, injection surfaces, unguarded routes, business logic flaws, and platform-specific weaknesses across backend (Node, Go, Java, Python, Rust), frontend (React, Angular, Vue), and mobile (iOS, Android, Flutter) codebases. Use when performing security audits, vulnerability scans, secrets detection, or penetration testing.4metadata:5 source: https://skillmd.com/skills/hoangnguyen0403/common-security-audit6 triggers:7 files:8 - 'package.json'9 - 'go.mod'10 - 'pubspec.yaml'11 - 'pom.xml'12 - 'Cargo.toml'13 - 'requirements.txt'14 - 'AndroidManifest.xml'15 keywords:16 - Dockerfile17 - security audit18 - vulnerability scan19 - secrets detection20 - injection probe21 - pentest22---2324# Security Audit2526## **Priority: P0 (CRITICAL)**2728## 1. Scan for Hardcoded Secrets2930See [implementation examples](references/implementation.md) for secrets scanning commands.3132Covers: Backend source, frontend bundles (`REACT_APP_`, `NEXT_PUBLIC_`, `VITE_`), mobile configs (`BuildConfig`, iOS configurations, `strings.xml`).3334## 2. Detect Data Leakage in Logs3536See [implementation examples](references/implementation.md) for log leakage scanning commands across Node, Go, Dart, Java, Swift.3738## 3. Map Injection Surfaces & Auth Coverage3940See [implementation examples](references/implementation.md) for injection detection and auth coverage. Static SAST/SCA identifies candidate gaps but is not dynamic authorization proof; dynamic API tests must exercise real policy chains across authentication (401), role permissions (403), tenant isolation (403/404), and mass-assignment immutability with synthetic identities.4142## 4. Run Dependency CVE Scans4344- **Node/Python/Rust**: `npm audit --audit-level=high` | `pip-audit` | `cargo audit`45- **Go/Dart**: `go list -m -u all` | `dart pub outdated --json`46- **Java/Mobile**: `mvn dependency:list` / `./gradlew dependencies` | `pod audit` / Gradle scan4748## 5. Infrastructure & Adversarial Entry Points4950See [implementation examples](references/implementation.md) for RCE/SSRF/Path Traversal and infrastructure hardening (Docker/K8s).5152## 6. Frontend-Specific Audit5354- **Exposed Secrets**: `grep -rE "(REACT_APP_|NEXT_PUBLIC_|VITE_)" . --include="*.ts*" --include="*.env*"`55- **DOM Sinks & Source Maps**: Check `dangerouslySetInnerHTML`, `innerHTML`, `eval`, and `.map` files in prod builds.5657## 7. Mobile-Specific Audit5859See [mobile audit commands](references/mobile-audit.md) for insecure storage (credential stores/Keystore), cert pinning, debug flags, and deep links.6061## 8. Business Logic & Advanced Attacks6263- **BOLA/IDOR**: Verify entity lookups always enforce tenant/owner ownership checks (e.g. any `findById` without an `owner` filter is a P0 IDOR vulnerability).64- **JWT / Mass Assignment**: Check missing `exp`, weak keys, and uncontrolled property spread (`...req.body`).65- **Race / GraphQL**: Verify atomic DB transactions, introspection disabled, and query depth limits.6667## Scoring Impact6869| Finding | Threshold | Severity | Deduction |70| --- | --- | --- | --- |71| Hardcoded Secrets | Any match | P0 | -25 |72| Plain-text PII in Logs | Any match | P0 | -20 |73| Unguarded Routes > 20% | > 0.2 | P0 | -15 |74| Raw SQL Concatenation | Any match | P1 | -10 |75| Response Leakage (Stack) | > 0 | P1 | -10 |76| Insecure Mobile Storage | Token in plaintext | P1 | -15 |77| Missing Cert Pinning | No pinning detected | P2 | -8 |78| DOM XSS Sinks | Any match | P1 | -10 |7980> **CAUTION**: P0 finding immediately caps Security score at 40/100. Immediate actions for leaked secrets: rotate the credential NOW and purge from history.8182## Anti-Patterns8384- **No equating SAST/SCA with authorization proof**: Static scans flag candidate flaws; dynamic API execution with real guards across auth, role, tenant, and mutation boundaries is required to prove access control.85- **No applying generic patterns over project-specific rules**: Respect existing security constraints.86- **No ignoring error handling or edge cases**: Audit must cover boundary conditions.87- **No backend-only audit**: Always check frontend AND mobile when in-scope.8889## References9091- [Vulnerability Remediation Protocols](references/REMEDIATION.md)92- [Mobile Audit Commands](references/mobile-audit.md)