SIGN IN SIGN UP

fix: Unauthenticated /internal/truncate endpoint allows complete data wipe (#2596)

## Summary
This PR was generated by [Corridor](https://corridor.dev) to fix:

- Unauthenticated /internal/truncate endpoint allows complete data wipe

## Changes
The vulnerability stemmed from route registration order, which allowed
unauthenticated access to POST /internal/truncate and destructive data
loss. The fix moves the route registration to occur after the CORS,
request logger, and especially after the authentication middleware,
ensuring the truncate endpoint is protected by the centralized auth
policy; no handler logic or validation changes were made, and endpoints
remain reachable when auth is not configured to preserve existing
behavior.

---
Generated by Corridor

Co-authored-by: corridor-security[bot] <203152403+corridor-security[bot]@users.noreply.github.com>
C
corridor-security[bot] committed
5b4f120fe8ff36bc66eaf3c1788ee7f9a1b1ee2c
Parent: c9a5b30
Committed by GitHub <noreply@github.com> on 7/9/2026, 3:14:27 AM