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

✨ new csp middleware with full typing+IntelliSense and versatile getCspInitialProps #36

Merged
merged 7 commits into from
Jul 6, 2022

Conversation

nibtime
Copy link
Owner

@nibtime nibtime commented Jul 6, 2022

fixes #29, fixes #31, fixes #28

e2e app with full setup for Mantine/emotion, as requested in #34

feat: improve interfaces + strong typing for CSP directives
- typing borrowed from SvelteKit integration,
- auto-handling of annoying single quotes with some literal values
- support for boolean directives that don't need any values
- uaParser passed to config intializer for convenience
- provide extensive JSDoc inline docs

feat: new `csp` middleware to replace CSP config from next-safe
- uses new strong typing and agrees more with the design of this lib

feat: reporting endpoint can take multiple reporters + Sentry reporting helper

fix: base64 encode nonce
- to meet all requirement as stated in https://web.dev/strict-csp/#generate-a-nonce-for-csp

fix: no need to subsitute relative paths in reporting
- violations will also be reported to endpoints with realtive paths
is more versatile towards different use cases and setups now.

- inline style trustification opt-in
- option to pass raw css text to hash for CSP
- enhance App option so nonce can be passed to _app.js for Providers
- script trustification opt-out

fix: load `initialProps.html` with cheerio in fragment mode
- to avoid multiple <html> tags in prerendered HTML
add @mantine/core (and 2 others)
update @tailwindcss/typography to ^0.5.2 (and 2 others)
add tabler-icons-react
as requested in #34

good opportunity to test the lib with another great UI framework
and CSS-in-JS lib
@changeset-bot
Copy link

changeset-bot bot commented Jul 6, 2022

🦋 Changeset detected

Latest commit: b6e66fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@next-safe/middleware Minor
e2e Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 6, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
next-safe-middleware ✅ Ready (Inspect) Visit Preview Jul 6, 2022 at 1:53AM (UTC)

@nibtime nibtime merged commit 8926a0b into main Jul 6, 2022
@nibtime nibtime deleted the nibtime/issue29 branch July 6, 2022 01:56
@github-actions github-actions bot mentioned this pull request Jul 6, 2022
@nibtime nibtime restored the nibtime/issue29 branch July 6, 2022 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant