Skip to content

Keep default form actions on the current origin - #48

Merged
josbeir merged 2 commits into
mainfrom
fix/same-origin-default-actions
Nov 20, 2026
Merged

josbeir merged 2 commits into
mainfrom
fix/same-origin-default-actions

Conversation

@josbeir

@josbeir josbeir commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

A request path such as //evil.example/login could produce a cross-origin default form action and expose submitted values and the CSRF token.

Omit the action attribute when the URL is unset or false, so the browser submits to the current document. Sign the request URI's path and query directly, preserving leading double slashes without interpreting them as an external host. Explicit route arrays and URL strings continue through CakePHP routing.

Regression tests exercise real CakePHP request creation, omitted action attributes, unchanged submission paths and query strings, CSRF preservation, wrong-target rejection, and hidden-value tampering. Update form and POST-link documentation to describe the default behavior.

Validation:

  • composer validate --strict, formatting, and composer check: 828 tests, 3,343 assertions; analysis, lint, Rector, and format check passed.
  • Xdebug Clover coverage: 100% (2,521/2,521 lines); greater-than-90% gate passed.
  • npm ci and npm run docs:build passed using an isolated Node 22 runtime.
  • Affected form and POST-action browser tests: 19 passed.
  • All four review fixes merged cleanly in a temporary integration checkout: complete PHP checks passed with 847 tests, 3,397 assertions, and 100% line coverage (2,546/2,546 lines).

@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e2fa6e9) to head (aeffd52).

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #48   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity      1087      1087           
===========================================
  Files            119       119           
  Lines           2942      2946    +4     
===========================================
+ Hits            2942      2946    +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@josbeir
josbeir merged commit e766614 into main Nov 20, 2026
6 checks passed
@josbeir
josbeir deleted the fix/same-origin-default-actions branch November 20, 2026 07:35
@josbeir

josbeir commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

@codex review this

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T07:49:53.544554Z e766614 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: e766614e7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants