Repository navigation
fix: Git output decoding, PowerShell hook conditions and shared verifier redaction (#260 follow-ups) - #312
Merged
Conversation
resolve_git_root and resolve_git_remote_url decoded git's UTF-8 output with the locale code page, so on a cp1252 Windows host a repository under a non-ASCII folder resolved to a garbled path or raised an uncaught UnicodeDecodeError. All git calls now decode as UTF-8, keeping path bytes losslessly with surrogateescape and replacing bad bytes in URLs and refs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
A hook 'if' condition such as PowerShell(iex *) was rewritten to a Bash rule, so its launcher looked narrow and an auto-approve hook went unreported; the condition now keeps its own tool. Skill, command, and subagent findings for a flagged PowerShell grant now suggest a scoped PowerShell rule, and a subagent's PowerShell grant is no longer hidden by disallowedTools: Bash. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
A skill or command that only Codex loads had its shell grant reworded as unrestricted 'Bash' with "it has no Bash tool", even for a PowerShell(iex *) grant. The finding now keeps the grant and tool the component analysis named. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
The verifier template kept its own copy of the LOG_* patterns and redact_secrets_in_log_line although _copy_verifier stages secret_redaction.py beside it and checks.py already imports that function. The template now aliases the shared function, and the drift-guard tests become one identity test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
The Python 3.9 verifier smoke now asserts that the staged verifier uses the shared secret_redaction function. The JWT redaction test no longer runs every case twice against the same function, and the CHANGELOG notes the Windows Git output decoding fix. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
requested review from
chrisknvidia,
mosheabr and
rmalani-nv
as code owners
November 2, 2026 09:03
This was referenced Nov 2, 2026
rng1995
added a commit
that referenced
this pull request
Nov 2, 2026
…gs (#312 review) (#320) * fix(utils): decode every Git repository root as a file name Git prints the repository root as raw file-name bytes, so resolve_git_root, find_git_repo_root and git_root_for now decode it with os.fsdecode instead of UTF-8 or the locale code page. This keeps non-ASCII roots correct on Windows and on Linux hosts with a non-UTF-8 locale; remote URLs and branch names stay UTF-8. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(plugin): keep the Bash reading of PowerShell hook conditions A PowerShell if condition is now broad when either its PowerShell or its Bash reading is, so prefixes every shell runs, such as PowerShell(sudo *) and PowerShell(env *), keep their HIGH auto-approve finding. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Signed-off-by: Narendran Raghavan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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
This PR fixes three of the items listed under "Not in this PR" in #260. A fourth item from that list, the "unused" pruned-folder walk in
plugin_paths.py, is dropped:plugin_inventory.pyhas called_pruned_folder_findingssince #257, so the walk is in use. The credential redaction item was done separately in #301.utils/helpers.py)resolve_git_rootandresolve_git_remote_urlran git withtext=Trueand no encoding. On a Windows host with the cp1252 code page, a repository in a non-ASCII folder resolved to a path that does not exist (cafébecamecafé), or the call raised an uncaughtUnicodeDecodeError. Both helpers feed the SARIF repository root and the plugin dependency lookups._git_outputhelper that decodes as UTF-8. The repository root useserrors="surrogateescape", so path bytes that are not valid UTF-8 still name the real directory. Remote URLs and branch names useerrors="replace", because they are written to UTF-8 reports. Neither setting can raise.plugin_component_risk.py)_condition_scoperewrote every shell-tool hookifcondition as a Bash rule before classifying it.PowerShell(iex *),PowerShell(pwsh *),cmd.exeandstart-processwere then read as narrow Bash rules, so an auto-approve PreToolUse hook scoped to them got no finding.Shelland Codexexec_command, are still read as Bash. These hooks are now reported HIGH.plugin_component_risk.py,plugin_inventory.py)Bash(git status *)or "deny Bash". A subagent's PowerShell grant was hidden bydisallowedTools: Bash. Inert grants in skills or commands that only Codex loads always said "unrestricted 'Bash'".denies_every_bash_commandtakes an optionaltool(default"Bash"), and the subagent check applies the deny per grant.disallowedTools: Bashno longer hides a PowerShell grant (now LOW, advisory). Inert-grant messages quote the actual grant and tool. Bash-only cases are unchanged.tier3/harbor/templates/eval.py)LOG_*patterns andredact_secrets_in_log_line, plus an unused_GLUED_KEY_BODYalias, although_copy_verifieralready stagessecret_redaction.pynext to it._shared_checks.redact_secrets_in_log_line) and drops the copy (41 lines). The pattern drift-guard tests become one identity test. The Python 3.9 smoke now asserts that the staged verifier uses the stagedsecret_redactionfunction.The plugin analysis changes are in private code that the public CLI does not call yet, so they have no CHANGELOG entry. The Git decoding fix has one under Fixed.
Testing
LC_ALL=en_US.ISO8859-1, repository undercafé-skills: main returns a path that does not exist; this branch returns the real root.scripts/ci/smoke_harbor_verifier.py --python3.9.6ruff checkandruff format --checkon changed filesThe new tests force cp1252 decoding by wrapping
subprocess.check_output, so they run on every OS. The raw0xffpath-byte case is POSIX-only and is skipped on Windows.🤖 Generated with Claude Code