feat: hexdump/od/strings/xxd defaults, denied_flags, after_first - #12
Merged
Merged
Conversation
Three deny-by-default additions:
- New binary-inspection.toml with hexdump, od, strings, xxd; the
utilities.toml sha*sum family is completed in passing (sha224sum,
sha384sum, sha512sum).
- write_target = "after_first" mode for tools where the first
positional is a read-only input and subsequent positionals are
destinations (xxd in [out]). Existing "last"/"all" can't express
this without false positives on read-only invocations.
- denied_flags TOML option that blocks listed flags outright,
regardless of allowed = ["*"]. Exact match (no short-flag prefix
to avoid -d colliding with -delete); long flags also match
--flag=value; tokens after -- are ignored. Applied to:
find: -exec, -execdir, -ok, -okdir, -delete, -fprint, -fprintf, -fls
curl: -O, --remote-name, --remote-name-all, -J, --remote-header-name
Common helpers factored out along the way:
- MatchFlag, MatchFlagOrShortPrefix, FirstMatchingFlag in args.go
unify the flag-scanning patterns previously duplicated between
matchDeniedFlag and hasWriteFlag. ContainsFlag now reuses MatchFlag.
- validateFlagPrefix / validateWriteTarget helpers in config.go
dedupe the extend-mode and replace-mode validation paths.
- spec.WriteTarget{Last,All,AfterFirst} constants replace raw strings
in switches and validators.
- checkWriteTarget collapses the three cases into a single targets-slice
loop.
- Deny messages in ConfigToolSpec all follow "<tool>: <reason>".
- cmp.Or, slices.Sorted+maps.Keys, slices.Contains where applicable.
Docs: README.md, SAMPLE_CLAUDE.md, internal/config/help.txt and the
LLM skill plugins/agent-callable/skills/configure.md cover the new
knobs. Table-driven tests for the new helpers and the new defaults.
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.
Summary
Three deny-by-default additions:
binary-inspection.toml(hexdump, od, strings, xxd).sha*sumfamily completed inutilities.toml.write_target = "after_first"for tools where the first positional is a read-only input and subsequent ones are destinations (xxd in [out]). Existing"last"/"all"can't express this without false positives on read-only invocations.denied_flagsTOML option that blocks listed flags outright, regardless ofallowed = ["*"]. Exact match (no short-flag prefix to avoid-dmatching-delete); long flags also match--flag=value. Applied to:find:-exec,-execdir,-ok,-okdir,-delete,-fprint,-fprintf,-flscurl:-O,--remote-name,--remote-name-all,-J,--remote-header-nameHelpers factored out along the way:
MatchFlag/MatchFlagOrShortPrefix/FirstMatchingFlagunify the flag-scanning patterns;validateFlagPrefix/validateWriteTargetdedupe the extend/replace validation paths;spec.WriteTarget{Last,All,AfterFirst}constants; standardized Deny message format;cmp.Or,slices.Sorted+maps.Keys,slices.Containswhere applicable.Docs updated:
README.md,SAMPLE_CLAUDE.md,internal/config/help.txt, and the LLM skillplugins/agent-callable/skills/configure.md.Test plan
make testpasses — table-driven tests forMatchFlag,MatchFlagOrShortPrefix,FirstMatchingFlag,after_first,denied_flags, and the new defaultsmake installproduces a working binaryxxd /etc/hostname,xxd /etc/hostname /tmp/out.bin,find . -name '*.go', blocked:find . -exec rm {} \;,curl -O https://...🤖 Generated with Claude Code