-
Notifications
You must be signed in to change notification settings - Fork 416
feat: add OPA plugin for policy enforcement #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
β¦ons, url changes and opa version (arm architecture 1.7.0) Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Teryl Taylor <[email protected]>
Signed-off-by: Teryl Taylor <[email protected]>
Signed-off-by: Teryl Taylor <[email protected]>
Signed-off-by: Teryl Taylor <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
fb50bba to
2a0fdd6
Compare
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Signed-off-by: Shriti Priya <[email protected]>
Member
OPA Plugin PR Review - Quick Summaryβ What Works
|
Signed-off-by: Mihai Criveti <[email protected]>
crivetimihai
approved these changes
Sep 9, 2025
rakdutta
pushed a commit
to rakdutta/mcp-context-forge
that referenced
this pull request
Sep 10, 2025
* Initial OPA plugin template Signed-off-by: Shriti Priya <[email protected]> * Adding opa server installation, tool invoke with policy evaluations Signed-off-by: Shriti Priya <[email protected]> * Sample policy holders for pre/post tool, resource and prompt invocations, url changes and opa version (arm architecture 1.7.0) Signed-off-by: Shriti Priya <[email protected]> * feat: add shared context capabilities and fixed error issues. Signed-off-by: Teryl Taylor <[email protected]> * fix: plugin cleanup to support multiple external plugins. Signed-off-by: Teryl Taylor <[email protected]> * fix(lint): fixed linting issues Signed-off-by: Teryl Taylor <[email protected]> * feat(error): update error handling with enforce_ignore_error Signed-off-by: Teryl Taylor <[email protected]> * Additiona of context-tool-policy mapping using applied_to Signed-off-by: Shriti Priya <[email protected]> * Changes in plugin config schema Signed-off-by: Shriti Priya <[email protected]> * Schema update models.py Signed-off-by: Shriti Priya <[email protected]> * updated schema Signed-off-by: Shriti Priya <[email protected]> * Adding endpoint to policy Signed-off-by: Shriti Priya <[email protected]> * documentation for OPA Plugin Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * fix: flake8 and doctest Signed-off-by: Shriti Priya <[email protected]> * fix: solving doctest errors Signed-off-by: Shriti Priya <[email protected]> * fix:doctest Signed-off-by: Shriti Priya <[email protected]> * Adding tool_name variable change Signed-off-by: Shriti Priya <[email protected]> * test cases for opapluginfilter Signed-off-by: Shriti Priya <[email protected]> * Update manifest.in with exclude Signed-off-by: Shriti Priya <[email protected]> * updated prehook Signed-off-by: Shriti Priya <[email protected]> * updating documentation Signed-off-by: Shriti Priya <[email protected]> * rebase Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: Shriti Priya <[email protected]> Signed-off-by: Teryl Taylor <[email protected]> Signed-off-by: Mihai Criveti <[email protected]> Co-authored-by: Teryl Taylor <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 14, 2025
* Initial OPA plugin template Signed-off-by: Shriti Priya <[email protected]> * Adding opa server installation, tool invoke with policy evaluations Signed-off-by: Shriti Priya <[email protected]> * Sample policy holders for pre/post tool, resource and prompt invocations, url changes and opa version (arm architecture 1.7.0) Signed-off-by: Shriti Priya <[email protected]> * feat: add shared context capabilities and fixed error issues. Signed-off-by: Teryl Taylor <[email protected]> * fix: plugin cleanup to support multiple external plugins. Signed-off-by: Teryl Taylor <[email protected]> * fix(lint): fixed linting issues Signed-off-by: Teryl Taylor <[email protected]> * feat(error): update error handling with enforce_ignore_error Signed-off-by: Teryl Taylor <[email protected]> * Additiona of context-tool-policy mapping using applied_to Signed-off-by: Shriti Priya <[email protected]> * Changes in plugin config schema Signed-off-by: Shriti Priya <[email protected]> * Schema update models.py Signed-off-by: Shriti Priya <[email protected]> * updated schema Signed-off-by: Shriti Priya <[email protected]> * Adding endpoint to policy Signed-off-by: Shriti Priya <[email protected]> * documentation for OPA Plugin Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * fix: flake8 and doctest Signed-off-by: Shriti Priya <[email protected]> * fix: solving doctest errors Signed-off-by: Shriti Priya <[email protected]> * fix:doctest Signed-off-by: Shriti Priya <[email protected]> * Adding tool_name variable change Signed-off-by: Shriti Priya <[email protected]> * test cases for opapluginfilter Signed-off-by: Shriti Priya <[email protected]> * Update manifest.in with exclude Signed-off-by: Shriti Priya <[email protected]> * updated prehook Signed-off-by: Shriti Priya <[email protected]> * updating documentation Signed-off-by: Shriti Priya <[email protected]> * rebase Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: Shriti Priya <[email protected]> Signed-off-by: Teryl Taylor <[email protected]> Signed-off-by: Mihai Criveti <[email protected]> Co-authored-by: Teryl Taylor <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 14, 2025
* Initial OPA plugin template Signed-off-by: Shriti Priya <[email protected]> * Adding opa server installation, tool invoke with policy evaluations Signed-off-by: Shriti Priya <[email protected]> * Sample policy holders for pre/post tool, resource and prompt invocations, url changes and opa version (arm architecture 1.7.0) Signed-off-by: Shriti Priya <[email protected]> * feat: add shared context capabilities and fixed error issues. Signed-off-by: Teryl Taylor <[email protected]> * fix: plugin cleanup to support multiple external plugins. Signed-off-by: Teryl Taylor <[email protected]> * fix(lint): fixed linting issues Signed-off-by: Teryl Taylor <[email protected]> * feat(error): update error handling with enforce_ignore_error Signed-off-by: Teryl Taylor <[email protected]> * Additiona of context-tool-policy mapping using applied_to Signed-off-by: Shriti Priya <[email protected]> * Changes in plugin config schema Signed-off-by: Shriti Priya <[email protected]> * Schema update models.py Signed-off-by: Shriti Priya <[email protected]> * updated schema Signed-off-by: Shriti Priya <[email protected]> * Adding endpoint to policy Signed-off-by: Shriti Priya <[email protected]> * documentation for OPA Plugin Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * fix: flake8 and doctest Signed-off-by: Shriti Priya <[email protected]> * fix: solving doctest errors Signed-off-by: Shriti Priya <[email protected]> * fix:doctest Signed-off-by: Shriti Priya <[email protected]> * Adding tool_name variable change Signed-off-by: Shriti Priya <[email protected]> * test cases for opapluginfilter Signed-off-by: Shriti Priya <[email protected]> * Update manifest.in with exclude Signed-off-by: Shriti Priya <[email protected]> * updated prehook Signed-off-by: Shriti Priya <[email protected]> * updating documentation Signed-off-by: Shriti Priya <[email protected]> * rebase Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: Shriti Priya <[email protected]> Signed-off-by: Teryl Taylor <[email protected]> Signed-off-by: Mihai Criveti <[email protected]> Co-authored-by: Teryl Taylor <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
vk-playground
pushed a commit
to vk-playground/mcp-context-forge
that referenced
this pull request
Sep 16, 2025
* Initial OPA plugin template Signed-off-by: Shriti Priya <[email protected]> * Adding opa server installation, tool invoke with policy evaluations Signed-off-by: Shriti Priya <[email protected]> * Sample policy holders for pre/post tool, resource and prompt invocations, url changes and opa version (arm architecture 1.7.0) Signed-off-by: Shriti Priya <[email protected]> * feat: add shared context capabilities and fixed error issues. Signed-off-by: Teryl Taylor <[email protected]> * fix: plugin cleanup to support multiple external plugins. Signed-off-by: Teryl Taylor <[email protected]> * fix(lint): fixed linting issues Signed-off-by: Teryl Taylor <[email protected]> * feat(error): update error handling with enforce_ignore_error Signed-off-by: Teryl Taylor <[email protected]> * Additiona of context-tool-policy mapping using applied_to Signed-off-by: Shriti Priya <[email protected]> * Changes in plugin config schema Signed-off-by: Shriti Priya <[email protected]> * Schema update models.py Signed-off-by: Shriti Priya <[email protected]> * updated schema Signed-off-by: Shriti Priya <[email protected]> * Adding endpoint to policy Signed-off-by: Shriti Priya <[email protected]> * documentation for OPA Plugin Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * documentation update Signed-off-by: Shriti Priya <[email protected]> * fix: flake8 and doctest Signed-off-by: Shriti Priya <[email protected]> * fix: solving doctest errors Signed-off-by: Shriti Priya <[email protected]> * fix:doctest Signed-off-by: Shriti Priya <[email protected]> * Adding tool_name variable change Signed-off-by: Shriti Priya <[email protected]> * test cases for opapluginfilter Signed-off-by: Shriti Priya <[email protected]> * Update manifest.in with exclude Signed-off-by: Shriti Priya <[email protected]> * updated prehook Signed-off-by: Shriti Priya <[email protected]> * updating documentation Signed-off-by: Shriti Priya <[email protected]> * rebase Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: Shriti Priya <[email protected]> Signed-off-by: Teryl Taylor <[email protected]> Signed-off-by: Mihai Criveti <[email protected]> Co-authored-by: Teryl Taylor <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
β¨ Feature / Enhancement PR
π Epic / Issue
Closes # #271
π Summary
This PR introduces an external OPA Plugin which is self-contained with the OPA server running as background service, with sample policies. The pre hooks on tools that talks to OPA server running as background service within the same container. Whenever a tool is invoked, if OPA Plugin is in action, a policy will be applied on the tool call to allow/deny it.
OPA Server
To define a policy file you need to go into opaserver/rego and create a sample policy file for you.
Example -
example.regois present.Once you have this file created in this location, when building the server, the opa binaries will be downloaded and a container will be build.
In the
run_server.shfile, the opa server will run as a background service in the container with the rego policy file.OPA Plugin
The OPA plugin runs as an external plugin with pre/post tool invocations. So everytime, a tool invocation is made, and if OPAPluginFilter has been defined in config.yaml file, the tool invocation will pass through this OPA Plugin.
The
applied_tokey in config.yaml, has been used to selectively apply policies and provide context for a specific tool.Here, using this, you can provide the
nameof the tool you want to apply policy on, you can also providecontext to the tool with the prefix
globalif it needs to check the context in global context provided.The key
opa_policy_contextis used to get context for policies and you can have multiple contexts within this key usinggit_contextkey.You can also provide policy within the
extensionskey where you can provide information to the pluginrelated to which policy to run and what endpoint to call for that policy.
In the
configkey inconfig.yamlfile OPAPlugin consists of the following things:opa_base_url: It is the base url on which opa server is running.More to come