Skip to content

taint tracking: keep a set of sources per name so reassignment can't drop the stronger TT rule #750

Closed

Description

@udsy19

Summary

Follow-up from the review of #611 (fixes #610). The behavioral_taint_tracking analyzer keys taint by variable name, storing a single source per name. When a name is reassigned from different sources, only one source survives, so a sink can be attributed to the wrong source rule and a stronger TT finding can be lost.

Detail

_collect_tainted records one source_call per name (_mark_targets is add-only and keeps the first writer; main's single-pass kept the last writer). Either way, for:

secret = os.environ["API_KEY"]   # would drive the stronger rule (e.g. TT3/TT5)
secret = request.args.get("x")   # weaker/other classification
sink(secret)

the surviving source depends on write order (first-write under #611, last-write on main), and the other is dropped. An author could also order the writes to pick which rule fires. In both models the sink is still reported, but potentially under a weaker TT rule than one of its real sources warrants.

Proposed direction

Track a set of sources per name rather than a single source_call, and when a sink consumes a name, emit/classify against the strongest applicable source (or all of them). This keeps the order-independent, add-only, fire-once worklist from #611 — the value would become a set that only grows.

Notes

Activity

  1. rng1995 commented on Oct 19, 2026

    @rng1995
    Collaborator

    Resolved by merged PR #799 (merge commit 530d3c5c), verified on main 95a52d89 on 2026-10-19.

    The analyzer now retains bounded, ranked source information for each sink category, so reassignment cannot discard the stronger applicable TT classification merely by changing source order. This achieves the issue's requested strongest-source outcome without requiring an unbounded set of source facts.

    Regression coverage verifies both assignment orders, alias propagation, late source upgrades, helper flows, and sink-specific ranking. The behavioral-taint suite passed as part of a fresh 349-test offline run; no specimen code or live provider requests were executed.

    Closing as completed. PR #754 was closed without merging; the accepted implementation landed independently in #799.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions