fix: add missing Origin header in POST tests blocked by CSRF middleware#124
Merged
mahata merged 2 commits intofeat/email-signupfrom Mar 25, 2026
Merged
Conversation
Co-authored-by: mahata <23497+mahata@users.noreply.github.com> Agent-Logs-Url: https://github.com/mahata/mlack/sessions/86a80766-f33f-4962-ba8e-c5907a70e520
Copilot
AI
changed the title
[WIP] Fix failing GitHub Actions workflow test
fix: add missing Origin header in POST tests blocked by CSRF middleware
Mar 25, 2026
mahata
added a commit
that referenced
this pull request
Mar 25, 2026
* feat(auth): implement email authentication with login and registration routes * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * test(emailAuth): add unit tests for success flows and conflict paths (#121) * Initial plan * test(emailAuth): add unit tests for success flows and conflict paths Co-authored-by: mahata <23497+mahata@users.noreply.github.com> Agent-Logs-Url: https://github.com/mahata/mlack/sessions/e8292715-c961-480d-8c1a-490e2db65f9a --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mahata <23497+mahata@users.noreply.github.com> * fix: CSRF protection for email auth form endpoints (#122) * Initial plan * fix: add CSRF protection for email auth form endpoints Co-authored-by: mahata <23497+mahata@users.noreply.github.com> Agent-Logs-Url: https://github.com/mahata/mlack/sessions/81a07abc-5f9a-4910-8bdc-71951fdb71bb --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mahata <23497+mahata@users.noreply.github.com> * fix: add missing Origin header in POST tests blocked by CSRF middleware (#124) * Initial plan * fix: add Origin header to POST tests blocked by CSRF middleware Co-authored-by: mahata <23497+mahata@users.noreply.github.com> Agent-Logs-Url: https://github.com/mahata/mlack/sessions/86a80766-f33f-4962-ba8e-c5907a70e520 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mahata <23497+mahata@users.noreply.github.com> * Initial plan (#125) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> * fix: add Origin header to E2E test requests blocked by CSRF middleware (#126) * Initial plan * fix: add Origin header to E2E test requests blocked by CSRF middleware Co-authored-by: mahata <23497+mahata@users.noreply.github.com> Agent-Logs-Url: https://github.com/mahata/mlack/sessions/edbeed38-429c-4f9f-beb6-cf8d58dc7ec4 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mahata <23497+mahata@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four POST tests in
emailAuth.test.tswere returning 403 instead of expected status codes because the globally-appliedcsrf()middleware rejects requests without a validOriginheader.Changes
hono/routes/emailAuth.test.ts: Addedheaders: { Origin: "http://localhost" }to the four POST test cases that omitted it:POST /auth/login— expected 401 (wrong password) and 302 (successful login)POST /auth/register— expected 409 (email exists) and 302 (successful registration)The other tests in the same file that correctly tested CSRF rejection already included
Origin: "http://evil.example.com", and passing tests already usedOrigin: "http://localhost"— the failing ones simply missed it.Original prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.