-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: make CSRF protection stable #11021
Conversation
🦋 Changeset detectedLatest commit: d6402dd The changes in this PR will be included in the next version bump. 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 |
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.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
In addition to unflagging the RFC should be updated to account for the fact that we're not going to be doing the cookie check for now. You could either remove that section or move it to the alternative ideas section: withastro/roadmap#879 |
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.
Just a quick thought here for the docs, @ematipico !
Also, wondering whether we might want to link here from any other docs pages like our "Authentication" guide as a "thing to consider enabling".
Is there any reason why someone might have authentication on their Astro site and NOT want this set?
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
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.
Blocked pending the call for consensus passing.
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.
Other than a more detailed changeset for this unflagged feature, just a couple of quick suggestions for the actual docs to take a look at! (Note, one earlier comment was updated based on feedback).
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
If users are using SSR and plan to expose some endpoints that should be reachable from external domains (e.g. posting a form), then they should not enable this feature, otherwise all requests coming from external domains will be blocked. |
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.
This looks great! A few minor tweaks, and checking closely, I think we need to move up the JSDoc content to the "Top-level Options" section.
Otherwise, ready to go!
packages/astro/src/@types/astro.ts
Outdated
@@ -1686,6 +1686,47 @@ export interface AstroUserConfig { | |||
*/ | |||
legacy?: object; | |||
|
|||
/** | |||
* @docs |
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.
I think this should be moved much higher up in the file? It loos like this will now appear under "Legacy Flags" in the sidebar.
This is a top-level option, right? So it should probably move up maybe between scopedStyleStrategy
and vite
? These aren't in alphabetical order, but manually by common usage first, and then whenever just seems right. I think just above vite
makes sense, but open to suggestions if you don't like that!
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.
Done!
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
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.
Great! I left two tiny fixes in comments, but I am happy to consider this good to go! 🥳
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
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.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
Changes
This PR makes CSRF protection stable. As for now, we decided to not implement a cookie strategy because it requires a strategy that isn't very Astro-y.
The configuration has been changed, and it was make less deep:
Testing
The current tests should pass.
Docs
/cc @withastro/maintainers-docs for feedback!