Repository navigation
Conversation
akhilp117
force-pushed
the
akhilpindiprolu/eng-8951-follow-same-file-helpers
branch
from
November 6, 2026 18:02
98b5aaf to
9e1f791
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9e1f791. Configure here.
DominikB2014
approved these changes
Nov 10, 2026
DominikB2014
left a comment
Contributor
There was a problem hiding this comment.
We went over this pr in person, this flow is getting quite complex, but i'm okay with running with this and giving it a try. This isn't actually being ran in CI yet
akhilp117
force-pushed
the
akhilpindiprolu/eng-8951-follow-same-file-helpers
branch
from
November 12, 2026 15:46
9adf674 to
37c386e
Compare
akhilp117
force-pushed
the
akhilpindiprolu/eng-8951-follow-same-file-helpers
branch
from
November 12, 2026 16:32
37c386e to
dbc573a
Compare
Contributor
|
This PR is too large for Bugbot to review. It changes 58,255 lines and 3,798,062 characters. Split the change into smaller pull requests to get a review. |
akhilp117
force-pushed
the
akhilpindiprolu/eng-8951-fix-s026-to-catch-raw-reads-being-passed-into-helpers
branch
from
November 12, 2026 16:33
c9540fc to
cc98e57
Compare
DominikB2014
approved these changes
Nov 13, 2026
… as an S028 hand off
…eave A followed helper dropped the call's S028 even when it returned, stored or copied the payload, so nothing reported where it went. Drop the S028 only when every use of the parameter in the helper is a read, a check (isinstance, in, is None, truthiness, len) or a recorded hand-off.
…e function A call was followed even when the name was shadowed in the calling function, bound more than once, or reached through a class tree whose depth-first order may not be Python's, so the S028 master reports was dropped. Keep the S028 in those cases, and when a helper reassigns the parameter it was given.
data = request.data followed by data = serializer.validated_data still read
data.get("name") as a raw body read. A reassignment to a value that isn't
built from request input now ends that for the later reads in the same
block; after an if, loop, try or nested def the name may still be the
request, so it goes back to what it was. This also applies to locals in
public methods, not just helper parameters.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Part 2 of 2 for ENG-8951 (https://linear.app/getsentry/issue/ENG-8951/fix-s026-to-catch-raw-reads-being-passed-into-helpers). The S025-S028 input rules only looked inside a public endpoint method, so a raw read or a serializer inside a helper it calls was never reported. This follows those helpers and reports what they read, checked against the public method's
@extend_schema._report_public_inputsbuilds each public method's report with_merged_http_method_inputs, which starts a newctxand fills it with_merge_ctx_into. For every call the method makes,_helper_call_ctx_lookupfinds the same-file function that actually runs:helper()call is a module-level functionself.helper()goes through the public class's bases in the order_handle_inheritance_method_lookupand_walk_class_basesreturn, so subclass overrides winsuper().helper()starts after the class that made the call_merge_ctx_intocopies the helper's reads, serializers and hand-offs, then does the same for the helper's own calls, so helpers of helpers are followed toodef helper(self, params): params.get("id")), which only means something once we know what the caller passed. We handle this through_bind_call, which matches the call's arguments with the helper's parametersWhat we report now:
ApiInputViolation.callerrecords the first public method that reaches it, so a module-level helper can still be given an owner@extend_schemaWhen a helper isn't followed the S028 stays
isinstance,in, is None, truthiness,len) don't count as leavingOther changes
request.GETif xyz else {abc}counts as an input sourcedata=call to a name ending in_cls, serializer or validator (serializer_cls(data=xyz),settings.validator(data=xyz)) counts as a serializer and not an S028 hand-offisinstance(request.data)is no longer an S028, which was a bug that existed when the rules were first implementeddata = serializer.validated_data) stops counting as request input for the reads after it in the same block, sodata.get("name")is no longer a wrong S026. After an if, loop, try or nested def the name may still be the request, so it's tracked again. This also changes main's checks for local variables in public methods andd not just helper parametersTotal results (mains plugin vs this PR's plugin on the same commit 493f22a)