feat(policy): Implement Tool Annotation Matching in Policy Engine - #20029
Conversation
Summary of ChangesHello @jerop, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the policy engine by introducing support for tool annotations. This new feature allows policy rules to be defined and enforced based on metadata associated with tools, such as a Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces tool annotation matching to the policy engine, allowing for more granular control over tool execution based on metadata. This is a significant improvement for defining behavior-based security rules. The changes include updating policy types, implementing the matching logic, and propagating annotations through methods. Additionally, the TOML loader has been updated to support parsing toolAnnotations from policy files, and tests have been added to validate the new functionality. The code is well-tested and adheres to the project's architectural guidelines.
…ngine - Add toolAnnotations field to PolicyRule and SafetyCheckerRule types. - Implement partial record matching for toolAnnotations in the policy engine. - Update check and checkShellCommand to propagate annotations during evaluation. - Update TOML loader to support parsing toolAnnotations from policy files. - Add comprehensive unit and integration tests for behavior-based security rules using readOnlyHint. Note: Future work will implement the pipeline to capture and propagate annotations from discovered MCP servers. Fixes #20025
fc59660 to
ff19f78
Compare
|
Size Change: +852 B (0%) Total Size: 25.7 MB ℹ️ View Unchanged
|
Fixes #20025
Follow up on #20024
Note: Future work will implement the pipeline to capture and propagate annotations from discovered MCP servers as part of #19655.