Skip to content

feat: implement issue #1361 — SonarCloud: code security review (pythonsecurity) - #1383

Open
don-petry wants to merge 49 commits into
mainfrom
dev-lead/issue-1361-20261027-2120
Open

don-petry wants to merge 49 commits into
mainfrom
dev-lead/issue-1361-20261027-2120

Conversation

@don-petry

@don-petry don-petry commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

User description

Problem

SonarCloud: code security review (pythonsecurity)

From the issue: 2 open SonarCloud finding(s) in combsmith/.github, worst severity MAJOR. Generated by the org SonarCloud Audit.

Risk

Low — 3 file(s) changed; no CI- or runtime-critical paths touched.

Test plan

No test files were added or updated. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the existing CI (bats + lint) guards the change.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

This PR's CI checks (Lint + bats) are the success/regression signal.

Closes #1361

View guided diff Turn on auto-fix


CodeAnt-AI Description

Prevent unsafe file access when validating signals

What Changed

  • Signal and schema files are now read only after their paths are confirmed within approved directories.
  • Missing files and file access errors produce a clear message and exit code 2.

Impact

✅ Blocks reads outside approved directories
✅ Clearer errors for missing signal or schema files

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@don-petry don-petry added the auto-rebase:ready Opts a non-draft PR into auto-rebase without an approval (auto-rebase ready_label) label Oct 27, 2026
@don-petry
don-petry requested a review from a team as a code owner October 27, 2026 21:24
@coderabbitai

This comment has been minimized.

@chatgpt-codex-connector

This comment has been minimized.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #1383
No changes were committed, but the PR still can't be marked done: required check SonarCloud is still pending. The retry cron will re-attempt automatically. Next attempt after: 2026-10-27T21:55:49Z

@don-petry

Copy link
Copy Markdown
Contributor Author

Note

@don-petry I reviewed this PR and no code changes were needed, but I can't mark it done yet: required check SonarCloud is still pending. I'll re-check automatically.
Next attempt after: 2026-10-27T21:55:49Z

@don-petry
don-petry enabled auto-merge (squash) October 27, 2026 21:25
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-27T22:26:37Z.

@donpetry-bot

donpetry-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry
don-petry disabled auto-merge October 28, 2026 00:12
@don-petry

This comment has been minimized.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
- Rate-limit notice ("Review limit reached"): No actionable findings — purely operational notice that the free OSS review quota was exhausted. [issue comment: disposition=informational]
Files changed: None
Skipped (informational): 1
```
The CodeRabbit comment contained only a rate-limit block with no findings-bearing sections (no Security Architecture Review, Actionable comments, Nitpicks, or Outside diff range sections). Since it is purely an operational notice with no specific code issues to fix, I posted an `informational` disposition on the original PR comment to clear the maintainer-comment gate. No code changes were needed.

@don-petry
don-petry enabled auto-merge (squash) October 28, 2026 00:13
@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry
don-petry disabled auto-merge October 28, 2026 01:28
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@donpetry-bot

donpetry-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@don-petry
don-petry disabled auto-merge October 28, 2026 05:26
@don-petry

This comment has been minimized.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
**Finding:** Code Review completed with no findings
- Status: ✅ Completed on commit `7447f9c`
- Result: `has_any_findings: false`, `has_unresolved_findings: false`
- **Action:** Dispositioned as `informational` — no code changes needed
**PR State:**
- ✅ All CI checks passing (no Tier 1 blockers)
- ✅ No review threads with changes requested
- ✅ Codex review found no issues
**Comment disposition:** Posted `informational` marker to clear the maintainer-comment gate (comment reply: https://github.com/combsmith/.github/pull/1383#issuecomment-6461430281)
**Files changed:** None — clean code review report requires no fixes.

@don-petry
don-petry enabled auto-merge (squash) October 28, 2026 05:27
@donpetry-bot

donpetry-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Superseded by automated re-review at 25363734e3258252e0f93cc014fe1fd7b8b98bc7 — click to expand prior review.

Review — fix requested (cycle 1/3)

The automated review identified the following issues. Please address each one:

Findings to fix

Automated review — NEEDS HUMAN REVIEW

Risk: MEDIUM
Reviewed commit: 7447f9c097e327288854ce3f23be538b75ee067c
Review mode: triage-approved (single reviewer)

Summary

The fix for SonarCloud S8707 in validate-signals.py is sound and well tested. However, the PR also commits a stray binary .coverage file (a 53 KB pytest-cov SQLite database) to the repository root. That artifact must be removed before merge, so this needs a code change and cannot be auto-approved.

Linked issue analysis

Closes #1361 (SonarCloud: two pythonsecurity:S8707 path-traversal findings in .github/scripts/feature-ideation/validate-signals.py).

  • Real fix, no NOSONAR: met. _confine_path now rebuilds the confined path from os.scandir entries under the trusted root (_rebuild_from_root) instead of returning the argv-derived string, which breaks the taint flow Sonar traced through the commonpath guard.
  • No behavior change: met. The old .exists() checks are replaced by FileNotFoundError handling that keeps the same not found / schema not found messages and exit code 2. New tests cover both. A non-directory intermediate component (NotADirectoryError) is caught by the new except OSError branch and also exits 2.
  • Findings resolved to zero: SonarCloud's PR quality gate passed with 0 new issues. Whether the two existing findings close will only show in the main-branch analysis after merge.

Findings

  1. [Blocking, maintainability/hygiene] Stray build artifact committed: .coverage (new binary file, 53,248 bytes). This is the pytest-cov / coverage.py SQLite data file left over from the local test run. It records absolute runner paths (/home/runner/work/.github/.github/...). It is not ignored by the repo's .gitignore (no coverage entry) and is unrelated to the fix. If committed, it will go stale and churn on every future local run. Fix: git rm --cached .coverage. Consider also adding .coverage (and .coverage.*) to .gitignore so the dev-lead agent cannot commit it again. The PR description ("3 file(s) changed") does not mention this file, and the triage tier missed it.

  2. [Non-blocking, nit] _rebuild_from_root matches case-insensitively via os.path.normcase. On Linux (where this runs) normcase is the identity, so this changes nothing. On a case-insensitive filesystem holding two entries that differ only by case, the first scandir hit wins. This is harmless here, so no action is needed.

  3. [Non-blocking, observation] Extra cost. Each confined path now does one scandir per path component. That is negligible for this CLI's two arguments.

Secret scan: the run_secret_scanning MCP tool was unavailable in this run. The gitleaks CI check passed, and the diff contains no credentials.

CI status

All checks are green: Lint, ShellCheck, the "Lint, schema, and bats" job, CodeQL (actions + python), SonarCloud (quality gate passed, 0 new issues), gitleaks, AgentShield, Agent Security Scan, and dependency-audit. Several checks were SKIPPED as not applicable, and CodeRabbit was NEUTRAL because it was rate-limited. There are no human reviews or unresolved review threads. mergeStateStatus is BLOCKED only because a required review is pending.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-28T12:48:24Z.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
     - `.coverage` file removal ✓
     - Docstring coverage improved to 80% ✓
   - Posted fresh `fixed` disposition with commit SHA `8c6ee39fb0a62e9ac4dd6f7d1eca53f32e05a45f`
2. **CodeAnt Promotional Comment** (`IC_kwDORyesfc8AAAABlfhJzA`)
   - Non-actionable operational notice with no findings
   - Posted `informational` disposition
**PR Status:**
- ✅ All CI checks passing (no failures)
- ✅ Both bot comments dispositioned
- ✅ Ready for harness verification and approval

@don-petry
don-petry enabled auto-merge (squash) November 12, 2026 00:57
@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.

@don-petry

Copy link
Copy Markdown
Contributor Author

No description provided.

@don-petry
don-petry disabled auto-merge November 12, 2026 01:45
@don-petry

Copy link
Copy Markdown
Contributor Author

Re-read the current CodeRabbit body (edited after my earlier disposition). Its findings are the two pre-merge warnings plus the earlier .coverage request:

  • Out of Scope Changes (.coverage committed): already resolved on this branch. Commit 8c6ee39 deleted .coverage and added .coverage / .coverage.* to the Python section of .gitignore. git ls-files .coverage is empty at head, and the PR diff now touches only validate-signals.py, its test file and .gitignore.
  • Docstring Coverage (66.67%): the same commit added the missing docstring. The 66.67% figure was measured at 5b392f3, before that commit.
  • Review skipped notice: CodeRabbit's own retry status. It has no code finding.

No new code change was needed this pass.

@don-petry

Copy link
Copy Markdown
Contributor Author

Re-read the current Codex summary. It reports only that the automated code review failed to run on b082fb2 ("Comment @codex review to try again"). It has no findings and needs no action, so I'm acknowledging it.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

@don-petry

Copy link
Copy Markdown
Contributor Author

Existing test changed without justification — human attention needed

The fix-reviews pass changed, deleted, or skipped existing test(s) to go with its fix: test/feature-ideation/pycache/test_validate_signals.cpython-312.pyc. A previously-passing test that disagrees with a change is a reason to question the change, not to edit the test, so dev-lead did not push this pass (#2013).

If the test really is wrong, a human should make that call, or the fix should carry a Test-Change-Justification: commit trailer that cites the reason (for example, the review comment that asked for it). Auto-merge has been disabled.

@don-petry

Copy link
Copy Markdown
Contributor Author

dev-lead is withholding action on this item.

It is labeled needs-human-review (flagged for human review — this label is applied by automation as well as by people, so an item can become held without anyone noticing), so dev-lead will not pick it up while that label is present. This notice is posted once so the withhold is visible rather than looking like a stalled run.

To re-enable automated pickup: remove the needs-human-review label.

@codeant-ai

codeant-ai Bot commented Nov 12, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

🔄  Review in progress

Status Commit Started (UTC) Finished (UTC)
🔄  #cdc3d Incremental review in progress… 357ec9a Nov 12, 2026 · 04:23 —

@codeant-ai

codeant-ai Bot commented Nov 12, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #cdc3d Incremental review completed 357ec9a Nov 12, 2026 · 04:24 04:24

@codeant-ai

codeant-ai Bot commented Nov 13, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

🔄  Review in progress

Status Commit Started (UTC) Finished (UTC)
🔄  #b8427 Incremental review in progress… aaf1198 Nov 13, 2026 · 12:31 —

@codeant-ai

codeant-ai Bot commented Nov 13, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #b8427 Incremental review completed aaf1198 Nov 13, 2026 · 12:31 12:31

This was referenced Nov 13, 2026
@codeant-ai

codeant-ai Bot commented Nov 15, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

🔄  Review in progress

Status Commit Started (UTC) Finished (UTC)
🔄  #ef198 Incremental review in progress… e5436ef Nov 15, 2026 · 15:54 —

@codeant-ai

codeant-ai Bot commented Nov 15, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #ef198 Incremental review completed e5436ef Nov 15, 2026 · 15:54 15:54

This was referenced Nov 15, 2026
@codeant-ai

codeant-ai Bot commented Nov 17, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

🔄  Review in progress

Status Commit Started (UTC) Finished (UTC)
🔄  #db4e5 Incremental review in progress… 7efd40c Nov 17, 2026 · 01:00 —

@codeant-ai

codeant-ai Bot commented Nov 17, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #db4e5 Incremental review completed 7efd40c Nov 17, 2026 · 01:01 01:01

@sonarqubecloud

Copy link
Copy Markdown

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

Labels

auto-rebase:ready Opts a non-draft PR into auto-rebase without an approval (auto-rebase ready_label) needs-human-review size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SonarCloud: code security review (pythonsecurity)

2 participants