fix(security): add SECURITY.md to all packages, harden langchain crypto fallback#354
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add EU AI Act, Colorado AI Act, and GPAI obligations timeline with AGT coverage mapping. Reference Microsoft Purview DSPM for AI as complementary data governance layer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Scorecard API rejects workflows with write permissions at the workflow level. id-token: write and security-events: write must be scoped to the job level only. Restores permissions: read-all at workflow level while keeping job-level write permissions intact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ft#324) Add Google-style docstrings with Args, Returns, Raises, Attributes, and Example sections to MCPMessageType, MCPAdapter, and MCPServer classes. Also enhances docstrings for key methods including handle_message, _handle_tools_call, _handle_resources_read, and _map_tool_to_action. Fixes microsoft#316
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
…s (dependency confusion) (microsoft#325) - Replace !pip install agent-os with !pip install -e ../.. in all 6 notebooks; agent-os is not on PyPI and installing it from PyPI is a dependency confusion vector - Replace zendesk-sdk/freshdesk-sdk with zenpy/freshdesk (the real published SDKs) in customer-service/requirements.txt - Remove hashlib-compat from healthcare-hipaa/requirements.txt; hashlib is stdlib and hashlib-compat is not a real PyPI package
…stall agent-os with agent-os-kernel Replace all remaining instances of `pip install agent-os` (unregistered on PyPI) with `pip install agent-os-kernel` (the actual package) across docs, examples, TypeScript extensions, CLI source, tests, and SVG assets. Also fixes `pip install emk` references to point to `agent-os-kernel[full]` since emk is a submodule, not a standalone PyPI package. Completes the fix started in PR microsoft#325 which only covered notebooks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dify 65K→133K, AutoGen 42K→55K, CrewAI 28K→46K, Semantic Kernel 24K→27K, LangGraph 24K→27K, Haystack 22K→24K, Agent Framework 7.6K→8K. Added star counts for OpenAI Agents SDK (20K) and Google ADK (18K). Sorted by stars descending. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…it CI - scripts/check_dependency_confusion.py: Pre-commit hook that scans for pip install commands referencing unregistered PyPI packages. Maintains an allowlist of known registered packages. - .github/workflows/weekly-security-audit.yml: Weekly CI job running dependency confusion scan, security skills scan, and weak crypto check. Uploads reports as artifacts with 90-day retention. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…icrosoft#349) * docs: add testing guide for external testers and customers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: add regulatory alignment table and Purview positioning to README Add EU AI Act, Colorado AI Act, and GPAI obligations timeline with AGT coverage mapping. Reference Microsoft Purview DSPM for AI as complementary data governance layer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(ci): restore read-all at workflow level for Scorecard verification The Scorecard API rejects workflows with write permissions at the workflow level. id-token: write and security-events: write must be scoped to the job level only. Restores permissions: read-all at workflow level while keeping job-level write permissions intact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: add comprehensive docstrings to mcp_adapter.py classes (microsoft#324) Add Google-style docstrings with Args, Returns, Raises, Attributes, and Example sections to MCPMessageType, MCPAdapter, and MCPServer classes. Also enhances docstrings for key methods including handle_message, _handle_tools_call, _handle_resources_read, and _map_tool_to_action. Fixes microsoft#316 * ci: add markdown link checker workflow (microsoft#323) Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> * feat: add policy evaluation heatmap to SRE dashboard (microsoft#309) (microsoft#326) * fix: remove unregistered PyPI packages from notebooks and requirements (dependency confusion) (microsoft#325) - Replace !pip install agent-os with !pip install -e ../.. in all 6 notebooks; agent-os is not on PyPI and installing it from PyPI is a dependency confusion vector - Replace zendesk-sdk/freshdesk-sdk with zenpy/freshdesk (the real published SDKs) in customer-service/requirements.txt - Remove hashlib-compat from healthcare-hipaa/requirements.txt; hashlib is stdlib and hashlib-compat is not a real PyPI package * fix(security): complete dependency confusion fix — replace all pip install agent-os with agent-os-kernel Replace all remaining instances of `pip install agent-os` (unregistered on PyPI) with `pip install agent-os-kernel` (the actual package) across docs, examples, TypeScript extensions, CLI source, tests, and SVG assets. Also fixes `pip install emk` references to point to `agent-os-kernel[full]` since emk is a submodule, not a standalone PyPI package. Completes the fix started in PR microsoft#325 which only covered notebooks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: update framework star counts to current values Dify 65K→133K, AutoGen 42K→55K, CrewAI 28K→46K, Semantic Kernel 24K→27K, LangGraph 24K→27K, Haystack 22K→24K, Agent Framework 7.6K→8K. Added star counts for OpenAI Agents SDK (20K) and Google ADK (18K). Sorted by stars descending. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Parsa Faraji Alamouti <165321600+parsa-faraji@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Zeel Desai <72783325+zeel2104@users.noreply.github.com> Co-authored-by: Xavier Garceau-Aranda <xavier.garceau-aranda@posteo.net>
- agentmesh → agentmesh-platform (5 files) - agentmesh-governance → agent-governance-toolkit - agent-os-observability → agent-os-kernel[observability] - hashlib.md5 → hashlib.sha256 (3 files) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…to fallback - Add SECURITY.md to 29 packages (9 main + 20 integrations) linking to root security reporting guidance - Harden langchain-agentmesh crypto fallback: emit SecurityWarning when cryptography package unavailable (simulation mode) - Add explicit SECURITY WARNING comments on fallback code paths Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🤖 AI Agent: security-scanner — Security Review of Pull RequestSecurity Review of Pull RequestThis pull request introduces two main changes:
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
Summary of Findings and Recommendations
Final RecommendationThis pull request introduces critical security vulnerabilities due to the insecure cryptographic fallback mechanism in the |
There was a problem hiding this comment.
🤖 AI Agent: code-reviewer
Review Summary
This pull request introduces two main changes:
- Adds a
SECURITY.mdfile to all subpackages, linking to the root repository's security reporting guidelines. - Updates the
langchain-agentmeshpackage to include a warning about the use of an insecure cryptographic fallback mechanism in simulation mode.
Below is a detailed review of the changes:
🔴 CRITICAL: Cryptographic Fallback in langchain-agentmesh
The fallback mechanism for cryptographic operations in langchain-agentmesh is not secure and could lead to severe security vulnerabilities if used in production. Specifically:
-
Simulation Mode Warning:
- The warning added via
warnings.warnis a good step, but it is insufficient to prevent misuse in production environments. - Developers may ignore warnings, especially if they are not familiar with the implications of using an insecure fallback.
- The warning added via
-
Fallback Signature Generation:
- The fallback mechanism uses a SHA-256 hash of the concatenated data and private key (
sig_input = f"{data}:{self.private_key}"). This is not a cryptographically secure signature and could be trivially forged by an attacker who knows the format.
- The fallback mechanism uses a SHA-256 hash of the concatenated data and private key (
-
Fallback Signature Verification:
- The fallback verification accepts any non-empty signature (
return len(signature.signature) > 0). This effectively disables signature verification, which is a critical security flaw.
- The fallback verification accepts any non-empty signature (
Recommendations:
- 🔴 Enforce secure cryptographic operations: Completely disable the fallback mechanism in production environments. Raise a
RuntimeErrorif thecryptographypackage is not installed, rather than relying on warnings. - 🔴 Environment-based enforcement: Use an environment variable or configuration flag to explicitly enable the insecure fallback for development or testing purposes. For example:
if not CRYPTO_AVAILABLE and not os.getenv("ALLOW_INSECURE_CRYPTO"): raise RuntimeError( "cryptography package is not installed. Install it using " "'pip install langchain-agentmesh[crypto]' or pip install cryptography>=44.0.0" )
- 🔴 Improve documentation: Clearly document the risks of using the fallback mechanism in the README and other relevant documentation. Highlight that it is only for testing and not for production use.
🟡 WARNING: Backward Compatibility
The changes to langchain-agentmesh introduce new behavior (warnings and potential exceptions) when the cryptography package is not installed. This could break existing workflows where the fallback mechanism is currently being used without warnings or exceptions.
Recommendations:
- Provide a clear migration path for users who may be relying on the fallback mechanism.
- Consider releasing this change as a minor version update and include a detailed changelog entry explaining the new behavior.
💡 Suggestions for Improvement
-
Centralize
SECURITY.mdFiles:- While adding
SECURITY.mdto each subpackage is helpful for visibility, it introduces redundancy and maintenance overhead. Consider using a symlink to the rootSECURITY.mdfile instead of duplicating the content across all subpackages. This ensures that updates to the rootSECURITY.mdautomatically propagate to all subpackages.
- While adding
-
Use Custom Warning Class:
- The
SecurityWarningused in thewarnings.warncall is not defined in the provided code. Define a custom warning class for better clarity:class SecurityWarning(UserWarning): pass
- The
-
Add Tests for Warning and Fallback Behavior:
- Add unit tests to ensure the warning is raised when the
cryptographypackage is not installed. - Add tests to verify that the fallback mechanism is only used when explicitly enabled (e.g., via an environment variable).
- Add unit tests to ensure the warning is raised when the
-
Improve Documentation for Cryptographic Operations:
- Expand the documentation in the
langchain-agentmeshpackage to explain the cryptographic operations being performed, including the risks of using the fallback mechanism.
- Expand the documentation in the
-
Consider Deprecating the Fallback Mechanism:
- Long-term, consider removing the insecure fallback mechanism entirely. If cryptographic operations are critical to the functionality of the package, the
cryptographypackage should be a required dependency.
- Long-term, consider removing the insecure fallback mechanism entirely. If cryptographic operations are critical to the functionality of the package, the
Final Assessment
- The addition of
SECURITY.mdfiles is a positive step for improving security practices and transparency. However, using symlinks could simplify maintenance. - The cryptographic fallback mechanism in
langchain-agentmeshis a critical security risk and must be addressed before merging this PR. - The changes to
langchain-agentmeshmay introduce breaking changes and should be clearly communicated to users.
Action Items
- 🔴 Address the insecure cryptographic fallback mechanism in
langchain-agentmeshas outlined above. - 🟡 Consider the potential backward compatibility impact and document the changes in the changelog.
- 💡 Replace duplicated
SECURITY.mdfiles with symlinks to the rootSECURITY.md. - 💡 Define a custom
SecurityWarningclass for better clarity. - 💡 Add unit tests for the new warning and fallback behavior.
- 💡 Update documentation to highlight the risks of using the insecure fallback and provide guidance on installing the
cryptographypackage.
Let me know if you need further clarification or assistance!
Add SECURITY.md to all 29 subpackages linking to root security reporting guidance. Harden langchain-agentmesh crypto fallback with SecurityWarning when running in simulation mode. 30 files changed.