Skip to content

Add typed shell policy coordinator - #1916

Merged
Aaronontheweb merged 4 commits into
devfrom
feature/shell-policy-projection-coordinator
Aug 13, 2026
Merged

Add typed shell policy coordinator#1916
Aaronontheweb merged 4 commits into
devfrom
feature/shell-policy-projection-coordinator

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • route shell authorization through one typed coordinator
  • retain every parsed occurrence under a stable call-local candidate ID
  • query session and persistent grants once, then compose them with reviewed-safe policy and exact one-time coverage
  • reject malformed actor replies and unavailable grant-store states with a terminal policy failure

Why

This slice replaces the split shell approval path with one explicit coverage model. ShellSyntaxTree remains the source of syntax facts; Netclaw remains the owner of trust, scope, and final authority. The new internal seam supports later policy stages without more dispatcher branches or executable-specific command parsers.

No public API changes are part of this pull request.

Validation

  • Release solution build: 0 warnings, 0 errors
  • full runnable suite: 7,146 passed; 15 expected skips
  • actor suite: 3,157 passed; 1 expected Windows-only skip
  • security suite: 906 passed
  • strict OpenSpec: 82 passed
  • file headers and format checks pass
  • adversarial review: PASS
  • Slopwatch: one prior unrelated SW004 in PowerShellHostProbeTests.cs

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) August 13, 2026 05:48
Comment on lines +34 to +37
catch (Exception)
{
return ToolAuthorizationDecision.Deny("internal_policy_failure");
}
Comment on lines +129 to +142
foreach (var candidate in grantCandidates.Where(candidate =>
coverage.UncoveredIds.Contains(candidate.Id)))
{
if (policy.IsReviewedSafeCandidate(
candidate.Candidate,
projection.ApprovalContext.Cwd,
context.Invocation))
{
coverage.Cover(
candidate.Id,
ShellCoverageKind.ReviewedSafePolicy,
ShellPolicyReason.ReviewedSafePhrase);
}
}
Comment on lines +176 to +187
foreach (var candidate in candidates)
{
if (!_coverage.TryAdd(
candidate.Id,
new ShellCandidateCoverage(
candidate.Id,
ShellCoverageKind.Uncovered,
ShellPolicyReason.None)))
{
throw new InvalidOperationException("Duplicate shell candidate id.");
}
}
Comment on lines +256 to +266
foreach (var entry in persistedApprovals)
{
if (!ApprovalPatternMatching.MatchesShellApproval(candidate, cwd, [entry]))
continue;

return new ShellActorGrantMatch(
new ToolApprovalMatch(candidate.Verb, "persistent", entry.FormatScope()),
entry.Directory is null
? ShellCoverageKind.PersistentGlobal
: ShellCoverageKind.PersistentFolder);
}
[Fact(SkipUnless = nameof(IsPosix), Skip = "POSIX-only shell coverage semantics")]
public async Task Authorization_evaluation_composes_session_and_reviewed_safe_coverage()
{
var root = Path.Combine(Path.GetTempPath(), $"netclaw-coverage-{Guid.NewGuid():N}");
@Aaronontheweb
Aaronontheweb merged commit a9768ac into dev Aug 13, 2026
39 checks passed
@Aaronontheweb
Aaronontheweb deleted the feature/shell-policy-projection-coordinator branch August 13, 2026 06:22
@Aaronontheweb Aaronontheweb added the shell Issues related to the shell tool, since it has the largest security perimeter. label Aug 13, 2026
@Aaronontheweb Aaronontheweb mentioned this pull request Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shell Issues related to the shell tool, since it has the largest security perimeter.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant