Skip to content

docs: sync audit redaction status and framing with current code#1014

Merged
imran-siddique merged 5 commits intomicrosoft:mainfrom
imran-siddique:docs/sync-code-redaction-and-framing
Apr 15, 2026
Merged

docs: sync audit redaction status and framing with current code#1014
imran-siddique merged 5 commits intomicrosoft:mainfrom
imran-siddique:docs/sync-code-redaction-and-framing

Conversation

@imran-siddique
Copy link
Copy Markdown
Member

Summary

Syncs documentation with current code to address doc/code inconsistencies identified in external review.

Changes (6 files)

SOC2 mapping (docs/compliance/soc2-mapping.md):

  • Updated 5 locations that incorrectly said audit logs store unredacted parameters
  • Current code uses CredentialRedactor.redact_data_structure(params) before audit persistence
  • Remaining gap accurately scoped to non-credential PII (email, phone, addresses)
  • Removed stale logger.info() claim and brittle line-number references

Framing consistency (4 files):

  • README.md, OWASP-COMPLIANCE.md, modern-agent-architecture-overview.md: kernel-level -> policy-layer/application-layer
  • Product/API names (StatelessKernel, agent-os-kernel) intentionally preserved

OWASP precision (2 files):

  • COMPARISON.md: added footnote clarifying 10/10 means mitigation components exist per risk category
  • owasp-llm-top10-mapping.md: updated LLM06 row for credential redaction

Motivation

External review identified SOC2 docs still claimed audit logs store unredacted parameters, while current mcp_gateway.py applies CredentialRedactor before creating AuditEntry records. This PR brings docs in line with code.

imran-siddique and others added 5 commits April 11, 2026 20:47
- Add KillSwitch with arm/disarm, event history, and subscriber notifications
- Add LifecycleManager with 8-state machine and validated transitions
- Add 26 xUnit tests
- Update README

Co-authored-by: Copilot <[email protected]>
)

* feat(dotnet): add kill switch and lifecycle management to .NET SDK

- Add KillSwitch with arm/disarm, event history, and subscriber notifications
- Add LifecycleManager with 8-state machine and validated transitions
- Add comprehensive xUnit tests for both components (26 tests)
- Update .NET SDK README with usage documentation

Co-authored-by: Copilot <[email protected]>

* feat(rust): add execution rings and lifecycle management to Rust SDK

Add two new modules to the agentmesh Rust crate:

- rings.rs: Four-level execution privilege ring model (Admin/Standard/
  Restricted/Sandboxed) with per-agent assignment and per-ring action
  permissions, ported from the Python hypervisor enforcer.

- lifecycle.rs: Eight-state agent lifecycle manager (Provisioning through
  Decommissioned) with validated state transitions and event history,
  matching the lifecycle model used across other SDK languages.

Both modules include comprehensive unit tests and are re-exported from
the crate root. README updated with API tables and usage examples.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
… to Go SDK (#7)

* feat(openshell): add governance skill package and runnable example (microsoft#942)

Co-authored-by: Copilot <[email protected]>

* feat(go): add MCP security, execution rings, and lifecycle management to Go SDK

- mcp.go: MCP security scanner detecting tool poisoning, typosquatting,
  hidden instructions (zero-width chars, homoglyphs), and rug pulls
- rings.go: Execution privilege ring model (Admin/Standard/Restricted/Sandboxed)
  with default-deny access control
- lifecycle.go: Eight-state agent lifecycle manager with validated transitions
- Full test coverage for all three modules
- Updated README with API docs and examples

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
- Update SOC2 mapping to reflect CredentialRedactor now redacts
  credential-like secrets before audit persistence (API keys, tokens,
  JWTs, connection strings, etc.). Remaining gap: non-credential PII
  (email, phone, addresses) not yet redacted in audit entries.
- Replace 'kernel-level enforcement' with 'policy-layer enforcement'
  in README, OWASP compliance, and architecture overview to match the
  existing 'application-level governance' framing in README Security
  section and LIMITATIONS.md.
- Qualify 10/10 OWASP coverage claim in COMPARISON.md with footnote
  clarifying this means mitigation components exist per risk category,
  not full elimination.
- Update owasp-llm-top10-mapping.md LLM06 row for credential redaction.

Addresses doc/code inconsistencies identified in external review.

Co-authored-by: Copilot <[email protected]>
@imran-siddique imran-siddique merged commit 2b6e0d9 into microsoft:main Apr 15, 2026
25 of 27 checks passed
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests agent-mesh agent-mesh package size/XL Extra large PR (500+ lines) labels Apr 15, 2026
@github-actions
Copy link
Copy Markdown

🤖 AI Agent: docs-sync-checker — Issues Found

📝 Documentation Sync Report

Issues Found

  • KillSwitch class in packages/agent-governance-dotnet/src/AgentGovernance/Hypervisor/KillSwitch.cs — missing docstring for the Kill method.
  • LifecycleManager class in packages/agent-governance-dotnet/src/AgentGovernance/Lifecycle/LifecycleManager.cs — missing docstring for the Activate, Suspend, Transition, Quarantine, and Decommission methods.
  • ⚠️ packages/agent-governance-dotnet/README.md — new sections "Kill Switch" and "Lifecycle Management" are added, but they lack detailed explanations for parameters and return values in the example code.
  • ⚠️ CHANGELOG.md — no entry for the addition of the KillSwitch and LifecycleManager classes.

Suggestions

  • 💡 Add a docstring for KillSwitch.Kill(agentId: str, reason: KillReason, detail: str) -> KillEvent explaining its purpose, parameters, return value, and possible exceptions.
  • 💡 Add docstrings for the following methods in LifecycleManager:
    • Activate()
    • Suspend(reason: str)
    • Transition(toState: LifecycleState, reason: str, actor: str)
    • Quarantine(reason: str)
    • Decommission(reason: str)
      Each docstring should include details about the method's purpose, parameters, return values, and exceptions.
  • 💡 Update the "Kill Switch" and "Lifecycle Management" sections in packages/agent-governance-dotnet/README.md to include detailed explanations of parameters and return values for the example code.
  • 💡 Add an entry to CHANGELOG.md summarizing the addition of the KillSwitch and LifecycleManager classes, along with their purpose and key features.

Additional Observations

  • All new public APIs have complete type annotations, which is good.
  • The updates to the project-level documentation (e.g., SOC2 mapping, OWASP compliance) appear to be in sync with the described changes in the PR.
  • The example code in packages/agent-governance-dotnet/README.md is consistent with the new APIs but needs more detailed explanations for clarity.

Action Items

  1. Add missing docstrings for the KillSwitch and LifecycleManager methods.
  2. Enhance the README sections with detailed parameter and return value explanations.
  3. Add a CHANGELOG entry for the new KillSwitch and LifecycleManager classes.

Once these issues are addressed, the documentation will be in sync.

@github-actions
Copy link
Copy Markdown

🤖 AI Agent: breaking-change-detector — Summary

🔍 API Compatibility Report

Summary

This pull request primarily updates documentation to align with current code behavior and introduces new features in the .NET package. No breaking changes were identified in the Python package microsoft/agent-governance-toolkit. The changes are additive and documentation-focused, ensuring consistency between code and documentation.

Findings

Severity Package Change Impact
🔵 agent-governance-dotnet Added KillSwitch class New public API, not breaking
🔵 agent-governance-dotnet Added LifecycleManager class New public API, not breaking

Migration Guide

✅ No breaking changes were identified in the Python package. No migration steps are required for existing users.

Notes

  • The new .NET features (KillSwitch and LifecycleManager) should be documented for developers using the agent-governance-dotnet package.
  • Documentation updates clarify credential redaction in audit logs and highlight remaining gaps for non-credential PII redaction. These changes do not impact the API but are important for users to understand the current capabilities and limitations of the toolkit.

If you have further questions or need additional analysis, feel free to ask!

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Agent: code-reviewer

Feedback on Pull Request: docs: sync audit redaction status and framing with current code


🔴 CRITICAL: Security Issues

  1. Non-Credential PII in Audit Logs:

    • While credential redaction is implemented via CredentialRedactor, non-credential Personally Identifiable Information (PII) such as email addresses, phone numbers, and physical addresses are still stored verbatim in AuditEntry.parameters.
    • Impact: This creates a significant privacy risk, as audit logs could inadvertently expose sensitive user data.
    • Action: Implement a dedicated PII redactor or extend CredentialRedactor to handle non-credential PII. This should include regex patterns for OWASP-recommended PII categories (email, phone, IP address, physical addresses, etc.).
  2. No Output PII Scanning:

    • The current implementation only scans tool-call input arguments for sensitive data. LLM-generated outputs are not scanned for PII before being returned to the user.
    • Impact: Agents could expose sensitive information in their responses, violating privacy and compliance requirements.
    • Action: Add an output interceptor to scan LLM responses for PII before returning them to the user.
  3. No At-Rest Encryption:

    • Audit logs, policy documents, and configuration files are stored in plaintext without encryption.
    • Impact: This makes sensitive data vulnerable to unauthorized access in case of a breach.
    • Action: Implement encryption for data at rest, including audit logs and configuration files.
  4. No Key Rotation Mechanism:

    • There is no mechanism for rotating cryptographic keys (Ed25519, HMAC secrets, SPIFFE certificates).
    • Impact: Long-lived keys increase the risk of compromise and reduce the overall security posture.
    • Action: Add tooling for automated key rotation and key lifecycle management.
  5. HMAC Symmetric Key Vulnerability:

    • HMAC uses symmetric keys, which allow insiders with access to the key to forge audit chains.
    • Impact: This compromises the integrity of the audit system.
    • Action: Implement asymmetric signing for audit entries using Ed25519 or similar cryptographic algorithms.

🟡 WARNING: Potential Breaking Changes

  1. Framing Consistency Updates:
    • The terminology change from "kernel-level enforcement" to "policy-layer/application-layer enforcement" in multiple documentation files may confuse existing users familiar with the previous terminology.
    • Action: Add a clear note in the documentation explaining the rationale behind the terminology change to avoid confusion.

💡 Suggestions for Improvement

  1. Expand PII Detection:

    • The current implementation detects only two PII patterns (SSN and credit card numbers). Expand the detection to include email addresses, phone numbers, IP addresses, physical addresses, and other OWASP-recommended categories.
    • Action: Update the regex patterns in mcp_gateway.py and ensure they are applied consistently across all data flows.
  2. Retention Enforcement:

    • The retention_days schema field is not enforced at runtime, allowing logs to persist indefinitely regardless of the configured retention policy.
    • Action: Implement log deletion and archival mechanisms based on the retention_days value.
  3. Privacy Notice Mechanism:

    • There is no feature to generate or deliver privacy notices to end users interacting with governed agents.
    • Action: Add a mechanism to generate and display privacy notices, ensuring compliance with privacy regulations.
  4. Lifecycle Management:

    • The newly added LifecycleManager class for agent state transitions is a good addition. However, consider adding more granular validation for state transitions to prevent invalid or unintended transitions.
    • Action: Implement state-specific validation rules and document them clearly.
  5. Kill Switch Thread Safety:

    • The KillSwitch class uses a lock for thread safety when accessing _history. However, the OnKill event is invoked outside the lock, which could lead to race conditions if subscribers modify shared state.
    • Action: Invoke OnKill within the lock or document that subscribers should handle thread safety themselves.
  6. Backward Compatibility:

    • Ensure that the changes to documentation and terminology do not affect existing integrations or user expectations. Consider providing migration guides or versioning for significant updates.

Summary

This PR addresses critical documentation gaps and aligns the documentation with the current codebase. However, several security issues remain unresolved, particularly around PII handling, audit log integrity, and cryptographic operations. These issues should be prioritized to ensure compliance with OWASP Agentic Top 10 and SOC2 requirements.

Recommended Actions

  1. Address the 🔴 CRITICAL issues immediately to mitigate security risks.
  2. Provide clear communication about 🟡 WARNING changes to avoid user confusion.
  3. Implement the 💡 SUGGESTIONS to improve the library's security, compliance, and usability.

Let me know if you need further clarification or assistance with implementing these changes!

@github-actions
Copy link
Copy Markdown

🤖 AI Agent: security-scanner — Security Review Summary

Security Review Summary

The pull request primarily updates documentation to align with the current implementation of the Agent Governance Toolkit (AGT). While the changes are mostly documentation-related, they reference critical security mechanisms and gaps in the codebase. Additionally, new features like the KillSwitch and LifecycleManager are introduced in the .NET package. Below is a detailed security analysis based on the provided diff.


Findings

1. Credential Redaction in Audit Logs

  • Severity: 🔵 LOW
  • Details: The documentation updates confirm that credentials (e.g., API keys, tokens, etc.) are redacted in audit logs using CredentialRedactor.redact_data_structure(params) before persistence. However, non-credential PII (e.g., email addresses, phone numbers, physical addresses) is still stored unredacted in AuditEntry.parameters.
  • Attack Vector: If an attacker gains access to audit logs, they could extract sensitive PII, leading to privacy violations and potential compliance issues (e.g., GDPR, CCPA).
  • Recommendation: Extend the CredentialRedactor functionality or create a new PIIRedactor to handle non-credential PII. Add a configuration flag (e.g., GovernancePolicy.redact_audit_pii) to enable this functionality.

2. KillSwitch Implementation

  • Severity: 🟠 HIGH
  • Details: The KillSwitch class allows for the termination of agents based on various reasons (e.g., policy violations, resource exhaustion). However:
    • The Kill method does not verify the identity of the caller, meaning any malicious actor with access to the KillSwitch instance could terminate agents.
    • The KillSwitch does not log or audit who triggered the kill action, which could hinder forensic investigations.
  • Attack Vector: If an attacker gains access to the KillSwitch instance, they could maliciously terminate agents without accountability.
  • Recommendation:
    1. Introduce authentication and authorization checks for the Kill method to ensure only authorized entities can invoke it.
    2. Log the identity of the caller (e.g., user ID or system ID) who triggered the kill action for audit purposes.
    3. Consider adding a rate-limiting mechanism to prevent abuse of the kill functionality.

3. LifecycleManager Implementation

  • Severity: 🟡 MEDIUM
  • Details: The LifecycleManager class manages agent state transitions. However:
    • There is no validation of the caller's identity or authorization to perform state transitions.
    • The CanTransition method only checks if a transition is valid based on the current state but does not enforce any access control.
  • Attack Vector: An unauthorized or malicious actor with access to the LifecycleManager instance could manipulate agent states, potentially bypassing governance policies or disrupting operations.
  • Recommendation:
    1. Add authentication and authorization checks to ensure only authorized entities can perform state transitions.
    2. Log all state transitions, including the identity of the caller, for audit purposes.

4. Race Condition in KillSwitch

  • Severity: 🔵 LOW
  • Details: The KillSwitch class uses a lock to synchronize access to the _history list. However, the IsArmed property is not protected by the same lock, leading to a potential race condition where the state of the kill switch could change between the check and the execution of the Kill method.
  • Attack Vector: A race condition could allow an agent to be terminated even when the kill switch is disarmed.
  • Recommendation: Protect the IsArmed property with the same lock used for _history to ensure consistent state during concurrent access.

5. Policy Engine Circumvention

  • Severity: 🔴 CRITICAL
  • Details: The documentation mentions that the policy engine operates at the "application layer" rather than the "kernel level." This change in terminology could indicate a shift in the enforcement mechanism. If the policy engine is not tightly integrated with the execution environment (e.g., at the syscall level), there is a risk that malicious agents could bypass policy enforcement.
  • Attack Vector: An attacker could exploit this gap to execute unauthorized actions by bypassing the policy engine.
  • Recommendation: Ensure that the policy engine is tightly integrated with the execution environment to prevent circumvention. If the enforcement is indeed at the application layer, implement additional safeguards (e.g., syscall interception, sandboxing) to prevent bypass.

6. Deserialization Risks

  • Severity: 🔴 CRITICAL
  • Details: The documentation does not explicitly address deserialization security, and the code changes do not provide any evidence of safe deserialization practices. If untrusted data is deserialized without proper validation, it could lead to remote code execution (RCE) or other vulnerabilities.
  • Attack Vector: An attacker could exploit unsafe deserialization to execute arbitrary code or manipulate the application state.
  • Recommendation: Ensure all deserialization operations use safe libraries and validate input data before deserialization. Consider using formats like JSON with strict schema validation instead of formats like pickle or YAML.

7. Supply Chain Risks

  • Severity: 🟠 HIGH
  • Details: The documentation mentions SBOM (Software Bill of Materials) and Ed25519 signing for supply chain security. However, these mechanisms are described as "reporting-only" or "opt-in," which may not provide sufficient protection against dependency confusion or typosquatting attacks.
  • Attack Vector: An attacker could introduce malicious dependencies into the supply chain, compromising the integrity of the toolkit.
  • Recommendation:
    1. Enforce mandatory SBOM generation and verification during the build process.
    2. Implement automated dependency scanning to detect typosquatting and known vulnerabilities.
    3. Require signed commits and signed releases for all dependencies.

Additional Observations

  1. Documentation Accuracy: The updated documentation is more accurate and transparent about the current state of the toolkit. However, it also highlights critical gaps (e.g., non-credential PII redaction, lack of at-rest encryption, and key rotation) that need to be addressed for full compliance with SOC2 and OWASP standards.

  2. KillSwitch and LifecycleManager: These new features introduce powerful governance mechanisms but also increase the attack surface. Proper access controls and logging are essential to prevent misuse.

  3. Audit Log Security: While credential redaction is a significant improvement, the lack of non-credential PII redaction remains a privacy risk. This should be prioritized for remediation.


Overall Risk Rating: 🟠 HIGH

The pull request itself does not introduce new vulnerabilities but highlights existing gaps and introduces new features that require additional safeguards. The most critical issues are related to policy engine circumvention, deserialization risks, and supply chain security.


Suggested Next Steps

  1. Address Critical Gaps:

    • Implement non-credential PII redaction in audit logs.
    • Ensure the policy engine cannot be bypassed, even if it operates at the application layer.
    • Review all deserialization operations for safety.
  2. Secure New Features:

    • Add authentication and logging to the KillSwitch and LifecycleManager.
    • Protect against race conditions in the KillSwitch.
  3. Enhance Supply Chain Security:

    • Enforce SBOM and dependency scanning.
    • Require signed commits/releases for dependencies.
  4. Update Documentation:

    • Clearly document the remaining gaps and planned mitigations.
    • Provide guidance for deployers on how to supplement the toolkit for full compliance.

By addressing these issues, the Agent Governance Toolkit can maintain its position as a robust security layer for AI agents.

@imran-siddique imran-siddique deleted the docs/sync-code-redaction-and-framing branch April 15, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-mesh agent-mesh package documentation Improvements or additions to documentation size/XL Extra large PR (500+ lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant