Skip to content

Compose safe shell stages with approval grants - #1828

Merged
Aaronontheweb merged 1 commit into
devfrom
fix/shell-approval-workload-composition
Aug 9, 2026
Merged

Compose safe shell stages with approval grants#1828
Aaronontheweb merged 1 commit into
devfrom
fix/shell-approval-workload-composition

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • Let an independently safe shell stage compose with stored grants for the stages that still require approval.
  • Show and persist only the candidates that need approval.
  • Bind one-time retries to the exact prompted verb and effective-directory set across live, sub-agent, and recovered redrive paths.
  • Remove sed -n from the Linux safe list because a sed program can still write files or execute commands.

Examples:

  • cat input.json | jq .name now prompts only for jq. A matching jq grant allows the command.
  • grep pattern input.txt | tee output.txt now prompts only for tee. A matching tee grant allows the command.
  • External paths, dynamic syntax, malformed syntax, and hard-deny commands remain strict.

Security review

An adversarial review found two one-time retry gaps during development:

  1. A directory could change to an external symlink after the prompt.
  2. A clean glob could become unresolvable after the prompt.

The final implementation closes both gaps. A retry must match the original patterns and the exact filtered (verb, effective directory) set. The reviewer reran both probes and returned PASS with no blocking findings.

Verification

  • dotnet build Netclaw.slnx -c Release --no-restore: 0 warnings, 0 errors
  • Netclaw.Actors.Tests: 2,912 passed
  • Netclaw.Configuration.Tests: 507 passed
  • Netclaw.Security.Tests: 685 passed
  • dotnet slopwatch analyze: 0 findings
  • pwsh ./scripts/Add-FileHeaders.ps1 -Verify: passed
  • git diff --check: passed
  • Synthetic workload PII scan: no findings

The repository does not currently provide the XPlat coverage collector, so the CRAP report could not be generated. No dependency was added to this security fix for that report.

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) August 9, 2026 01:56

public void ReplaceProjectDirectoryWithExternalSymlink(string relativeDirectory)
{
var path = Path.Combine(_projectDirectory, relativeDirectory);
}

public void CreateProjectDirectory(string relativeDirectory)
=> Directory.CreateDirectory(Path.Combine(_projectDirectory, relativeDirectory));

public void CreateProjectFileSymlinkToExternalFile(string relativePath)
{
var externalFile = Path.Combine(_externalDirectory, "secret.txt");
{
var externalFile = Path.Combine(_externalDirectory, "secret.txt");
File.WriteAllText(externalFile, "synthetic test data");
File.CreateSymbolicLink(Path.Combine(_projectDirectory, relativePath), externalFile);
@Aaronontheweb Aaronontheweb added shell Issues related to the shell tool, since it has the largest security perimeter. security Security-related changes UX/DX UI / UX / DX friction issue or user-facing annoyances. labels Aug 9, 2026
@Aaronontheweb
Aaronontheweb merged commit b5a2f58 into dev Aug 9, 2026
21 checks passed
@Aaronontheweb
Aaronontheweb deleted the fix/shell-approval-workload-composition branch August 9, 2026 02:24
@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

security Security-related changes shell Issues related to the shell tool, since it has the largest security perimeter. UX/DX UI / UX / DX friction issue or user-facing annoyances.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant