Skip to content

test(image): assert nix.conf tokens by exact membership (clear CodeQL url-substring) - #785

Merged
c-vigo merged 1 commit into
feature/625-nix-claude-migrationfrom
bugfix/784-codeql-url-substring
Jun 30, 2026
Merged

c-vigo merged 1 commit into
feature/625-nix-claude-migrationfrom
bugfix/784-codeql-url-substring

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Closes #784.

CodeQL flagged two high-severity py/incomplete-url-substring-sanitization alerts at tests/test_image.py:1118,1121 — the #773 nix.conf assertions used "https://cache.nixos.org" in sub_line (URL-substring-in-string), which CodeQL treats as bypassable host validation.

Fix: split the substituters / trusted-public-keys lines into whitespace tokens (split("=", 1)[1].split() — maxsplit=1 preserves the base64 keys' trailing =) and assert exact membership in the token list. Clears the alerts and tightens the assertion (URL/key must be a whole token, not an accidental substring).

No behaviour change; test-only. Verified: ast.parse OK, ruff check + ruff format --check clean. In-container assertions validated by the dispatched image-suite CI.

Split the substituters/trusted-public-keys lines into whitespace tokens
and assert exact membership instead of URL-substring-in-string, clearing
the CodeQL py/incomplete-url-substring-sanitization alerts and making the
assertions stricter.

Refs: #784
@c-vigo
c-vigo merged commit bd0491a into feature/625-nix-claude-migration Jun 30, 2026
10 checks passed
@c-vigo
c-vigo deleted the bugfix/784-codeql-url-substring branch June 30, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant