Skip to content

1.9.79: read the three request values 1.9.79's own merges left cast (PHPStan red on 1.9.79) - #328

Open
tracking202 wants to merge 1 commit into
1.9.79from
1.9.79-request-casts-after-merge
Open

tracking202 wants to merge 1 commit into
1.9.79from
1.9.79-request-casts-after-merge

Conversation

@tracking202

Copy link
Copy Markdown
Owner

1.9.79's PHP Lint › PHPStan (custom rules) job has been red on the branch since the merges at 15:46Z (runs on dee579c and c6d5167). #308 extended ForbidNumericCastOfRequestParamRule to the pages and baselined the casts already there. Three PRs merged beside it each added a cast its baseline does not count. Each passed on its own; together they fail.

Page Added by Was Now
Personal settings › same-IP fallback #283 (int)$_POST[...] after checking it is a key of $sameIpChoices === '1' ? 1 : 0, which covers the two keys the check admits. Behaviour unchanged
Setup › Offline Conversions › replace key / delete #293 regex, then (int) $_POST['feed_id'] PostedId::read(). Behaviour unchanged
Setup › Traffic Sources › account edit #271 (int) $_GET['edit_ppc_account_id'] to read the account's stored postbacks read exactly, and anything else refused: "Pick the traffic source account to edit from the list."

The third row is a real fix, not only a lint fix. The page's ownership check compares the raw edit_ppc_account_id in SQL, where MySQL reads '12abc' as 12. So a save from ?edit_ppc_account_id=12abc changed account 12, one of the account's own but not the one named. It also held account 12's postbacks as the edited account's. The id is now read once, exactly, before anything is read or written.

The baseline counts are unchanged. Each file now holds only the casts they counted: account.php 328 and 332, ppc_accounts.php 531 and 532.

No backlog item: this was found on 1.9.79's own CI after the merges.

Verification

Run in a worktree at 1a0e95c (origin/1.9.79 c6d5167 plus this commit), PHP 8.3, MariaDB 10.11.

.claude/skills/p202-verify/scripts/verify.sh --changed:

Scope report
------------
  patterns   PASS
  phpcs      PASS
  phpstan    PASS
  syntax     PASS
  unit       PASS

Not covered by this script:
  live      stand up an instance, drive the path a user would take
  agent     add and run a case under tests/fixtures/agent-eval/cases/
  ci        a workflow still in_progress has not passed; read the run

Unit run: 7,573 tests, 6 skipped. The skips are the 4 documented "User class requires DB singleton" ones, plus "this checkout has a 202-config.php" and "root reads every file".

PHPStan:

  • phpstan.neon.dist: no errors, where c6d5167 alone gives the CI job's 5.
  • phpstan-strict.neon: no errors.

Integration suites, each alone on a fresh scratch database, all OK:

Suite Tests
SetupPagesAccountScopeIntegrationTest 17
AccountPixelsIntegrationTest 7
SameIpFallbackIntegrationTest 16
OfflineExportIntegrationTest 9

Unit suites: tests/Setup, tests/Http, tests/OfflineConversion, AccountScopedWriteTest and PostReadersCheckTokenTest.

Live, in Chromium against a fresh instance served from this branch: 11/11 checks.

  • Same-IP fallback: saves on, saves off; 1abc is refused with the page's sentence and the stored value is unchanged.
  • Account edit with a clean id saves. With 1abc it is refused with the new sentence and nothing is written.
  • A fetch URL is made. A delete naming 1abc is refused and the feed is kept. A delete naming its own id removes it.

Plant: with the old ppc_accounts.php put back, the two 1abc account checks failed, and the old page saved the tampered name onto account 1. The file was restored (cmp-checked) and the pass re-run green.

What did not run:

  • The licence stub is still down. The instance was installed with the installer's own steps minus the licence check, and served with its outbound proxy pointed at a closed port. The licence check then answers as on a network failure (valid), which is how the pages could be reached.
  • The Go CLI and the agent evals do not touch these pages, and were not run.

Generated by Claude Code

1.9.79's PHPStan job has been red since the merges at 15:46Z. #308 extended
ForbidNumericCastOfRequestParamRule to the pages and baselined the casts
already there. Three PRs merged beside it each added a cast that its baseline
does not count, and each PR passed on its own:

- Personal settings (#283) cast the same-IP fallback after checking it is a
  key of its choices. It now stores 1 for '1' and 0 for '0', the two keys the
  check admits.
- Setup > Offline Conversions (#293) cast a feed id after a regex test. It now
  reads it with PostedId::read().
- Setup > Traffic Sources (#271) cast the edited account's id to read its
  stored postbacks. The page's own ownership check compares the raw value in
  SQL, where MySQL reads '12abc' as 12. So a save from
  ?edit_ppc_account_id=12abc changed account 12 (one of the account's own, not
  the one named) and held that account's postbacks. Measured on a live
  instance: the old page saved the tampered edit onto account 1. The id is now
  read exactly, and anything else is refused in the page's words before
  anything is read or written.

The baseline counts are unchanged: each file now holds only the casts they
counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRoS2SViuxaucFaKWsFnLr
Copilot AI balanced review requested due to automatic review settings October 28, 2026 16:16
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T16:16:10.201103Z
We couldn’t complete this review. Comment @codex review to try again.
1a0e95c PR opened
ℹ️ 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

tracking202 pushed a commit that referenced this pull request Oct 28, 2026
…rs-returned

1.9.79's PHPStan job is red on its own tip: three request casts that its
merges left. #328 fixes them, and it is merged here so this branch's
PHPStan check runs green. When #328 merges into 1.9.79, the commit is
already there and this merge adds nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRoS2SViuxaucFaKWsFnLr
tracking202 pushed a commit that referenced this pull request Oct 28, 2026
…lit-check

1.9.79's PHPStan job is red on its own tip: three request casts that its
merges left. #328 fixes them, and it is merged here so this branch's
PHPStan check runs green. When #328 merges into 1.9.79, the commit is
already there and this merge adds nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRoS2SViuxaucFaKWsFnLr
tracking202 pushed a commit that referenced this pull request Oct 28, 2026
1.9.79's PHPStan job is red on its own tip: three request casts that its
merges left. #328 fixes them, and it is merged here so this branch's
PHPStan check runs green. When #328 merges into 1.9.79, the commit is
already there and this merge adds nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRoS2SViuxaucFaKWsFnLr

Copy link
Copy Markdown
Owner Author

claude-review and adversarial-review did not run here, and this PR cannot fix that. The Claude app runs a review only when its workflow file matches master's copy. 6834377 (#275) changed both review workflows on 1.9.79, so neither runs on any PR into 1.9.79 until master carries those files. Re-running gives the same refusal ("Workflow validation failed. The workflow file must exist and have identical content to the version on the repository's default branch"). Codex is out of review quota, so this PR has no bot review.


Generated by Claude Code

tracking202 pushed a commit that referenced this pull request Oct 28, 2026
…ds-sessions

1.9.79's PHPStan job is red on its own tip: three request casts that its
merges left. #328 fixes them, and it is merged here so this branch's
PHPStan check runs green. When #328 merges into 1.9.79, the commit is
already there and this merge adds nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRoS2SViuxaucFaKWsFnLr
tracking202 pushed a commit that referenced this pull request Oct 28, 2026
…'s PHPStan job refuses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U3VVstdYdz5zwv5MUbkDjT
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.

3 participants