Skip to content
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

feat: Create nosecone package for adding secure headers to applications #2237

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

blaine-arcjet
Copy link
Contributor

This is my first pass at our nosecone package. This implementation is used as middleware and the headers are set for the response.

This works really well for Next.js because we can force the headers to be forwarded and it even detects the nonce from the script-src directive, which it adds to each <script> tag that webpack generates. This mechanism doesn't work for Remix or SvelteKit and the nonce is hard to access in Express applications—there are ways to get around this that are framework-specific, but everything will be quite finicky.

Notably missing:

  • Tests
  • SvelteKit support
  • Remix support
  • Usefulness in Express

My instinct here would be to remove everything except the Next.js middleware support and ship a v0 that we can test in our application and making incremental tweaks.

All that being said, I really don't like the generalized concept here and I think this makes more sense as a series of packages crafted for specific frameworks. For example, SvelteKit would benefit from a split package where the defaults are set in the svelte.config.js file and middleware that sets the various other headers, which would defer nonce usage to the framework. We could have these framework-specific packages exist as part of a different monorepo that is managed independently of our SDK.

@blaine-arcjet blaine-arcjet requested a review from a team as a code owner November 14, 2024 23:25
Copy link

trunk-io bot commented Nov 14, 2024

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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