Security context

What an agent needs to avoid regressing past fixes and find the next vuln in this repo.

cool-team-official/cool-admin-midway
8.x @ 43b0e10
10
Fixes
0
CVEs
HIGH
Peak severity
40.0%
Coverage
Highlights
Auth Bypass: 7 prior fixes. Scrutinize any change in this area.
src/modules/base/middleware/authority.ts: most-fixed (5 issues). Treat as high-risk during review.
9 high-severity fixes in this history; regressions here are high-impact.
Recurring patterns

The bug types that recur here, drawn from past fixes, not open vulnerabilities.

Auth Bypass: The authority middleware had multiple bypass vectors, including stripping query parameters too late, skipping SSO validation for admin accounts, and hardcoding admin tenant assignments. This represents a critical single point of failure for identity propagation.
Auth Bypass: Database queries failed to isolate tenants correctly due to the use of `.where()` instead of `.andWhere()`, which overrode critical tenant constraints, potentially leaking cross-tenant records.
Path Traversal: File uploads were prone to directory traversal because file writes were executed directly onto relative paths without proper boundary checks or canonicalization.