Skip to content

fix(scan): exclude patterns work with ./ paths, dead and regex patterns are reported - #25

Merged
ilanh merged 1 commit into
mainfrom
fix/exclude-semantics
Nov 3, 2026
Merged

ilanh merged 1 commit into
mainfrom
fix/exclude-semantics

Conversation

@ilanh

@ilanh ilanh commented Nov 3, 2026

Copy link
Copy Markdown
Owner

What and why

Reworks how exclude behaves so it stops failing silently.

  • Root cause of the "anchor matches nothing" case: with scan . / lint . the walker yields ./packages/cli/a.ts, and the relative path kept the leading ., so ^packages/cli/ never matched. Relative paths are now normalised (this also removes the ./ prefix from source paths in the generated policy comments, a separate small bug seen on Paperclip).
  • Dead patterns are reported: in a whole-repo scan, any [scan].exclude or [lint].exclude pattern that matches no file prints warning: [scan].exclude pattern ... matches no file, with a hint. Regex-looking patterns (^packages/(admin|cli)/) get "exclude patterns are not regexes: ... list one entry per directory". Partial scans stay quiet; stdout and --json are unchanged.
  • One exclude list: files excluded by [scan].exclude are never read, so lint already inherits them (checked, including with a . path). [lint].exclude stays as lint-only extras. This is now stated in the config docs and the README, with the literal (not regex) matching rule and a per-directory example.

Tests: tests/excludes.rs (shared exclude with and without a . path, no ./ prefix, regex pattern warning, dead lint pattern, partial scan quiet). TOOLCHAIN=1.94 scripts/ci-local.sh and stable clippy pass.

Ordering: touches do_scan in main.rs and scan.rs like #21 (comment leaders); whichever merges second needs a trivial rebase.

Closes #9

…thing, document literal excludes

Signed-off-by: Ilan Harel <[email protected]>
@ilanh
ilanh force-pushed the fix/exclude-semantics branch from e8639c1 to eeb4cb1 Compare November 3, 2026 08:14
@ilanh
ilanh merged commit 88073a2 into main Nov 3, 2026
2 checks passed
@ilanh
ilanh deleted the fix/exclude-semantics branch November 3, 2026 08:18
ilanh added a commit that referenced this pull request Nov 3, 2026
…entials (#30)

## What and why

Three of five tested projects needed a hand-written custom provider
profile, and `providers.sh` only said `# UNMAPPED ... write a custom
profile`.

- **`generate --scaffold-profiles DIR`** writes `DIR/<id>.yaml` for
every unmapped credential (id = env var lower-cased with hyphens): the
credential, plus endpoints, `access` and binaries taken from the
`egress` directives in the file that declares the credential. `tls=skip`
endpoints get `allow_uninspected_credentials: true` (OpenShell's profile
lint requires it for L4-only credentialed endpoints); credentials with
no egress in their file get `endpoints: []` and TODO comments. Existing
files are kept, nothing is written without the flag, no secret values
are involved. The `UNMAPPED` comment in `providers.sh` now points to the
flag.
- **Misleading duplicate warning:** `egress X duplicates an endpoint the
profile adds` is now only shown when the profile's `binaries` overlap
the rule's binaries (profile bound to `gh`/`git`, app is `node`: the
explicit rule is needed, no warning). Profiles that list no binaries
keep the old behaviour.
- README section "Credentials with no provider profile"; CLI.md
regenerated.

Checked with the real tool: skeletons generated from
anthropic-proxy-rs's sidecar (`tls=skip` case) and synthetic cases all
pass `openshell provider profile lint -f` (OpenShell 0.1.6 on the dev
server). CI cannot run that, so the tests reload the skeletons with our
own profile loader.

Tests: `tests/scaffold_profiles.rs` (3 tests) and a unit test.
`TOOLCHAIN=1.94 scripts/ci-local.sh` and stable clippy pass.

Ordering: independent (new module `scaffold.rs`; small edits in
`providers.rs`, `generate.rs`, `main.rs`'s `Generate` arm). Another PR
(#26) edits other parts of `main.rs`, and #21/#25 edit `do_scan`; any of
them may need a trivial rebase.

Closes #13

---------

Signed-off-by: Ilan Harel <[email protected]>
Co-authored-by: Ilan Harel <[email protected]>
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.

[scan].exclude and [lint].exclude are separate, are not regexes, and dead patterns are not reported

1 participant