Skip to content

Append injected params in a consistent position when rewriting bulk entries - #107

Merged
chippison merged 2 commits into
masterfrom
dev-20649
Aug 11, 2026
Merged

Append injected params in a consistent position when rewriting bulk entries#107
chippison merged 2 commits into
masterfrom
dev-20649

Conversation

@sgiehl

@sgiehl sgiehl commented Aug 10, 2026

Copy link
Copy Markdown
Member

Description

When a bulk tracking entry already contained a cip or token_auth key, the proxy overwrote it in place, leaving the proxy's injected value at whatever position the entry happened to use instead of a consistent one — http_build_query() keeps an existing key's position when its value is replaced. The keys are now unset before the proxy assigns its own, so they are always appended last, matching the single-request path (which already unsets token_auth before assigning its own). This is a no-op for entries that carry neither key. A regression test covers the placement.

Checklist

  • I have understood, reviewed, and tested all AI outputs before use
  • All AI instructions respect security, IP, and privacy rules

…ntries

When a bulk entry already contained a cip or token_auth key, the proxy
overwrote it in place, leaving the proxy's own value at whatever position the
entry used instead of a consistent one - http_build_query() keeps an existing
key's position when its value is replaced. Unset those keys before assigning
the proxy's own so they are always appended last, matching the single-request
path, which already unsets token_auth before assigning its own. This is a no-op
for entries that carry neither key.
@sgiehl sgiehl added this to the Current sprint milestone Aug 10, 2026
@sgiehl
sgiehl requested a review from a team August 10, 2026 14:55
Cover both branches: the per-entry token path (the proxy's token is appended at
the end of an entry that already carries a token_auth key) and the top-level
token path (an entry's own token_auth key is dropped when no per-entry token is
injected).

@chippison chippison 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.

Everything looks good!

Thanks for adding those tests, this closes the gaps 👍

@chippison
chippison merged commit a82d7af into master Aug 11, 2026
8 checks passed
@chippison
chippison deleted the dev-20649 branch August 11, 2026 20:51
sgiehl added a commit that referenced this pull request Aug 12, 2026
withProxyTracking() unsets cip before assigning the proxy's own so it is
appended last rather than left at an existing key's position (#107). On master
the cip half of that unset is unreachable: cip is checked with
array_key_exists() in $overrideParams, so any entry carrying a cip key is
treated as offending and never reaches the function.

Treating an empty or array cip as "no cip" makes it reachable, which is the
interaction the unset exists to protect - and nothing covered it: dropping
cip from the unset left all 93 tests green while the placeholder visibly moved
from the end of the entry to the empty key's position mid-entry.

The new test uses an entry whose empty cip is mid-entry, so the position is
observable, and asserts the placeholder is appended last. The existing
empty-cip test keeps its cip at the end, where both behaviours look identical.

Raised in review of #107.
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