KyZN: fix HIGH+MEDIUM+LOW findings (20260326-103634-09e6556b)#1
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- Remove hardcoded macOS Python 3.9 path from git hook scripts - Fix config_threshold type annotation to Optional[float] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Analysis Fixes
Applied fixes for findings at severity LOW and above.
Run ID:
20260326-103634-09e6556bCost: $2.93
Batches: 3 applied (HIGH → MEDIUM → LOW), 0 failed, 0 skipped
Diff: 1164 lines
Changes
What Was Fixed
HIGH: 8/8 passed on CLI tests too. Full suite is clean: 66/66 tests passing across all test files.
MEDIUM: All 66 tests pass. Here's a summary of every fix:
SEC-002 — Path traversal in
_scan_stagedengine.py:291— Resolvefile_pathand checkis_relative_to(root)before scanning; skip any path that escapes the repo root.SEC-003 — GitHub API URL path injection in
patrolcli.py— Addedimport re; after splittingowner/name, validate both components against^[A-Za-z0-9._-]+$and exit 1 if invalid.SEC-004 — TOCTOU race in gitleaks temp file
scanner.py:33-34— ReplacedNamedTemporaryFile(delete=False)withtempfile.mkdtemp()creating a private directory (mode 0o700).finallyblock now callsshutil.rmtree(tmp_dir)instead ofunlink.BUG-003 — macOS
/tmpsymlink crash inclone_and_scanmonitor.py:152— Wrappedmkdtemp()result withPath(...).resolve()sorelative_to()works on both Linux and macOS.BUG-004 —
initsilently overwrites existing configconfig.py:193—create_default_confignow raisesFileExistsErrorif the file exists andforce=False.cli.py:init— Added--forceflag; catchesFileExistsErrorand exits with error message.BUG-005 — DB connection leaks (already fixed in previous run — singleton pattern was in place)
PERF-003 — N+1 DB queries in
notify()db.py— Addedget_notified_fingerprints(repo_url, fingerprints) -> Set[str]using a singleIN (...)query.notifier.py:notify()— Replaced per-findingwas_notified()loop with one call toget_notified_fingerprints.PERF-004 — Entropy computed unconditionally
engine.py:150— Patterns withoutentropy_thresholdnow setent = 0.0(skipping theentropy()call) unless aconfig_thresholdis provided.ARCH-004 — Entropy threshold config dead code
engine.py:scan_text— Added optionalconfig_threshold: float = Noneparameter; used as entropy floor for patterns without their own threshold.engine.py:scan_content— Passesconfig_thresholdthrough toscan_text.ARCH-005 — Duplicated
get_github_token()config.py— Added canonicalget_github_token()function (importsos).monitor.py— Removed local definition; now imports from.config.notifier.py— Removed local definition; now imports from.config.LOW: All 66 tests pass. Here's a summary of the changes:
PERF-005 —
gitshield/scanner.pygitleaks_path: Optional[str] = Noneparameter to_scan_with_gitleaksgitleaks_path or _has_gitleaks()— skips the secondshutil.whichwhen path is already providedscan_path, stored_has_gitleaks()result ingitleaks_binand passed it through to_scan_with_gitleaks(... gitleaks_path=gitleaks_bin)— one PATH search per scan instead of twoDEAD-001 —
gitshield/formatter.pyprint_jsonto callformat_findings_jsoninternally (print(format_findings_json(findings))), eliminating the duplicated list comprehension +json.dumpslogicformat_findings_jsonis now the canonical implementation;print_jsondelegates to itApproach
Findings were batched by severity tier (CRITICAL → HIGH → MEDIUM → LOW).
Each batch was verified and committed independently — if a batch broke tests,
self-repair was attempted. Failed batches were reverted to protect passing code.
Diff budget was tracked incrementally to prevent waste.
Generated by KyZN — autonomous code improvement