-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Add versioning support to plugins and scheme implementations (#120) #349
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
Open
Sukuna0007Abhi
wants to merge
1
commit into
veraison:main
Choose a base branch
from
Sukuna0007Abhi:feature/new-branch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+402
−6
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # Plugin Versioning Implementation (Issue #120) | ||
|
|
||
| ## Summary | ||
|
|
||
| This PR implements versioning support for Veraison plugins and scheme implementations, addressing **Issue #120**. | ||
|
|
||
| **Issue Requirements:** | ||
| - ✅ Add versioning to pluggable interfaces | ||
| - ✅ Log versions during plugin discovery | ||
| - ✅ Expose versions via meta query interface (ServiceState API) | ||
| - ✅ Allow clients to understand level of support for particular formats | ||
|
|
||
| ## Implementation Approach | ||
|
|
||
| **Scheme-Level Versioning:** All pluggables associated with a scheme (evidence handler, endorsement handler, store handler) share the same version, consistent with how they share the scheme name. | ||
|
|
||
| ## Key Changes | ||
|
|
||
| ### 1. Core Plugin Interface | ||
| - Added `GetVersion() string` to `IPluggable` interface | ||
| - All plugins must now return semantic version (e.g., "1.0.0") | ||
|
|
||
| ### 2. Version Exposure Methods | ||
|
|
||
| **Manager Interface (`plugin/imanager.go`):** | ||
| ```go | ||
| GetPluginVersion(name string) (string, error) | ||
| GetSchemeVersion(scheme string) (string, error) | ||
| ``` | ||
|
|
||
| **ServiceState API (proto/state.proto):** | ||
| ```protobuf | ||
| map<string, string> scheme_versions = 4; | ||
| ``` | ||
|
|
||
| ### 3. Logging | ||
| Plugins now log version at INFO level during discovery: | ||
| ``` | ||
| loaded plugin | name=psa-evidence-handler scheme=PSA_IOT version=1.0.0 path=... | ||
| ``` | ||
|
|
||
| ### 4. All Schemes Updated | ||
|
|
||
| | Scheme | Version | | ||
| |--------|---------| | ||
| | PSA_IOT | 1.0.0 | | ||
| | ARM_CCA | 1.0.0 | | ||
| | PARSEC_CCA | 1.0.0 | | ||
| | PARSEC_TPM | 1.0.0 | | ||
| | RIOT | 1.0.0 | | ||
| | TPM_ENACTTRUST | 1.0.0 | | ||
|
|
||
| ## Files Modified (39 total) | ||
|
|
||
| **Core Framework:** | ||
| - `plugin/ipluggable.go` - Added GetVersion() method | ||
| - `plugin/goplugin_context.go` - Version tracking | ||
| - `plugin/goplugin_loader.go` - Version logging | ||
| - `plugin/goplugin_manager.go` - Version query methods | ||
| - `plugin/imanager.go` - Manager interface extension | ||
| - `builtin/builtin_loader.go` - Version logging | ||
| - `builtin/builtin_manager.go` - Version query methods | ||
|
|
||
| **RPC Support:** | ||
| - `handler/evidence_rpc.go` | ||
| - `handler/endorsement_rpc.go` | ||
| - `handler/store_rpc.go` | ||
|
|
||
| **All 6 Scheme Implementations:** | ||
| - Added `SchemeVersion` constants | ||
| - Implemented `GetVersion()` in all handlers | ||
|
|
||
| **Test Infrastructure:** | ||
| - Updated test plugins and interfaces | ||
|
|
||
| ## Usage Examples | ||
|
|
||
| ### Query via Manager | ||
| ```go | ||
| version, err := pluginManager.GetSchemeVersion("PSA_IOT") | ||
| // Returns: "1.0.0" | ||
| ``` | ||
|
|
||
| ### Query via API | ||
| ``` | ||
| GET /verification/v1/state | ||
| ``` | ||
| Response includes: | ||
| ```json | ||
| { | ||
| "scheme_versions": { | ||
| "PSA_IOT": "1.0.0", | ||
| "ARM_CCA": "1.0.0", | ||
| ... | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Build Status | ||
| ✅ All packages compile successfully | ||
| ✅ No errors or warnings | ||
|
|
||
| ## Resolves | ||
| Closes #120 |
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,4 +44,13 @@ type IManager[I IPluggable] interface { | |
| // the specified name. If there is no such plugin, an error is | ||
| // returned. | ||
| LookupByAttestationScheme(name string) (I, error) | ||
|
|
||
| // GetPluginVersion returns the version string for a plugin identified | ||
| // by its name. If the plugin is not found, an error is returned. | ||
| GetPluginVersion(name string) (string, error) | ||
|
|
||
| // GetSchemeVersion returns the version string for the plugin that | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This returns the version for the scheme, not for a plugin (a scheme has three plugins associated with it, but, currently, they do not have independent versions). |
||
| // implements the specified attestation scheme. If no plugin implements | ||
| // the scheme, an error is returned. | ||
| GetSchemeVersion(scheme string) (string, error) | ||
| } | ||
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is misleading. Per current inplementation, plugins do not independent version and this returns the version for the scheme, not the plugin. I would rename this to
GetSchemeVersionForPlugin