Skip to content

SonarCloud: the pattern that reads a workflow's environment is held linear (#360, #359, #361) - #495

Merged
don-petry merged 2 commits into
mainfrom
sonar-findings
Nov 3, 2026
Merged

don-petry merged 2 commits into
mainfrom
sonar-findings

Conversation

@don-petry

@don-petry don-petry commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

SonarCloud's three audit issues, each finding taken in turn. One is open in SonarCloud today, and it is a false positive: this PR holds it with a test and a mutant and marks it inline. The rest were settled by #451 and #453, which merged on 2026-10-31, and SonarCloud closed them the same day. The audit issues were left open because the audit has not updated them since.

Finding File In SonarCloud Here
pythonsecurity:S2631, ReDoS via file content (#360) tools/jsonschema_lite.py CLOSED, FIXED, 2026-10-31 Nothing to do: #451 holds the schemas' patterns to a time limit and marks the line inline
python:S8495, tuples of differing length (#359) release/current.py CLOSED, FIXED, 2026-10-31 Nothing to do: fixed by #451
python:S8510, loop variable shadows fixture (#359) tools/check_trials.py CLOSED, FIXED, 2026-10-31 Nothing to do: fixed by #451
shell:S7688, [[ for [, 43 (#361) tools/context_eval.sh, tools/trial_as_app.sh CLOSED, FIXED, 2026-10-31, all 43 Nothing to do, and not a real finding: #453 set the rule aside for these two scripts in sonar-project.properties, as the Builder ruled. Both are bash and every [ quotes its operands, so [[ would not change behaviour
python:S8786, regex alternatives overlap (new, not in an issue yet) tools/environments_drift.py:25 OPEN, MAJOR False positive, held: see below

S8786. SonarCloud reads the blanks before WORKFLOW's value as overlapping the value, so it expects backtracking. None happens:

  • an attempt starts only at a line's start;
  • once past environment:, the pattern ends in ([^\n]*)$, which matches to the line's end whatever came before it, so nothing after the colon can fail and backtrack.

Measured: 16,000 adversarial characters take at most 1.2 ms. The input is this repo's own workflow files, read at the Maintainer's terminal.

The change:

  • the schemas' backtracking guard (Validator.backtracks) can now be given a compiled pattern, whose flags it keeps, and the text a pattern opens with where that text sits behind a class, so it reaches the repeats behind environment:;
  • a test holds WORKFLOW to that guard on four openings: the value's line, and the mapping form's name: line;
  • two mutants each make one repeat nested, the value's and the name: line's, and the test kills both. As for the schemas' patterns, no pattern that backtracks is written in the test, since that would be CodeQL's alert;
  • the line carries # NOSONAR with its reason in the comment above, following SonarCloud: the schema patterns are held to a limit, one finding fixed and two declined (#360, #359) #451's precedent and the issues' own acceptance ("no blanket NOSONAR unless a confirmed false positive, noted inline").

Not touched: kernel/.

Closes #359
Closes #360
Closes #361

Reviews

Four reads at 24ac81e, all applied in 5d1377a:

Read Findings Disposition
Claude review minor PR-3: the test never reaches the name: line, and a nested repeat there survives; info PR-1: the issues closed do not name S8786 Fixed: the name: line is probed, with its own mutant. The info item is already disclosed above
Security pass none —
Argon major PR-3: the guard's flags parameter has no test that fails without it; minor PR-3: the test writes re.M instead of reading WORKFLOW's flags, and skips the name: line Fixed: the parameter is gone. The guard takes WORKFLOW compiled, with its own flags
Muse minor PR-3: the name: line is unprobed (same as Claude's) Fixed, as above
CodeQL #53 py/redos, high, on the test's own control pattern at tests/test_tools.py:10366 Fixed: the control is removed, and the mutants show that the guard notices a nested repeat. Not dismissed

🤖 Generated with Claude Code

…inear (#360, #359, #361)

S8786 reads the blanks before the value as overlapping it. They cannot backtrack: an attempt starts at a
line's start and ends in a repeat that matches to the line's end. A test holds that with the schemas' own
guard, now given the text a pattern opens with, and a mutant breaks it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@don-petry
don-petry requested a review from a team as a code owner November 3, 2026 03:38
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T03:38:50.776538Z
We couldn’t complete this review. Comment @codex review to try again.
24ac81e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Comment thread tests/test_tools.py Fixed
… and the name line is probed

CodeQL raised the test's own control, a nested repeat written to show the guard notices one. It is gone:
as for the schemas' patterns, the mutants show that. The guard takes the compiled pattern, so it reads
WORKFLOW's own flags, and it now probes the mapping's `name:` line too, with a mutant for that branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@don-petry
don-petry added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 9a3243f Nov 3, 2026
19 checks passed
@don-petry
don-petry deleted the sonar-findings branch November 3, 2026 05:56
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.

SonarCloud: shell script hygiene SonarCloud: code security review (pythonsecurity) SonarCloud: miscellaneous findings

2 participants