Skip to content

fix(gating): harden directory scans and fail closed without SLM - #118

Merged
hyperpolymath merged 2 commits into
mainfrom
agent/harden-scan-and-fail-closed
Sep 21, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
agent/harden-scan-and-fail-closed

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Foundational follow-up hardening after the dependency issue was resolved. This makes the CLI and oracle behavior match their documented safety contract.

Changes

Directory scanning

  • Make --include-hidden, --depth, --include, and --exclude functional instead of silently ignored.
  • Validate glob patterns and return an actionable error for invalid patterns.
  • Make directory scans use the same content evaluator as single-file checks. This catches content-only violations such as hard-coded secrets in innocuous file extensions.
  • Preserve extension checks for empty and binary files.
  • Keep generated directories out of recursive scans and sort traversal for deterministic results.

SLM safety

  • Replace the placeholder SLM result that always reported compliance with an explicit ModelNotLoaded/InferenceError.
  • A missing or unavailable neural evaluator can no longer be mistaken for an affirmative policy decision.

Tests

  • Add directory content scanning coverage.
  • Add hidden/depth/include option coverage.
  • Add invalid glob coverage.
  • Add fail-closed SLM coverage.

Verification

  • cargo fmt --all -- --check
  • RUSTFLAGS=-Dwarnings cargo check --workspace --locked
  • RUSTFLAGS=-Dwarnings cargo clippy --workspace --locked -- -D warnings
  • cargo test --workspace --locked
  • cargo build --release --workspace --locked
  • cargo audit --deny warnings
  • cargo audit --deny unmaintained

All local checks pass.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ec646668-0c2b-4898-82bb-edae505f0f7c

📥 Commits

Reviewing files that changed from the base of the PR and between 8805d55 and 59eb71c.

📒 Files selected for processing (3)
  • src/main.rs
  • src/oracle/src/lib.rs
  • src/slm/src/lib.rs

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

Comment @coderabbitai help to get the list of available commands.

@gitguardian

gitguardian Bot commented Sep 21, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
37502491 Triggered Generic Password d33ab22 src/oracle/src/lib.rs View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@hyperpolymath
hyperpolymath merged commit 08d42c8 into main Sep 21, 2026
27 of 34 checks passed
@hyperpolymath
hyperpolymath deleted the agent/harden-scan-and-fail-closed branch September 21, 2026 19:59
hyperpolymath added a commit that referenced this pull request Sep 21, 2026
Removes a test-only password-shaped literal introduced by PR #118. The
runtime-assembled fixture preserves coverage while preventing
GitGuardian from reporting a false positive.

This branch is based directly on the merged main commit so the security
scanner does not re-process the historical commit that introduced the
fixture.

Local verification: `cargo test -p policy-oracle --lib --locked`.

Co-authored-by: Arena Agent <agent@arena.ai>
Comment thread src/oracle/src/lib.rs
let root = std::env::temp_dir().join(format!("conative-scan-{}", Uuid::new_v4()));
fs::create_dir_all(&root).unwrap();
let file = root.join("notes.txt");
fs::write(&file, r#"password = "not-a-real-secret-123""#).unwrap();
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.

2 participants