feat: security header sweep for /api/me/devices (#594) - #723
Merged
greatest0fallt1me merged 3 commits intoJul 29, 2026
Merged
Conversation
…icy) to /api/me/devices Mount securityHeaders middleware on devicesRouter and devicesRevokeRouter before requireAuth, ensuring all three headers are set on every response — including 401/403 unauthenticated responses. Also imports and mounts devicesRevokeRouter at /api/me/devices/:id/revoke in src/index.ts so the route is reachable in the running app. Adds 13 focused tests in tests/devicesSecurityHeaders.test.ts covering: - Content-Security-Policy, X-Content-Type-Options, Referrer-Policy on 200 GET - header values asserted against API_SECURITY_HEADERS (single source of truth) - headers present on 401 unauthenticated responses - all three headers on POST /devices/:id/revoke (200, 400, 404) Closes Predictify-org#594
|
@thelmaoffiong Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Merged into main via admin resolver (-X theirs). |
Contributor
|
LGTM ✅ green CI, clean work — merging! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the security header sweep for
/api/me/devicesand/api/me/devices/:id/revokeas required by issue #594.Changes
src/routes/devices.tssecurityHeadersfrom../middleware/securityHeadersdevicesRouter.use(securityHeaders)beforerequireAuthso the three headers are present on every response, including 401 unauthenticated responsessrc/routes/devicesRevoke.tssecurityHeadersmounted beforerequireAuthondevicesRevokeRoutersrc/index.tsdevicesRevokeRouterand mounted it at/api/me/devices/:id/revoke(it was defined but not yet wired up in the main app)tests/devicesSecurityHeaders.test.ts(new)13 focused tests covering:
Content-Security-Policy,X-Content-Type-Options,Referrer-Policyindividually on a 200GET /api/me/devicesresponseAPI_SECURITY_HEADERS(single source of truth)default-src 'none'; frame-ancestors 'none'; base-uri 'none'POST /api/me/devices/:id/revoke— 200, 400 (invalid UUID), 404 (device not found)Headers Applied
Content-Security-Policydefault-src 'none'; frame-ancestors 'none'; base-uri 'none'X-Content-Type-OptionsnosniffReferrer-Policyno-referrerTest Results
Closes #594