Skip to content

Add CodeQL and dependency scanning so a malicious or vulnerable dependency is caught #242

Todo

Description

@TheCodeHeist-Coder

CI checks that the code builds, type-checks, passes tests and contains no committed secrets. It does not look at the code for vulnerabilities, and it does not look at dependencies at all.

What is missing:

$ ls .github/dependabot.yml          # none
$ grep -l codeql .github/workflows/  # none
$ grep -c "pnpm audit" .github/workflows/ci.yml   # 0

Why it matters

This is a public repo taking pull requests from people nobody has met, and pnpm-lock.yaml is part of the diff. A PR that adds one transitive dependency is visually indistinguishable from a PR that adds one transitive dependency with a postinstall script.

Nothing currently reads dependency changes, and nothing scans the source for the patterns that usually indicate a problem — a shell call built from user input, a path joined from a request parameter, a comparison that leaks timing.

What to add

CodeQL — GitHub runs it free on public repos and it understands both JavaScript/TypeScript and Python, so it covers all five services. Add .github/workflows/codeql.yml from the starter workflow, running on pull requests and on a weekly schedule. Weekly matters: a rule added after your PR merged still finds the bug.

Dependabot — .github/dependabot.yml with an ecosystem entry for npm at the repo root and for pip in apps/genAI. Security updates and a modest weekly cadence for version updates; grouping dev dependencies into one PR keeps the noise down.

A dependency audit step in CI — pnpm audit --audit-level=high. Start it as continue-on-error: true to see the existing noise rather than blocking every PR on day one, and open a follow-up to make it a gate once it is clean.

Worth thinking about

  • CodeQL will probably find things on the first run. Triage them in the PR rather than suppressing the lot — the point is to look.
  • pnpm audit on a monorepo this size will report transitive advisories you cannot fix directly. Being explicit about which ones are accepted, and why, is more useful than a blanket ignore.
  • A lockfile-diff check — flagging a PR that changes pnpm-lock.yaml without changing any package.json — would catch the specific case above. Nice to have rather than essential.

Definition of done

  • CodeQL runs on every pull request and weekly
  • Dependabot opens security updates for npm and pip
  • CI reports high-severity dependency advisories
  • Existing findings are triaged, not suppressed wholesale

Good backend issue. Mostly configuration rather than code, but the triage at the end is where the real work is — and it is a genuinely useful thing to have done.

Activity

  1. added
    enhancement
    help wanted
    Backend first issue
    on Nov 22, 2026
  2. divyanshAgarwal123 commented on Nov 24, 2026

    @divyanshAgarwal123
    Contributor

    Could you assign #242 to me and confirm its NSoC eligibility and appropriate level? I checked current main 63b51dd, CONTRIBUTING.md, the full issue thread and all open PRs: only CI/CD workflows are present, with no CodeQL or Dependabot configuration and no dependency audit. There are no competing claims here. My assigned #244 is now delivered in PR #250.

    I would add the standard JavaScript/TypeScript + Python CodeQL workflow for pull requests and weekly analysis with scoped permissions; configure weekly root-npm and apps/genAI-pip Dependabot updates with grouped development updates; and add the requested high-severity pnpm audit reporting without weakening current gates. I would record the actual initial findings and triage/follow-up status rather than suppress them or claim the baseline clean. Existing #243 lint/test cleanup is claimed by another contributor and stays separate.

    Please also confirm the repository permits advanced CodeQL setup (or whether default setup is already enabled) and that security alerts/Dependabot security updates can be enabled by an owner; configuration alone cannot prove those owner settings or that a future bot update opened. I will wait for actual assignment and those settings before implementation.

  3. TheCodeHeist-Coder commented on Nov 25, 2026

    @TheCodeHeist-Coder
    OwnerAuthor

    Assigned to you, @divyanshAgarwal123 — and yes, NSoC eligible. I've added nsoc26 and level3.

    On the level: higher than your #244. The configuration itself is level2 work, but the triage at the end is the real task — a first CodeQL run on five services across two languages will produce findings, and sorting the genuine ones from the noise is the part that takes judgement. If it turns out the first run comes back nearly clean, say so and I'll reconsider the level rather than hold you to work that wasn't there.

    Your read of the repo matches mine. No CodeQL, no Dependabot, no audit step, no competing claims. #250 is merged, thanks for that.

    Now your three questions, all checked against the repo settings just now rather than guessed.

    1. CodeQL — advanced setup is clear to use

    Default setup is not enabled, so there's nothing to conflict with. Add the advanced workflow as you proposed.

    Note actions is in that list. Workflow files are scannable too, and given this repo just moved CD to a workflow_run trigger, that's worth including — it catches things like an untrusted input reaching a run: block. Your call whether to put it in scope here or leave it for a follow-up; I'd lean toward including it since it's one more line in the matrix.

    2. Dependabot alerts — now enabled

    You were right that config alone can't prove these, and right to ask rather than assume. Both are owner-only settings, so they were mine to do, not your blocker to clear.

    Dependabot alerts and Dependabot security updates are both on now. Code scanning default setup is deliberately left off so it doesn't collide with your advanced workflow.

    3. On not claiming a clean baseline

    This is the right instinct and I want to be explicit that I mean it: a PR that reports "CodeQL found 7 things, 3 are real, here they are" is worth more to me than one that reports zero.

    If you find something genuinely exploitable — not a style warning, an actual vulnerability — don't put it in the PR. Report it through Security → Report a vulnerability and we'll handle it privately, same as #215. A public PR comment naming a live hole is the one failure mode worth avoiding here.

    For pnpm audit: starting with continue-on-error: true is right. Don't try to get it to zero in this PR. Report what it finds, note which advisories are transitive and unfixable from our side, and open a follow-up issue to make it a gate once the picture is clear.

    Two practical notes

    Permissions. Scope them per-job, not at the workflow root. The CodeQL job needs security-events: write; nothing else in it does.

    Branch protection. main now requires CI green. If something merges before yours you'll see "Required to update" — click Update branch, it re-runs. Not something you broke.

    Scope boundary

    Agreed that #243 stays separate — @spikedeeev has it. If your CodeQL run flags something in the same frontend files their lint work touches, mention it here and we'll sequence it rather than have you both editing the same lines.

    One ask: if the triage turns out to be much bigger than it looks, split it. Workflows and config in one PR, triage of findings in a second. Easier to review and you're not sitting on a large branch while findings get discussed.

  4. divyanshAgarwal123 commented on Nov 25, 2026

    @divyanshAgarwal123
    Contributor

    Delivered the configuration + initial dependency-triage stage in ready-for-review #265 at 5184afad78a0eee667de4850dfaa48cc15178473. All 15 hosted checks pass, including JavaScript/TypeScript, Python and Actions CodeQL analysis, five Docker builds, migrations/schema, tests/types and the dependency report. The report correctly exits 1 with 1 critical / 86 high affected dependency entries; its CI step is nonblocking as agreed. The full 39-module inventory distinguishes direct/transitive dependencies, tooling context and the existing bot fixes #263/#264; #266 tracks remediation and enabling the gate.

    One concrete remaining #242 blocker: reading the stored CodeQL analyses and branch alerts returned HTTP 403 for my current login. The public check says only “No new alerts in code changed by this pull request”; I am not calling the entire baseline clean or the source-triage requirement complete. Please review those stored branch findings privately, or arrange appropriate read access, so that part can be triaged without exposing exploitable details here. Keeping #242 open for that work, as your staged-delivery guidance allows. #243 files are untouched.

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

Metadata

Metadata

Labels

Backend first issueenhancementhelp wantedlevel3nsoc26

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions