Skip to content

fix(taint): gate *http.Request auto-taint on entry-point detection#1630

Open
ravisastryk wants to merge 4 commits intosecurego:masterfrom
ravisastryk:fix/g704-false-positive
Open

fix(taint): gate *http.Request auto-taint on entry-point detection#1630
ravisastryk wants to merge 4 commits intosecurego:masterfrom
ravisastryk:fix/g704-false-positive

Conversation

@ravisastryk
Copy link
Copy Markdown
Contributor

Fix G704 false positive on interface wrapper methods

Fixes #1629

isParameterTainted unconditionally treated any *http.Request parameter as tainted by type, without checking whether callers actually passed tainted data. This caused false positives on wrapper methods like NamedClient.Do called exclusively with constant-URL requests.

Root cause

The type-based auto-taint in isParameterTainted short-circuited before consulting the CHA call graph, so callers were never inspected.

Fix
auto-taint only when the function has no known in-edges (true external entry point). When callers exist, fall through to the existing caller-verification loop.

…ecurego#1629)

isParameterTainted unconditionally tainted any *http.Request parameter by
type, even when the function had known callers passing constant-URL requests.

Check the CHA call graph first: only auto-taint when the function has no
in-edges (true external entry point). When callers exist, fall through to
the existing caller-verification loop instead.
Fixes securego#1629
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🤖 Barry Security Review

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.18%. Comparing base (1af5d58) to head (adf3cb1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1630      +/-   ##
==========================================
+ Coverage   81.07%   81.18%   +0.10%     
==========================================
  Files         108      108              
  Lines       10096    10123      +27     
==========================================
+ Hits         8185     8218      +33     
+ Misses       1426     1423       -3     
+ Partials      485      482       -3     

☔ View full report in Codecov by Sentry.
📢 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.

@ravisastryk ravisastryk marked this pull request as ready for review April 2, 2026 01:47
Copy link
Copy Markdown
Contributor

@costela costela left a comment

Choose a reason for hiding this comment

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

FWIW, this seems better than #1628! 👍 🚀

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.

G704: false positive on constant source

2 participants