Skip to content

[BUG] CodeQL: incomplete-url-substring-sanitization in test_image.py nix.conf assertions #784

Closed

Description

@c-vigo

Source: CodeQL (PR #670 merge ref) flagged two high-severity py/incomplete-url-substring-sanitization alerts at tests/test_image.py:1118 and :1121, introduced by the #773 nix.conf assertions.

Problem

test_nix_conf_bakes_explicit_substituters asserts "https://cache.nixos.org" in sub_line (substring-in-string). CodeQL heuristically treats a URL checked as a substring of another string as bypassable host validation → high-severity alert. Harmless in a test assertion, but a real new alert on the PR.

Fix

Split the substituters (and, for consistency, trusted-public-keys) line into whitespace tokens and assert exact membership in the token list instead of substring-in-line. Clears the CodeQL alert and is a stricter assertion (the URL/key must be a whole token, not an accidental substring).

Refs #625, #773.

Activity

  1. added
    bug
    priority:high
    area:ci
    effort:small
    area:testing
    on Jun 30, 2026
  2. c-vigo commented on Jun 30, 2026

    @c-vigo
    ContributorAuthor

    Landed on the migration branch via #785.

  3. added a commit that references this issue on Jun 30, 2026
    bd0491a
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

    area:ciarea:testingbugeffort:smallpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions