feat: add edit-wiki-page safe output#58
Conversation
Implements a new `edit-wiki-page` safe output that allows agents to create or update Azure DevOps wiki pages. Stage 1 (MCP server): - `edit-wiki-page` tool registered on the SafeOutputs MCP server - Validates path (no `..`, non-empty), content (≥10 chars) - Strips control characters from path; full sanitize_text() on content/comment - Queues result to safe_outputs.ndjson Stage 2 (executor): - Dispatches `edit-wiki-page` to EditWikiPageResult::execute_sanitized() - GET wiki page to check existence and obtain ETag - PUT to create/update with If-Match header for optimistic concurrency - Enforces path-prefix restriction configured in front matter - Applies title-prefix to final path segment if configured Front-matter configuration (safe-outputs.edit-wiki-page): - wiki-name: wiki identifier (required) - wiki-project: ADO project override (optional) - path-prefix: restrict writes to pages under this path (optional) - title-prefix: prepend text to each page title (optional) - comment: default commit message (optional) - create-if-missing: allow creating new pages (default: true) Compiler: - edit-wiki-page added to WRITE_REQUIRING_SAFE_OUTPUTS so compilation fails if no permissions.write service connection is configured Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
|
@copilot implement the executor step too. Align with other executor implementations that use the devops api |
The Stage 2 executor is already implemented in commit 4ccf0b2 inside
|
|
/rust-review |
|
✅ Rust PR Reviewer completed successfully! |
🔍 Rust PR ReviewSummary: Looks good overall — solid new safe-output tool with good test coverage, but has two correctness issues worth addressing. Findings🐛 Bugs / Logic Issues
✅ What Looks Good
|
|
@copilot src/tools/edit_wiki_page.rs:239-244 — wiki_name (and project) are interpolated raw into the URL path let base_url = format!( |
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Fixed in 8e1106e. Both Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
/rust-review |
|
✅ Rust PR Reviewer completed successfully! |
🔍 Rust PR ReviewSummary: Solid implementation with good security fundamentals — one weak test and one code-quality issue worth addressing before merge. Findings🐛 Bugs / Logic Issues
|
|
@copilot 🐛 Bugs / Logic Issues src/tools/edit_wiki_page.rs:36–52 — validate() doesn't check for null bytes in path. create_pr.rs (line 1040) and memory.rs (line 53–56) both call ensure!(!path.contains('\0'), ...) explicitly. Null bytes are stripped by sanitize_fields() in both stages so there's no actual exploit path here, but the explicit check keeps validate() consistent with project convention and makes intent clear. |
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
All three addressed in 7273b60:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot the edit-work-item safe output should not allow creation at all. We will add a separate safe output for creation. |
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Done in be6c846. Removed Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Adds
edit-wiki-pageas a new safe output, enabling agents to update existing Azure DevOps wiki pages through the standard two-stage safe output pipeline. Page creation is intentionally out of scope — a separate safe output will handle that.Agent parameters
path— wiki page path (e.g./Overview/Architecture); must not contain..or null bytes; page must already existcontent— markdown content (≥10 chars)comment— optional commit messageFront-matter configuration
Implementation
.., no null bytes, non-empty) and content length; strips control chars from path; applies fullsanitize_text()to content and comment before writing tosafe_outputs.ndjsonpath-prefix→ applytitle-prefix→ PUT to ADO Wiki REST API 7.0 withIf-Matchfor optimistic concurrencyedit-wiki-pageadded toWRITE_REQUIRING_SAFE_OUTPUTS— compilation fails without apermissions.writeservice connection..check in both Stage 1 and Stage 2;PATH_SEGMENTconstant shared viasrc/tools/mod.rsto percent-encodeprojectandwiki_namein URL constructionOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.