Skip to content

Commit 21e2900

Browse files
feat(lead verifier): veraison client plugin
Signed-off-by: Thomas Fossati <[email protected]>
1 parent 3c0df9b commit 21e2900

File tree

13 files changed

+799
-12
lines changed

13 files changed

+799
-12
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ require (
159159
github.com/google/go-sev-guest v0.14.1
160160
github.com/jraman567/go-gen-ref v1.2.3
161161
github.com/pkg/errors v0.9.1
162+
github.com/veraison/apiclient v0.4.0
162163
github.com/veraison/ratsd v0.0.0-20251002182229-94bebd610d15
163164
)
164165

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,8 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr
12211221
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
12221222
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
12231223
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
1224+
github.com/veraison/apiclient v0.4.0 h1:eH0a1beH3o5gVjSkYwbTiEw1YhmTo1Ce5i/IXZPCIiQ=
1225+
github.com/veraison/apiclient v0.4.0/go.mod h1:pG8SKDEmpoAAeEIfPgAL8widwOPanue4luEA4pAzrl8=
12241226
github.com/veraison/ccatoken v1.3.2-0.20250512122414-b26aba0635c4 h1:t2GQueIc1SrErZpprs2ll9ETaXln/nOCPVRq7OejzfQ=
12251227
github.com/veraison/ccatoken v1.3.2-0.20250512122414-b26aba0635c4/go.mod h1:vMqdbW4H/8A3oT+24qssuIK3Aefy06XqzTELGg+gWAg=
12261228
github.com/veraison/cmw v0.3.0 h1:Uu+Kf76sGseSBXPY6MIGo6CZAqkUUFDt7r6sBN7sB7k=

scheme/veraison-client/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
GOPKG := github.com/veraison/services/scheme/veraison-client
77
SRCS := $(wildcard *.go)
88

9+
INTERFACES := iveraisonchallengeresponseclient.go
10+
INTERFACES += iveraisondiscoveryclient.go
11+
12+
MOCKPKG := mocks
13+
14+
lint-hook-pre: _mocks
15+
916
SUBDIR += plugin
1017

1118
include ../../mk/common.mk

scheme/veraison-client/README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
1+
# Veraison client plugin
2+
3+
This plugin implements a Veraison API client that requests an appraisal of evidence from a verifier which exposes Veraison's challenge-response and discovery APIs.
4+
5+
VTS can use this plugin in a node running in lead verifier mode when connecting to a downstream verifier, or to itself when the node is running in a hybrid lead/sub mode.
6+
7+
The appraisal request is made in RP mode, which means that the client decides on the nonce to be used to determine the freshness of the supplied evidence.
8+
9+
## Business logic
10+
11+
The plugin is tasked with the following actions:
12+
13+
* Receive component evidence and the nonce from the CE handler.
14+
* Get the verifier's public key and C-R session endpoint by querying the well-known interface.
15+
* Initiate a challenge-response session in RP mode with the configured verifier, supplying the component evidence and nonce.
16+
* Obtain an EAR from the verifier.
17+
* Verify the signature of the EAR.
18+
* Return the EAR appraisal to the CE Handler.
19+
20+
## Configuration
21+
22+
The clientCfg parameter supplied by the VTS contains the relevant connectivity and trust settings as a serialised JSON byte string.
23+
24+
When de-serialised, the JSON object contains the following keys:
25+
26+
* "url" (mandatory): the verifier’s discovery URL
27+
* "ca-certs" (optional): one or more files containing the trust anchors used to authenticate server certificates
28+
* "insecure" (optional): whether certificate verification can skip the trust-related settings
29+
30+
Example:
31+
```json
32+
{
33+
"url": "https://downstream-verifier.example:8443/.well-known/veraison/verification",
34+
"ca-certs": [ "/path/to/ca1.pem", "/path/to/ca2.pem" ]
35+
}
36+
```
37+
138
:warning: :construction: :warning:
239

340
Please note that this code is currently in an experimental phase and has not yet been tested as part of the integration test suite.
441
It may stop working at any time without warning.
542
If you encounter an issue, please report it as a [bug](https://github.com/veraison/services/issues/new?template=bug-report.md).
643

7-
:warning: :construction: :warning:
44+
:warning: :construction: :warning:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2026 Contributors to the Veraison project.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package veraisonclient
5+
6+
import "github.com/veraison/apiclient/verification"
7+
8+
// IVeraisonChallengeResponseClient is an interface for dealing with Veraison's
9+
// apiclient/verification ChallengeResponseConfig objects
10+
type IVeraisonChallengeResponseClient interface {
11+
Run() ([]byte, error)
12+
SetNonce(nonce []byte) error
13+
SetSessionURI(u string) error
14+
SetEvidenceBuilder(eb verification.EvidenceBuilder) error
15+
SetDeleteSession(v bool)
16+
SetNonceSz(nonceSz uint) error
17+
SetIsInsecure(v bool)
18+
SetCerts(paths []string)
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2026 Contributors to the Veraison project.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package veraisonclient
5+
6+
import "github.com/veraison/apiclient/verification"
7+
8+
// IVeraisonDiscoveryClient is an interface for dealing with Veraison's
9+
// // apiclient/verification discovery objects
10+
type IVeraisonDiscoveryClient interface {
11+
Run() (*verification.DiscoveryObject, error)
12+
SetDiscoveryURI(u string) error
13+
SetIsInsecure()
14+
SetCerts(paths []string) error
15+
}

scheme/veraison-client/mocks/mock_iveraisonchallengeresponseclient.go

Lines changed: 142 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scheme/veraison-client/mocks/mock_iveraisondiscoveryclient.go

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scheme/veraison-client/plugin/combined/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Contributors to the Veraison project.
1+
// Copyright 2026 Contributors to the Veraison project.
22
// SPDX-License-Identifier: Apache-2.0
33

44
package main

scheme/veraison-client/plugin/component-verifier-client-handler/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2025 Contributors to the Veraison project.
1+
// Copyright 2026 Contributors to the Veraison project.
22
// SPDX-License-Identifier: Apache-2.0
33

44
package main

0 commit comments

Comments
 (0)