fix(e2e): send Origin on /settings/profile POST so BUNYIP-259 CSRF middleware accepts it #296
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/bunyip!296
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/BUNYIP-286-e2e-profile-csrf-origin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The account-profile spec drives
POST /settings/profileviapage.request(a Playwright request context, not a navigation, because /settings crashes swiftshader on the CI runner per BUNYIP-176).page.requestshares the page's cookies + storageState but does NOT auto-populateOriginorRefererthe way a real browser submitting a form does.BUNYIP-259 added a CSRF middleware on bunyip-web that rejects every state-changing POST whose Origin / Referer host does not host-match the request
Host. Without those headers the middleware fails closed and returns 403 with the body "Cross-origin request refused (CSRF)." That is the regression visible on CI:POST /settings/profile -> 403on every retry.Set
Origin: env.baseURLandReferer: env.baseURL + '/settings'explicitly on the POST, mirroring exactly what a browser form submit from /settings would carry. The middleware host-matches them againstHostand lets the request through; no test-only bypass and no CSRF-middleware exemption.Leading spec comment updated to call out BUNYIP-259 and why the explicit headers are required for
page.request-driven submissions on bunyip-web.#BUNYIP-286
3ef082c7635f080a97a6