[dotnet-port-api] Align shell policy allow and deny semantics - #1047
[dotnet-port-api] Align shell policy allow and deny semantics#1047Michelle Clayton (michelle-clayton-work) wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new PolicyConfig.Custom callback currently receives the untrimmed command while deny/allow checks use a trimmed command, creating an inconsistent API surface that should be made consistent.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Aligns the Go tool/shelltool policy evaluation semantics with upstream .NET ShellPolicy (deny-first precedence, exclusive allow-list behavior including nil-vs-empty distinction), and adds CI guardrails to prevent drift in generated agentic workflow lock files.
Changes:
- Update shell policy evaluation to be deny-first, make a non-nil allow-list exclusive (empty allow-list denies all), and add a post-list
Customoverride callback. - Expand shell policy tests to cover deny/allow precedence, nil-vs-empty allow-list behavior, and custom-callback ordering.
- Add a GitHub Actions gate to verify agentic workflow lock files are regenerated with a pinned
gh-awversion; adjust Dependabot to avoid bumping lock-embedded action pins.
File summaries
| File | Description |
|---|---|
| tool/shelltool/shelltool.go | Changes policy evaluation semantics (deny-first, exclusive allow-list) and adds PolicyConfig.Custom / Policy.custom callback. |
| tool/shelltool/shelltool_test.go | Updates and adds tests covering the new allow/deny semantics and custom-callback ordering. |
| .github/workflows/verify-aw-locks.yml | New workflow to re-run gh aw compile with a pinned version and fail if committed lock files drift. |
| .github/workflows/go-api-consistency-review.lock.yml | Regenerated lock file (pins updated to match the pinned gh-aw compiler output). |
| .github/workflows/dotnet-port-fixes-nightly.lock.yml | Regenerated lock file (pins updated to match the pinned gh-aw compiler output). |
| .github/workflows/dotnet-port-api-nightly.lock.yml | Regenerated lock file (pins updated to match the pinned gh-aw compiler output). |
| .github/workflows/dotnet-code-portability-nightly.lock.yml | Regenerated lock file (pins updated to match the pinned gh-aw compiler output). |
| .github/dependabot.yml | Prevent Dependabot from bumping action pins that are embedded by gh aw compile into generated lock files. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Copilot resolve merge conflicts and address PR feedback |
…policy-deny-first-e4eefad3518aecdc # Conflicts: # .github/dependabot.yml # .github/workflows/dotnet-code-portability-nightly.lock.yml # .github/workflows/dotnet-port-api-nightly.lock.yml # .github/workflows/dotnet-port-fixes-nightly.lock.yml # .github/workflows/go-api-consistency-review.lock.yml Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
…back Co-authored-by: michelle-clayton-work <262183035+michelle-clayton-work@users.noreply.github.com>
Done in e4f26dc: merged |
This comment has been minimized.
This comment has been minimized.
|
Scope: public API, user-visible behavior Changed Go contract: Upstream evidence reviewed: Result: aligned. The Go changes are a faithful, semantically equivalent port:
This is a breaking change in Go, consistent with the upstream .NET PR also being marked No parity issues found. Adding
|
Summary
Align
tool/shelltoolwith the upstream .NETShellPolicybehavior from microsoft/agent-framework#6906.This change makes Go shell policy evaluation deny-first, treats a supplied allow-list as exclusive, distinguishes
nilfrom an empty allow-list, and adds a finalPolicyConfig.Customoverride callback that only runs after deny/allow-list checks pass. The shell policy tests were updated to cover the new behavior.Upstream source commit:
ccba1fbbef9aff7d6e5435fb74f0cc7789ca5243(link).Ported .NET PRs
ShellPolicyallow/deny semantics with the other SDKs and make the allow-list exclusiveBreaking Changes
Yes.
Previously, a Go
AllowListmatch short-circuited the deny-list and a supplied empty allow-list behaved like no allow-list. After this change, deny-list matches win first, a non-nilallow-list is exclusive, and an empty allow-list denies every command. This is an intentional beta-stage parity realignment with the upstream .NET shell policy behavior.Tests and Examples
go test ./tool/shelltoolgo test ./...PolicyConfig.Customcallback orderingNotes
tool/shelltoolpolicy semantics from .NET: [BREAKING] Align ShellPolicy allow/deny semantics with Python agent-framework#6906 rather than bundling broader shell-tool follow-ups from other upstream commits.Closes #443