Skip to content

Endorsement Store Interface Implementation - #435

Open
shefali-kamal wants to merge 9 commits into
veraison:mainfrom
MonakaResearch:main
Open

Endorsement Store Interface Implementation#435
shefali-kamal wants to merge 9 commits into
veraison:mainfrom
MonakaResearch:main

Conversation

@shefali-kamal

Copy link
Copy Markdown

This PR implements following:

  • contains the implementation of endorsement store plugin interface
  • converted coserv proxy plugins to endorsement store plugins
  • make changes in vts to use the endorsement store plugins
  • vts now uses a composite store made up of corimstore and store plugins as fallback

Address issue #431

DhanusML added 9 commits July 31, 2026 12:09
Definition of protobuf messages used as arguments for
endorsement store interface.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
The store plugin interface definition and implementation
of the RPC layer (for go-plugin client and server).
Endorsement store interface is an aggregation of
IEndorsementStoreReader and IEndorsementStoreWriter, for
read and write operations on endorsement store respectively.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Register endorsementstore targets in the build system
and docker deployment.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
The coserv proxy plugins are now store plugins,
with only the ExecuteCoservQuery method implemented.

Note: builtin loader may not work.

Note: the new stores (amd and nvidia) have not been tested yet.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Add corimstore based store plugin. The implementation
converts existing store implementation into a plugin.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Update VTS to use the IEndorsementStore interface.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
q -> %q

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>

@setrofim setrofim left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think the notion of a "media type" makes sense in the context of the store backend. We don't really want to be selecting the backend based on it. I also don't like the somewhat arbitrary distinction between "primary" and "fallback" backends.

Suggestion: store backends are identified solely by name; for the sake of reusing existing plugin loader/manager the media type APIs implemented via a shim to to just return the name, and this is hidden as much as possible. Store configuration contains a list of backend names, which specifies which frontend plugins will actually be actively used by the store frontend. When servicing requests, the frontend tries the backends in the order specified until.


func NewStore() *DefaultStore {
logger := log.Named(PluginName)
logger.Debug("initializing default store")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This log line belongs inside DefaultStore.Init() below, not here.


func (s *DefaultStore) Init(params *plugin.Parameters) error {
if params == nil {
panic("parameters are required for corimstore")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Return an error rather than panic here.


store, err := corimstore.Open(context.Background(), cfg.StoreConfig())
if err != nil {
panic(err)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Return the error rather than panic.

// initialize it here.
if strings.Contains(cfg.DSN, ":memory:") {
if err := store.Init(); err != nil {
panic(err)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Return the error rather than panic.

return SchemeName
}

func (s *DefaultStore) GetSupportedMediaTypes() map[string][]string {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think the concept of a "supported media type" really makes sense for a store backend. I think we may want a different plugin interface for this.

return res, err
}

func (s *DefaultStore) ExecuteCoservQuery(mediaType, query string) (*coserv.Coserv, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why does this take a mediaType? It does not appear to be used, and also clashes with remaining store API that takea label instead. The media type should be resolved to a label by the time the request reaches the store.

}

func (s CoservProxyHandler) GetEndorsements(tenantID string, query string) ([]byte, error) {
func (s CoservProxyHandler) ExecuteCoservQuery(mediaType, query string) (*coserv.Coserv, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ditto here. the media type should be resolved by this point.


if err := o.CoservProxyPluginManager.Close(); err != nil {
o.logger.Errorf("coserv plugin manager shutdown failed: %v", err)
// FIXME: close stores while closing store manager

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we need Line 174..?

Should not the Sore manager be responsible for closing the Stores!


coservProxyDerived := c.assembleCoservMediaTypes(
c.CoservProxyPluginManager.GetRegisteredMediaTypes(),
c.StoreManager.GetRegisteredMediaTypes(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Agree with Sergei, the Store should not have a Media Type.

The functionality must be changed!

@yogeshbdeshpande yogeshbdeshpande left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Have started reviewing it, will complete by the end of the day today!

@THS-on
THS-on requested a review from thomas-fossati August 11, 2026 15:37

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this!

I have inlined a few comments.

Comment on lines +526 to +527
if err != nil {
o.logger.Warnw("could not find in store", "valID", valID, "error", err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When joining the dots between L526-527 and L532-533, it looks like any store errors will be seen as ENOTFOUND from the pov of the caller. If that's the case, the caller (L446) will log and move on. So, imagine the case where the DB is down, valueTriples stays empty, getValueTriples returns ENOTFONUD, the caller logs a warning and proceeds with nil endorsements into AppraiseEvidence. I don't think it's what we want, right?

Comment on lines +175 to +180
if err := CloseCorimStore(o.StoreManager); err != nil {
o.logger.Errorf("failed to close corim store: %v", err)
}

if err := o.Store.Close(); err != nil {
o.logger.Errorf("store closure failed: %v", err)
if err := o.StoreManager.Close(); err != nil {
o.logger.Errorf("store plugin manager shutdown failed: %v", err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Potential ENOCOFFEE :-) Would this effectively result in a double close?

Comment on lines +666 to +667
if err != nil {
o.logger.Infof("could not find coserv result in store")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the reasoning behind masking any error as ENOTFOUND/404?
From a ReST perspective, we want to be able to tell our clinets that there is something wrong with the service (5xx) rather than with their query (4xx).


func (s *DefaultStore) ExecuteCoservQuery(mediaType, query string) (*coserv.Coserv, error) {
s.logger.Infof("got coserv query: %v", query)
fallbackAuthority, err := comid.NewCryptoKeyTaggedBytes([]byte("dummyauth"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

curious: why we need to use this "dummyauth"?

option go_package = "github.com/veraison/services/proto";

message GetEndorsementsArgs {
bytes environment = 1 [json_name = "environemnt-map"];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
bytes environment = 1 [json_name = "environemnt-map"];
bytes environment = 1 [json_name = "environment-map"];

if subs["coserv"].IsSet("signer") {
coservContext, err = coserv.NewCoservContextFromViper(subs["coserv"])
if err != nil {
log.Fatal("CoSERV config initialization: %v", err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Fatal("CoSERV config initialization: %v", err)
log.Fatalf("CoSERV config initialization: %v", err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants