Skip to content

πŸ›‘οΈ Sentinel: [security improvement] Add security headers to API#1007

Open
kshramt wants to merge 1 commit into
mainfrom
sentinel-api-security-headers-9162875214657016125
Open

πŸ›‘οΈ Sentinel: [security improvement] Add security headers to API#1007
kshramt wants to merge 1 commit into
mainfrom
sentinel-api-security-headers-9162875214657016125

Conversation

@kshramt
Copy link
Copy Markdown
Owner

@kshramt kshramt commented May 8, 2026

πŸ›‘οΈ Sentinel: [security improvement] Add security headers to API

Severity: MEDIUM
Vulnerability: Missing HTTP security headers. Without these, the application lacks a secondary layer of defense against attacks like MIME-sniffing, clickjacking, and man-in-the-middle downgrade attacks.
Impact: While primarily an API backend, missing these standard headers fails to follow best-practice defense-in-depth principles. For example, if a client accidentally treats a JSON response as HTML, lack of CSP and X-Content-Type-Options could lead to XSS.
Fix: Injected 5 standard security headers into the api_v2 Axum routing layer using tower-http::set_header::SetResponseHeaderLayer.
Verification: The headers are correctly implemented and compilation passes. The test suites for both frontend and backend continue to pass successfully.


PR created automatically by Jules for task 9162875214657016125 started by @kshramt

This PR implements defense-in-depth security best practices by adding standard
HTTP security response headers to the api_v2 service. These headers mitigate
several classes of common web vulnerabilities.

Headers added:
- Content-Security-Policy (default-src 'none'; frame-ancestors 'none'; sandbox): Disables loading/executing external assets as it's an API, preventing XSS and framing.
- Strict-Transport-Security (max-age=63072000; includeSubDomains; preload): Enforces HTTPS connection for 2 years.
- X-Frame-Options (DENY): Prevents clickjacking by disabling framing.
- X-Content-Type-Options (nosniff): Prevents MIME-type sniffing.
- Referrer-Policy (no-referrer): Prevents leaking referring URLs in request headers.

Co-authored-by: kshramt <876546+kshramt@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant