GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python: taint is lost through list.extend, list.insert and += , but not list.append · Issue #22305 · github/codeql

Python: taint is lost through list.extend, list.insert and += , but not list.append #22305

New issue
Copy link
New issue
Copy link
Closed
#22310
Closed
Python: taint is lost through list.extend, list.insert and += , but not list.append#22305
#22310
Copy link
Assignees
hvitvedcopilot-swe-agent

Description

@espressolee
espressolee
opened on Aug 10, 2026
Issue body actions

Summary

CodeQL's Python taint tracking propagates through list.append, but not through list.extend, list.insert, or += on a list. A security query therefore reports a flow written one way and stays silent on the same flow written another way, where the two differ only in which list-mutation method is used.

I'm reporting the asymmetry rather than the incompleteness: append is clearly modelled, so the other three look like a gap in the same model rather than a deliberate boundary.

Reproducer

Each snippet is the same flow — a request parameter reaching subprocess.call(..., shell=True) — differing only in how the value passes through a list.

# reported
def handler():
    user = request.args.get("cmd")
    acc = [user]
    subprocess.call(acc[0], shell=True)

# reported
def handler():
    user = request.args.get("cmd")
    acc = []
    acc.append(user)
    subprocess.call(acc[0], shell=True)

# NOT reported
def handler():
    user = request.args.get("cmd")
    acc = []
    acc.extend([user])
    subprocess.call(acc[0], shell=True)

# NOT reported
def handler():
    user = request.args.get("cmd")
    acc = []
    acc.insert(0, user)
    subprocess.call(acc[0], shell=True)

# NOT reported
def handler():
    user = request.args.get("cmd")
    acc = []
    acc += [user]
    subprocess.call(acc[0], shell=True)

Results

codeql database analyze <db> codeql/python-queries:Security/CWE-078/CommandInjection.ql

construct reported
acc = [user] yes
acc.append(user) yes
acc.extend([user]) no
acc.extend(other) where other = [user] no
acc.extend([user]) then for x in acc: no
acc.insert(0, user) no
acc += [user] no

Environment

  • CodeQL CLI 2.26.2 (bundle codeql-bundle-osx64), macOS arm64
  • query: shipped Security/CWE-078/CommandInjection.ql, unmodified
  • the same asymmetry appears with Security/CWE-022/PathInjection.ql and Security/CWE-089/SqlInjection.ql

Controls

  • acc = [user] and acc.append(user) are reported, so the query, source and sink all work on these files.
  • A variant where the value comes from a local constant instead of request.args is not reported, so the rule is source-dependent rather than firing on shape.
  • All files were present in the database source archive, so the silences are misses rather than unanalysed files.

Note

append in Go is tracked as #14116. This is the Python analogue for the other three mutation forms.

Reacted by Copilot

Activity

  1. hvitved
    assigned
    Copilot
    and
    hvitved
    on Aug 10, 2026
  2. Copilot
    linked a pull request that will close this issuePython: Add taint flow through list.extend and list.insert #22310on Aug 10, 2026
  3. hvitved commented on Aug 10, 2026

    @hvitved
    hvitved
    on Aug 10, 2026
    Contributor
    More actions

    Hi 👋

    Thank for reporting, those do indeed look like shortcomings that should be addressed.

  4. hvitved
    closed this as completedon Aug 13, 2026
  5. hvitved
    reopened this on Aug 13, 2026
  6. hvitved
    closed this as completedin #22310on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • Copilot
  • @hvitved
    hvitved

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

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.