-
-
Notifications
You must be signed in to change notification settings - Fork 836
fix(webapp): add recommended security headers #2569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sets `Referrer-Policy`, `X-Content-Type-Options` and `Permissions-Policy` headers. Relevant against certain types of attacks.
|
WalkthroughA new exported function, headers(), is added to apps/webapp/app/root.tsx. It returns an object specifying three HTTP response headers: Referrer-Policy, X-Content-Type-Options, and Permissions-Policy. This function is introduced alongside existing exports to supply security-related headers in responses. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/webapp/app/root.tsx (1)
23-28
: Type the export and consider a couple of low‑risk, high‑value headersGood addition. Suggest minor polish plus optional hardening:
- Add Remix’s HeadersFunction type for consistency.
- Optionally add frame/cross‑origin isolation protections (validate with product first).
Apply:
- export const headers = () => ({ + export const headers: HeadersFunction = () => ({ "Referrer-Policy": "strict-origin-when-cross-origin", "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "Cross-Origin-Opener-Policy": "same-origin", + "Cross-Origin-Resource-Policy": "same-site", "Permissions-Policy": "geolocation=(), microphone=(), camera=(), accelerometer=(), gyroscope=(), magnetometer=(), payment=(), usb()", })And import the type:
- import type { LinksFunction, LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; + import type { LinksFunction, LoaderFunctionArgs, MetaFunction, HeadersFunction } from "@remix-run/node";Note: COOP/CORP and XFO can affect embedding/postMessage scenarios; validate before enabling. As per coding guidelines.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/webapp/app/root.tsx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}
: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations
Files:
apps/webapp/app/root.tsx
{packages/core,apps/webapp}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
We use zod a lot in packages/core and in the webapp
Files:
apps/webapp/app/root.tsx
apps/webapp/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
When importing from @trigger.dev/core in the webapp, never import the root package path; always use one of the documented subpath exports from @trigger.dev/core’s package.json
Files:
apps/webapp/app/root.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: typecheck / typecheck
🔇 Additional comments (1)
apps/webapp/app/root.tsx (1)
23-28
: Permissions-Policy header safe to deploy
No in-code references to geolocation, camera/microphone (getUserMedia), sensors, Payment Request API, Apple Pay, or USB detected; the current header won’t break existing flows. Note: this header only applies to document responses—configure it at the edge/server if you need it on assets or resource routes.
Sets `Referrer-Policy`, `X-Content-Type-Options` and `Permissions-Policy` headers. Relevant against certain types of attacks.
Sets
Referrer-Policy
,X-Content-Type-Options
andPermissions-Policy
headers.Relevant against certain types of attacks.