Skip to content

Commit c7a63d8

Browse files
abhiraj-kusetrofim
authored andcommitted
feat!: refresh PSA templates and CBOR fixtures
Updated PSA reference value templates in CoMID and CoRIM to align with the latest specifications. Regenerated CBOR test fixtures and bumped the CoRIM dependency version. All templates and fixtures now reflect the updated PSA profile structure. BREAKING CHANGE: PSA reference value CBOR files generated with previous CoRIM versions are no longer compatible. Applications must regenerate CBOR payloads using the updated templates. Signed-off-by: Abhishek kumar <abhirajabhi312@gmail.com>
1 parent e43cab0 commit c7a63d8

24 files changed

Lines changed: 306 additions & 240 deletions

.github/workflows/ci-go-cover.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
uses: actions/checkout@v2
3232
- name: Install mockgen
3333
run: |
34-
go install github.com/golang/mock/mockgen@v1.5.0
34+
go install go.uber.org/mock/mockgen@v0.6.0
3535
- name: Go Coverage
3636
run: |
3737
go version

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
fetch-depth: 1
2222
- name: Install mockgen
2323
run: |
24-
go install github.com/golang/mock/mockgen@v1.5.0
24+
go install go.uber.org/mock/mockgen@v0.6.0
2525
- name: Build project
2626
run: go build ./...
2727
- name: Run tests

.github/workflows/linters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.1.6
2020
- name: Install mockgen
2121
run: |
22-
go install github.com/golang/mock/mockgen@v1.5.0
22+
go install go.uber.org/mock/mockgen@v0.6.0
2323
- name: Run required linters in .golangci.yml plus hard-coded ones here
2424
run: make lint

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,9 @@ Further, it is required to supply the media type of the content via the
556556
`--media-type` switch (abbrev. `-m`)
557557
```
558558
$ cocli corim submit \
559-
--corim-file data/corim/unsigned-corim.cbor \
560-
--api-server "https://veraison.example/endorsement-provisioning/v1/submit" \
561-
--media-type "application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1"
559+
--corim-file data/corim/unsigned-corim.cbor \
560+
--api-server "https://veraison.example/endorsement-provisioning/v1/submit" \
561+
--media-type "application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0"
562562
563563
>> "unsigned-corim.cbor" submit ok
564564
```

cmd/comidCreate_test.go

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

44
package cmd
@@ -9,7 +9,6 @@ import (
99
"github.com/spf13/afero"
1010
"github.com/stretchr/testify/assert"
1111
"github.com/stretchr/testify/require"
12-
"github.com/veraison/corim/comid"
1312
"github.com/veraison/corim/profiles/tdx"
1413
)
1514

@@ -87,7 +86,7 @@ func Test_ComidCreateCmd_template_from_file_to_default_dir(t *testing.T) {
8786
cmd := NewComidCreateCmd()
8887

8988
fs = afero.NewMemMapFs()
90-
err = afero.WriteFile(fs, "ok.json", []byte(comid.PSARefValJSONTemplate), 0644)
89+
err = afero.WriteFile(fs, "ok.json", testComidTemplate, 0644)
9190
require.NoError(t, err)
9291

9392
args := []string{
@@ -110,7 +109,7 @@ func Test_ComidCreateCmd_template_from_dir_to_custom_dir(t *testing.T) {
110109
cmd := NewComidCreateCmd()
111110

112111
fs = afero.NewMemMapFs()
113-
err = afero.WriteFile(fs, "testdir/ok.json", []byte(comid.PSARefValJSONTemplate), 0644)
112+
err = afero.WriteFile(fs, "testdir/ok.json", testComidTemplate, 0644)
114113
require.NoError(t, err)
115114

116115
args := []string{

cmd/corimSubmit.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021-2024 Contributors to the Veraison project.
1+
// Copyright 2021-2026 Contributors to the Veraison project.
22
// SPDX-License-Identifier: Apache-2.0
33

44
package cmd
@@ -36,14 +36,14 @@ func NewCorimSubmitCmd(submitter ISubmitter) *cobra.Command {
3636
Long: `submit a CBOR-encoded CoRIM payload with supplied media type to the given API Server
3737
3838
To submit the CBOR-encoded CoRIM from file "unsigned-corim.cbor" with media type
39-
"application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1" to the Veraison
39+
"application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0" to the Veraison
4040
provisioning API endpoint "https://veraison.example/endorsement-provisioning/v1", do:
4141
4242
4343
cocli corim submit \
4444
--corim-file=unsigned-corim.cbor \
4545
--api-server="https://veraison.example/endorsement-provisioning/v1/submit" \
46-
--media-type="application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1"
46+
--media-type="application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0"
4747
`,
4848

4949
RunE: func(cmd *cobra.Command, args []string) error {

cmd/corimSubmit_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021-2024 Contributors to the Veraison project.
1+
// Copyright 2021-2026 Contributors to the Veraison project.
22
// SPDX-License-Identifier: Apache-2.0
33

44
package cmd
@@ -7,11 +7,11 @@ import (
77
"errors"
88
"testing"
99

10-
"github.com/golang/mock/gomock"
1110
"github.com/spf13/afero"
1211
"github.com/stretchr/testify/assert"
1312
"github.com/stretchr/testify/require"
1413
mock_deps "github.com/veraison/cocli/cmd/mocks"
14+
"go.uber.org/mock/gomock"
1515
)
1616

1717
func Test_CorimSubmitCmd_bad_server_url(t *testing.T) {
@@ -24,7 +24,7 @@ func Test_CorimSubmitCmd_bad_server_url(t *testing.T) {
2424
args := []string{
2525
"--corim-file=corim.cbor",
2626
"--api-server=http://www.example.com:80index",
27-
"--media-type=application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1",
27+
"--media-type=application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0",
2828
}
2929
cmd.SetArgs(args)
3030

@@ -45,7 +45,7 @@ func Test_CorimSubmitCmd_missing_server_url(t *testing.T) {
4545

4646
args := []string{
4747
"--corim-file=corim.cbor",
48-
"--media-type=application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1",
48+
"--media-type=application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0",
4949
}
5050
cmd.SetArgs(args)
5151

@@ -90,7 +90,7 @@ func Test_CorimSubmitCmd_missing_corim_file(t *testing.T) {
9090
args := []string{
9191
"--corim-file=",
9292
"--api-server=http://www.example.com:8080",
93-
"--media-type=application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1",
93+
"--media-type=application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0",
9494
}
9595
cmd.SetArgs(args)
9696

@@ -109,7 +109,7 @@ func Test_CorimSubmitCmd_non_existent_corim_file(t *testing.T) {
109109
args := []string{
110110
"--corim-file=bad.cbor",
111111
"--api-server=http://www.example.com:8080",
112-
"--media-type=application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1",
112+
"--media-type=application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0",
113113
}
114114
cmd.SetArgs(args)
115115

@@ -127,7 +127,7 @@ func Test_CorimSubmitCmd_submit_ok(t *testing.T) {
127127
args := []string{
128128
"--corim-file=corim.cbor",
129129
"--api-server=http://veraison.example/endorsement-provisioning/v1/submit",
130-
"--media-type=application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1",
130+
"--media-type=application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0",
131131
}
132132
cmd.SetArgs(args)
133133

@@ -139,7 +139,7 @@ func Test_CorimSubmitCmd_submit_ok(t *testing.T) {
139139
ms.EXPECT().SetIsInsecure(false)
140140
ms.EXPECT().SetCerts([]string{})
141141
ms.EXPECT().SetDeleteSession(true)
142-
ms.EXPECT().Run(testSignedCorimValid, "application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1").Return(nil)
142+
ms.EXPECT().Run(testSignedCorimValid, "application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0").Return(nil)
143143
err = cmd.Execute()
144144
assert.NoError(t, err)
145145
}
@@ -154,7 +154,7 @@ func Test_CorimSubmitCmd_submit_not_ok(t *testing.T) {
154154
args := []string{
155155
"--corim-file=corim.cbor",
156156
"--api-server=http://veraison.example/endorsement-provisioning/v1/submit",
157-
"--media-type=application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1",
157+
"--media-type=application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0",
158158
}
159159
cmd.SetArgs(args)
160160

@@ -168,7 +168,7 @@ func Test_CorimSubmitCmd_submit_not_ok(t *testing.T) {
168168
ms.EXPECT().SetDeleteSession(true)
169169
err = errors.New(`unexpected HTTP response code 404`)
170170

171-
ms.EXPECT().Run(testSignedCorimValid, "application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1").Return(err)
171+
ms.EXPECT().Run(testSignedCorimValid, "application/corim-unsigned+cbor; profile=tag:arm.com,2025:psa#1.0.0").Return(err)
172172
err = cmd.Execute()
173173
assert.EqualError(t, err, "submit CoRIM payload failed reason: run failed: unexpected HTTP response code 404")
174174
}

cmd/test_vars.go

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

44
package cmd
@@ -13,6 +13,9 @@ var (
1313
minimalCorimTemplate = []byte(`{
1414
"corim-id": "5c57e8f4-46cd-421b-91c9-08cf93e13cfc"
1515
}`)
16+
17+
//go:embed testcases/test-comid.json
18+
testComidTemplate []byte
1619
badCBOR = comid.MustHexDecode(nil, "ffff")
1720
// a "tag-id only" CoMID {1: {0: h'366D0A0A598845ED84882F2A544F6242'}}
1821
invalidComid = comid.MustHexDecode(nil,

cmd/testcases/psa-refval.cbor

86 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)