improve baseline HTTP security for no-reverse proxy deployment scenarios#282
Merged
wojcik91 merged 18 commits intorelease/2.0from Apr 23, 2026
Merged
improve baseline HTTP security for no-reverse proxy deployment scenarios#282wojcik91 merged 18 commits intorelease/2.0from
wojcik91 merged 18 commits intorelease/2.0from
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the proxy’s default HTTP posture for deployments that aren’t protected by a reverse proxy, aligning with internal issue #66 by adding baseline response headers and safer defaults.
Changes:
- Add a global security-headers middleware (incl. conditional HSTS when TLS is active).
- Introduce a global request timeout and request body size limit.
- Harden enrollment/password-reset cookies (HttpOnly, SameSite, scoped Path) and enable rate limiting by default via config defaults.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/http.rs |
Adds security headers middleware, request timeout, request body limit, and tracks whether TLS is active. |
src/handlers/password_reset.rs |
Improves password reset cookie attributes and removes an unwrap() on timestamp conversion. |
src/handlers/enrollment.rs |
Improves enrollment cookie attributes and removes an unwrap() on timestamp conversion. |
src/config.rs |
Changes rate-limiter defaults from disabled (0) to enabled (10/s, burst 100). |
Cargo.toml |
Enables tower-http’s timeout feature to support the new TimeoutLayer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
j-chmielewski
approved these changes
Apr 23, 2026
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.
Resolves https://github.com/DefGuard/internal/issues/66