Skip to content

test: add debug tool endpoint (canary for CodeQL shell injection dete…#43

Closed
atkaridarshan04 wants to merge 1 commit into
mainfrom
test/codeql-canary
Closed

test: add debug tool endpoint (canary for CodeQL shell injection dete…#43
atkaridarshan04 wants to merge 1 commit into
mainfrom
test/codeql-canary

Conversation

@atkaridarshan04
Copy link
Copy Markdown
Collaborator

Summary

Adds a deliberately vulnerable debug endpoint to verify that the CodeQL security-extended workflow correctly detects and reports a py/shell-command-constructed-from-input finding on PRs targeting main.

Changes

  • Added GET /debug/tool?cmd= endpoint in app/adapters/http/routes/debug.py that passes an HTTP query parameter directly into subprocess.run(..., shell=True) — a textbook shell injection vulnerability

Type

  • Chore / dependency update

Testing

  • pytest passes
  • Coverage ≥ 70%
  • Tested manually — purpose of this PR is to trigger CodeQL, not to pass tests

Expected CodeQL result: A py/shell-command-constructed-from-input alert should appear as an inline annotation on app/adapters/http/routes/debug.py in this PR's Files Changed tab, and under Security → Code scanning alerts.

⚠️ This branch must NOT be merged. It exists solely to confirm the CodeQL PR trigger is working. Close after the alert is confirmed.

Related Issues

N/A — CodeQL workflow validation only

@atkaridarshan04 atkaridarshan04 added this to the v1 milestone May 18, 2026
@atkaridarshan04 atkaridarshan04 self-assigned this May 18, 2026
@atkaridarshan04 atkaridarshan04 added the invalid This doesn't seem right label May 18, 2026
return {"loaded_models": loaded} No newline at end of file

@router.get("/debug/tool")
def run_debug_tool(cmd: str) -> dict:
@atkaridarshan04 atkaridarshan04 removed this from the v1 milestone May 18, 2026
@atkaridarshan04 atkaridarshan04 removed their assignment May 18, 2026
@atkaridarshan04
Copy link
Copy Markdown
Collaborator Author

Verification done for CodeQL working.

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

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants