GitShow/kentcdodds/epic-stack-with-csrf
kentcdodds

epic-stack-with-csrf

An example of the Epic Stack with CSRF protection on forms

by kentcdodds
epic-stackepic-stack-example
Star on GitHubForknpm

TypeScript

12 stars3 forks1 contributorQuiet · 3y agoSince 2023

Meet the team

See all 1 on GitHub →
kentcdodds
kentcdodds3 contributions

Languages

View on GitHub →
TypeScript92.1%
CSS4.8%
JavaScript2.2%
Dockerfile0.9%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

2 of 6 standards met

Community profile →
42
✓README○License○Contributing○Code of Conduct○Issue Template✓PR Template

Recent fixes

View closed PRs →
dawnmist
Doc suggestion: verifyAuthenticityToken cannot be used with request if the request body has been accessedClosedIssue

I've just used this example to add csrf to the site I was working on, and tripped over an issue that the function needs to be given the response before the body of it has been accessed. e.g. this doesn't work (it throws due to the request body "having been used"): This does work: This also works Since I'd been wanting to wrap the verify in a try/catch and send back the contents of the form data in the catch clause's error, I'd defaulted to using the first way only to be very confused when the catch clause was firing (the error object seemed to be empty as a result of misconfiguring winston, so I wasn't getting any useful information from it). It's an unexpected limitation that is really easy to trip over. (Thank you so much for your work and examples on the Epic Stack!)

dawnmist · 3y ago
Structured data for AI agents

Repository: kentcdodds/epic-stack-with-csrf. Description: An example of the Epic Stack with CSRF protection on forms Stars: 12, Forks: 3. Primary language: TypeScript. Languages: TypeScript (92.1%), CSS (4.8%), JavaScript (2.2%), Dockerfile (0.9%). Topics: epic-stack, epic-stack-example. Open PRs: 0, open issues: 0. Last activity: 3y ago. Community health: 42%. Top contributors: kentcdodds.

·@ofershap

Replace github.com with gitshow.dev