You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gate-7 Pattern 6 is blinded by a (string) cast on the session identity — a false positive whose recommended repair adds a redundant guard #414
gate-7's session-identity recogniser (Pattern 6) is blinded by a (string) cast on the identity expression. The guard is unchanged; only its spelling moves the verdict.
Found on openbuild AppOverrideController::getUser(), an endpoint whose UID is never a request parameter and is handed straight to AppOverrideService::getUserDelta(appId:, uid:) — textbook Pattern 6, flagged anyway.
Four arms on the shipped file, nothing else changed
arm
expression carrying the session identity
check_no_admin_idor.py
A (shipped)
uid: (string)$user->getUID()
FAIL
B
uid: $user->getUID()
PASS
C
$uid = (string)$user->getUID(); … uid: $uid
FAIL
D
appId: (string)$appId, uid: $user->getUID()
PASS
E
$uid = $user->getUID(); … uid: $uid
PASS
Both directions demonstrated: the checker reports on this file (arm A), and stops reporting on a one-token change (arm B).
D rules out "any cast in the call defeats it" — casting an unrelated argument is harmless.
C rules out "hoist it into a local" as the workaround — the cast defeats the recogniser through a variable too. C is the arm I expected to pass, and it did not; the expectation was computed before the run.
Why this class matters more than its count
It is a false positive that recommends the wrong repair. The runner's own FAIL guidance says "The fix is to scope the object to the caller" — but the object is already scoped to the caller. Following the guidance means adding a redundant guard to an endpoint that already had one, and then believing the gate about it.
(string)$user->getUID() is a common defensive spelling precisely because IUser::getUID() carries no PHP return type (only @return string, lib/public/IUser.php), so static analysers encourage the cast. The gate and the analysers pull in opposite directions on the same line.
Measured blast radius — reported as measured, not extrapolated
Across the six apps in this sweep (openbuild, doriath, scholiq, launchpad, larpingapp, openconnector):
the (string)-cast session-identity spelling occurs 7 times in lib/ (openbuild 5, launchpad 2, the other four 0);
but only 1 of the 20 live gate-7 findings is this class.
⚠️ The other 12 fleet apps are unmeasured. The remaining 6 sites in these six apps sit in methods that pass for other reasons, so 7 is an upper bound on the sites, not on the findings.
Fixed in-app meanwhile
ConductionNL/buildiq#196 drops the cast (it is a no-op: getUserDelta() declares string $uid under strict_types=1). That is the right change for that repo either way, but it is a workaround for this defect, not a fix for it — the next app to write the idiomatic cast gets the same false positive.
Suggested fix
Normalise the identity expression before matching: strip a leading cast ((string), (int)) when tracing an argument back to a getUID() / getUser()->getUID() source, and apply the same normalisation on the local-variable trace so arms C and E agree.
Activity
fix(gate-7): Pattern 8 is keyed on the signature, so a SOAP endpoint …
fix(gate-7): a (string) cast blinded Pattern 6 — the guard was unchan…