Skip to content

Exclude sensitive files from context packs, enforce provider network policy, add CI cleanliness check, and harden tests#1

Merged
ProfRandom92 merged 2 commits into
mainfrom
codex/audit-ci-stability-and-mvp-readiness
Jun 5, 2026
Merged

Exclude sensitive files from context packs, enforce provider network policy, add CI cleanliness check, and harden tests#1
ProfRandom92 merged 2 commits into
mainfrom
codex/audit-ci-stability-and-mvp-readiness

Conversation

@ProfRandom92

Copy link
Copy Markdown
Owner

Motivation

  • Prevent accidental leakage of secrets and private keys when building a context pack and ensure providers do not perform live network calls unless explicitly allowed by policy.
  • Ensure CI fails if tests or code leave the working tree modified after running, and make smoke tests more robust when mutating repository files.

Description

  • Add is_sensitive_context_path to detect filenames like .env, key/cert files, and common credential names and skip them when building a context pack.
  • Add ensure_provider_network_allowed and call it for ollama in both handle_ask and handle_propose flows to enforce config.policy.allow_provider_network and per-provider network flags before executing networked providers.
  • Extend build_context_pack to exclude sensitive filename patterns and add related patterns to excluded_files so generated packs omit secrets and private keys.
  • Add a CI step Clean tree in .github/workflows/ci.yml that runs git diff --exit-code && git diff --cached --exit-code to detect dirty working trees after tests.
  • Harden tests/cli_smoke.rs by introducing FileGuard to preserve/restore filesystem artifacts, renaming and adjusting tests to assert network-denied behavior for Ollama, and update proposal/apply tests to use guarded temporary files and updated assertions.
  • Minor README formatting cleanup for quickstart/commands listing.

Testing

  • Ran the repository CI steps locally: cargo fmt --all --check, cargo check, and cargo test, and the test suite completed successfully.
  • Exercised tests/cli_smoke.rs which includes the updated ask, propose, apply, and validate scenarios and they passed under the updated assertions.
  • The CI workflow now includes the Clean tree check which will fail if tests leave unstaged or staged modifications in the working tree.

Codex Task

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces security enhancements to prevent sensitive files (such as .env, keys, and certificates) from being included in context packs, and enforces network access policies for providers like Ollama. It also refactors the smoke tests to use a FileGuard helper for robust, automatic file cleanup. Feedback on the changes highlights that checking if a filename contains the substring "key" is overly broad and will lead to false positives on harmless files (e.g., keyboard.rs), suggesting a more refined matching logic instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/cli.rs Outdated
Comment on lines +644 to +645
|| file_name.contains("key")
|| file_name.contains("credential")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using file_name.contains("key") is extremely broad and will cause false positives by matching common non-sensitive filenames containing the substring "key" (e.g., keyboard.rs, key_value.rs, monkey.rs, donkey.rs, keyring.rs, keychain.rs). This would silently exclude these files from the context pack, leading to incomplete context for the LLM.

By refining the check to target specific patterns like api_key, apikey, secret, token, and exact matches for key or keys, we significantly reduce false positives while still catching actual sensitive files.

        || file_name.contains("api_key")
        || file_name.contains("apikey")
        || file_name.contains("secret")
        || file_name.contains("token")
        || file_name.contains("credential")
        || matches!(file_name, "key" | "keys")

@ProfRandom92 ProfRandom92 merged commit b0802be into main Jun 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant