feat(vscode): add governance visualization system#562
feat(vscode): add governance visualization system#562MythologIQ wants to merge 6 commits intomicrosoft:mainfrom
Conversation
Add GovernanceServer with REST API and browser experience, mock backends for policy/SLO/topology data, export system with HTML report generation, observability metrics exporter, and service layer for provider factory and live client integration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace 8-view sidebar with unified 3-slot React panel system. Add GovernanceStore with event bus, priority engine, scanning mode, and attention toggle. Add SLO Dashboard, Topology Graph, and Governance Hub detail panels with D3.js force graph and Chart.js sparklines. Bundle CDN dependencies locally in assets/vendor/. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add diagnostic provider with governance-specific rules, code actions for quick fixes, integration rule definitions, and completion provider. Add governance-aware status bar with real-time indicators. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move VS Code extension from packages/agent-os/extensions/vscode/ to packages/agent-os-vscode/ as a standalone sibling package (aligns with upstream PR microsoft#546). Integrate upstream security fixes: CSP nonces on all legacy panels, prototype pollution protection in WorkflowDesigner, ReDoS-safe regex in PolicyEngine, token-in-SecretStorage for SSO. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add HELP.md user guide, SECURITY.md policy, update CHANGELOG.md and README.md. Add 37 test files covering mock backends, language providers, webview components, governance store, and sidebar subsystems. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace DOM-based esc() with string-based replacement that escapes all five HTML-significant characters (& < > " '), consistent with ReportGenerator.ts and escapeHtml utility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🤖 AI Agent: breaking-change-detector — Summary🔍 API Compatibility ReportSummaryThis pull request primarily adds new features to the Findings
Migration GuideNo migration steps are necessary as no breaking changes were identified. Notes
If you have further questions or need additional analysis, feel free to ask! |
🤖 AI Agent: docs-sync-checker — Issues Found📝 Documentation Sync ReportIssues Found
Suggestions
Additional Notes
Please address the issues and suggestions above to ensure the documentation is fully in sync with the changes introduced in this PR. Let me know if you need further assistance! |
There was a problem hiding this comment.
🤖 AI Agent: code-reviewer
Review Feedback for PR: feat(vscode): add governance visualization system
🔴 CRITICAL: Security Issues
-
Session Token in WebSocket URL Query String
- While the WebSocket server binds to
127.0.0.1, storing session tokens in the URL query string is inherently insecure. Query strings can be logged by proxies, debugging tools, or browser history. Even though the server is loopback-only, this practice violates security best practices. - Actionable Fix: Use WebSocket subprotocols or custom headers for session token authentication instead of query strings.
- While the WebSocket server binds to
-
Rate Limiter Map Without TTL Eviction
- The rate limiter uses a
Mapwithout TTL eviction. While the server is loopback-only, this design could lead to memory exhaustion if the server is exposed to external traffic due to misconfiguration. - Actionable Fix: Implement TTL-based eviction for the rate limiter map to prevent unbounded memory growth.
- The rate limiter uses a
-
CSP Style-src Unsafe-inline
- The CSP allows
'unsafe-inline'forstyle-srcto support VS Code theme CSS injection. While scripts remain nonce-gated, this weakens the CSP and could allow style-based XSS attacks if combined with other vulnerabilities. - Actionable Fix: Investigate alternatives to
'unsafe-inline', such as using hashed styles or precomputed CSS variables.
- The CSP allows
-
Python Path Validation
- The subprocess lifecycle validates Python paths to reject shell metacharacters. However, this validation is insufficient to prevent command injection in edge cases (e.g., paths containing special characters that bypass regex checks).
- Actionable Fix: Use
shlex.quote()or equivalent to sanitize paths before subprocess invocation.
🟡 WARNING: Potential Breaking Changes
-
Legacy Commands Removed
- Commands like
showSLODashboardandshowAgentTopologyhave been replaced by new webview-based commands (showSLOWebview,showTopologyGraph). This could break workflows for users relying on the old commands. - Actionable Fix: Provide backward compatibility by aliasing old commands to the new ones or documenting migration steps clearly.
- Commands like
-
Governance Server Auto-Install
- The extension prompts users to install
agent-failsafe[server]from PyPI if not found. This introduces a dependency on Python and pip, which may not be available in all environments. - Actionable Fix: Add a fallback mechanism or provide clear error messages for environments without Python/pip.
- The extension prompts users to install
💡 Suggestions for Improvement
-
Type Safety in GovernanceStore
- The GovernanceStore uses event-driven refresh mechanisms but lacks explicit type annotations for its data models. This could lead to runtime errors in edge cases.
- Suggestion: Use TypeScript interfaces or classes to enforce type safety for GovernanceStore data models.
-
OpenTelemetry Metrics Exporter
- The metrics exporter supports OpenTelemetry-compatible endpoints but does not validate endpoint configurations. Misconfigured endpoints could lead to silent failures.
- Suggestion: Add validation for observability endpoint configurations and log warnings for invalid setups.
-
Sandbox Escape Vectors
- The Governance Server subprocess lifecycle spawns Python processes. While paths are validated, additional sandboxing (e.g., using
subprocess.Popenwith restricted permissions) could further reduce escape risks. - Suggestion: Investigate using containerized subprocess execution (e.g., Docker) for enhanced isolation.
- The Governance Server subprocess lifecycle spawns Python processes. While paths are validated, additional sandboxing (e.g., using
-
Backward Compatibility for Tree Views
- The new 3-slot React sidebar replaces 8 tree views. While this improves usability, users accustomed to the old layout may face a learning curve.
- Suggestion: Provide a "legacy mode" toggle to temporarily restore the old tree view layout.
-
Governance Hub Accessibility
- The Governance Hub uses scanning mode with auto-rotation and hover/focus pause. While this respects
prefers-reduced-motion, additional accessibility features (e.g., keyboard navigation) could improve usability. - Suggestion: Add keyboard shortcuts for navigating between tabs and panels.
- The Governance Hub uses scanning mode with auto-rotation and hover/focus pause. While this respects
Summary of Changes
- Security: Address critical issues like session token handling, CSP weaknesses, and subprocess validation.
- Breaking Changes: Mitigate impact by aliasing old commands and documenting migration paths.
- Improvements: Enhance type safety, sandboxing, and accessibility.
This PR introduces significant functionality and security improvements but requires fixes to address critical vulnerabilities and backward compatibility concerns.
🤖 AI Agent: contributor-guide — Welcome to the project! 🎉Welcome to the project! 🎉Hi @first-time-contributor! Thank you so much for taking the time to contribute to the microsoft/agent-governance-toolkit repository. We’re thrilled to have you here, and we deeply appreciate the effort you’ve put into this pull request. It’s always exciting to see new contributors join the community! What You Did Well 🌟
Suggestions for Improvement ✨While your PR is excellent, there are a few areas where we can refine it further:
Project Conventions 📚Here’s a quick recap of some key conventions we follow in this project:
For more details, please refer to our CONTRIBUTING.md and QUICKSTART.md guides. Next Steps 🚀
Once you’ve made these updates, let us know, and we’ll take another look. If you have any questions or need help with anything, don’t hesitate to ask. We’re here to support you! Thank you again for your contribution — we’re excited to work with you on this! 😊 |
🤖 AI Agent: security-scanner — Security Review of PR: feat(vscode): add governance visualization systemSecurity Review of PR: feat(vscode): add governance visualization systemThis PR introduces a governance visualization system for the Agent OS VS Code extension, including a REST API, React-based UI components, and various security enhancements. Below is a detailed security analysis based on the provided code and documentation. Findings1. Prompt Injection Defense Bypass
2. Policy Engine Circumvention
3. Trust Chain Weaknesses
4. Credential Exposure
5. Sandbox Escape
6. Deserialization Attacks
7. Race Conditions
8. Supply Chain Risks
Summary of Findings
General Recommendations
This PR introduces significant functionality but also carries critical security risks that must be addressed before merging. |
Addressing Review Feedback from Prior PRHi @imsiddiquee — this is a fresh PR addressing all items from your review of the original submission. Here's a point-by-point response: 1. CDN Dependencies — Bundled Locally ✅D3.js and Chart.js are no longer loaded from jsdelivr CDN. They are bundled as local vendor assets: The browser template loads them from disk via the local governance server ( 2. innerHTML XSS Patterns — Sanitized ✅All
The 4 legacy panels (MetricsDashboard, Onboarding, PolicyEditor, WorkflowDesigner) still use 3. Rebased Against
|
|
Closing — premature submission. Will resubmit after #546 merges per reviewer guidance. Branch and work are ready for quick rebase once the directory move lands. |
Summary
Adds a complete governance visualization system to the VS Code extension at
packages/agent-os-vscode/(aligned with #546):Security
assets/vendor/d3.v7.8.5.min.js,assets/vendor/chart.v4.4.1.umd.min.js)innerHTMLassignments useescapeHtml()utility or inlineesc()with full character coverageAddresses reviewer feedback
Per review comments on the prior PR:
packages/agent-os-vscode/location (aligned with refactor: extract VS Code extension to packages/agent-os-vscode/ (#491) #546)Test plan
npm run compile— TypeScript + React/Tailwind pipeline cleannpm run lint— ESLint clean (warnings only, matching upstream baseline)npm test— 498 tests passing (37 test suites)Closes #491
🤖 Generated with Claude Code