test(agent): cover policy management end to end - #1981
test(agent): cover policy management end to end#1981Benoît Cortier (CBenoit) wants to merge 6 commits into
Conversation
Exercise policy management through a protected standard-user client and a LocalSystem client without weakening executable or path checks. Cover validation and write denial, managed Create, Update, Repair, stale conflicts, confirmed overwrite, restart persistence, durable managed authority, and observable audit outcomes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Run the protected policy tester under a restricted standard-user token before the existing LocalSystem lifecycle. Keep feature-gated route authorization tests in the same Windows job so the development signature feature cannot hide them from the default workspace suite. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Implementation notes:
Note Human-tuned, LLM-assisted content. |
There was a problem hiding this comment.
🟡 Changes recommended
The standard-user scenario runs both client and Agent under the same restricted identity, leaving the production cross-identity authorization boundary untested.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds end-to-end Agent policy-management coverage across restricted and LocalSystem execution modes.
Changes:
- Expands lifecycle, authorization, persistence, and audit tests.
- Adds protected unelevated test orchestration.
- Runs identity and feature-gated route tests in Windows CI.
Documentation-specific review was not applicable.
File summaries
| File | Description |
|---|---|
crates/agent-policy-tester/src/windows.rs |
Adds identity modes and policy lifecycle scenarios. |
crates/agent-policy-tester/run-unelevated.ps1 |
Runs the tester with a restricted token. |
crates/agent-policy-tester/run-as-system.ps1 |
Selects elevated test mode. |
crates/agent-policy-tester/Cargo.toml |
Adds Windows identity dependencies. |
Cargo.lock |
Records dependency updates. |
.github/workflows/ci.yml |
Runs both identities and route tests. |
Review details
- Files reviewed: 5/6 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep the Agent and test server under LocalSystem while a distinct restricted process exercises the named-pipe management endpoints. Coordinate readiness and shutdown through a protected, read-only test directory so authorization regressions cannot pass by inspecting the server token. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Treat PsExec's detached-process PID as diagnostic output and use bounded, validated readiness as the authoritative launch result. Publish readiness atomically, preserve launch diagnostics, and keep shutdown and cleanup idempotent so orchestration errors remain actionable. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The psexec -l client runs at Low integrity and may be denied by the named pipe before testing the intended authorization response.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 5/6 changed files
- Comments generated: 1
- Review effort level: Balanced
Launch policy authorization requests from a unique temporary standard-user account instead of a Low-integrity PsExec token. Require the exact account SID and Medium mandatory integrity level, keep credentials out of arguments and logs, and remove the account and profile after the bounded run. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Failed readiness validation can leave LocalSystem test processes running into later CI steps.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 5/6 changed files
- Comments generated: 1
- Review effort level: Balanced
Own LocalSystem test-server shutdown as soon as detached launch is attempted, even when readiness validation fails. Signal the unique protected stop marker with a direct fallback, preserve the original scenario error, and bound status collection before cleanup. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Exercises Agent policy management through protected standard-user and LocalSystem clients without weakening executable, ACL, path, or process-identity checks.
Covers read and validation behavior, standard-user write denial, Create, Update, Repair, stale conflict rejection, exact ConfirmOverwrite, restart persistence, durable managed authority, and observable audit outcomes. The Windows CI job runs both identities and the feature-gated route authorization tests.
Local PsExec execution could not install PSEXESVC, so the identity scenarios are delegated to CI; local builds, workspace tests, Clippy, formatting, runner parsing, and range validation pass.
Extracted from the production-shaped E2E support in #1963.