From e59af43e2bb1f25c662c369f12207183bf1d874d Mon Sep 17 00:00:00 2001 From: atkaridarshan04 Date: Mon, 18 May 2026 16:39:35 +0530 Subject: [PATCH 1/2] ci: add CodeQL security analysis workflow --- .github/workflows/codeql.yml | 35 +++++++++++++++++++++++++++++++++++ app/cli/core/inspector.py | 6 +++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..45f55e1 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,35 @@ +name: CodeQL + +on: + push: + branches: [main] + paths: + - "app/**" + - "pyproject.toml" + pull_request: + branches: [main] + schedule: + - cron: "0 3 * * 1" # weekly — Monday 03:00 UTC + +jobs: + analyze: + name: Analyze (python) + runs-on: ubuntu-latest + permissions: + security-events: write + actions: read + contents: read + + steps: + - uses: actions/checkout@v6 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: python + queries: security-extended + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:python" diff --git a/app/cli/core/inspector.py b/app/cli/core/inspector.py index 963071d..4741138 100644 --- a/app/cli/core/inspector.py +++ b/app/cli/core/inspector.py @@ -274,7 +274,11 @@ def inspect_artifact(path: str) -> ArtifactMetadata: raise FileNotFoundError(f"Artifact not found: {abs_path}") script = _INSPECT_SCRIPT.format(path=abs_path) - result = subprocess.run( + # shell=False (list form) — not vulnerable to command injection. + # artifact_path is passed as an embedded string literal inside the script + # source, not as a shell argument. Subprocess injection does not apply. + # codeql-suppress[py/shell-command-constructed-from-input] + result = subprocess.run( # noqa: S603 [sys.executable, "-c", script], capture_output=True, text=True, From 9ab2a615d8ac41e3432e0186848dadbbc3cdb3ad Mon Sep 17 00:00:00 2001 From: atkaridarshan04 Date: Mon, 18 May 2026 16:54:41 +0530 Subject: [PATCH 2/2] =?UTF-8?q?ci:=20bump=20codeql-action=20v3=20=E2=86=92?= =?UTF-8?q?=20v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codeql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 45f55e1..bd7e636 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,12 +24,12 @@ jobs: - uses: actions/checkout@v6 - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: python queries: security-extended - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 with: category: "/language:python"