-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: cosign verifier #10
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Juncheng Zhu <[email protected]>
dce27bf
to
b51ac18
Compare
Signed-off-by: Juncheng Zhu <[email protected]>
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (38.24%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
|
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
05d3557
to
59240a2
Compare
Signed-off-by: Juncheng Zhu <[email protected]>
59240a2
to
f0aaace
Compare
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
513e55b
to
db55766
Compare
Signed-off-by: Juncheng Zhu <[email protected]>
db55766
to
7a13f1c
Compare
cosign/truststore.go
Outdated
certChains map[string][]*x509.Certificate | ||
} | ||
|
||
func NewWithOpts(opts *VerifierOptions) TrustStore { |
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.
NewTrustStore
?
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.
does opts get used?
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.
A1: Shall we rename or create a new package for this structure?
A2: I would read input from opts
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.
use NewTrustStore
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.
Updated
cosign/truststore.go
Outdated
} | ||
|
||
func (t *TrustStoreImp) GetVerifyOpts(subjectRef string) (*VOptions, error) { | ||
return t.optsMap[subjectRef], nil |
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.
should we return err if it's not existing.
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.
skip
49149f1
to
9c25283
Compare
Signed-off-by: Juncheng Zhu <[email protected]>
9c25283
to
fd733b2
Compare
Gonna update the remote branch to apply those newly merged changes. |
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
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.
could you briefly explain how to support distinguish cert/keys for different repos/registries.
} | ||
|
||
type verifyContextOptions struct { | ||
optsMap map[string]*VerifyContext |
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.
the map seems mapping a digested reference to a context, which means users need to configure the context for each artifact that will be validated. It would be a huge work for users. Does all options in this VerifyContext
vary for each artifact?
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.
Would it be better to have a mapping function
return nil, v1.Hash{}, fmt.Errorf("unable to locate reference with artifactType %s", artifactTypeCosign) | ||
} | ||
|
||
signatureDesc := signatureDescriptors[numResults-1] |
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.
seems it's an experimental feature for cosign, probably we still need to support the main user scenario. cc: @shizhMSFT
GetVerifyOpts(subjectRef string) (*VerifyContext, error) | ||
} | ||
|
||
type verifyContextOptions struct { |
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.
we should either expose it or have a constructor to create it with values.
) | ||
|
||
// VerifyContext holds the options for verifying a context. | ||
type VerifyContext struct { |
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.
we could remove some options if they are not required in this PR
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.
Those ones are filtered and indeed used in this PR.
I would keep an eye on the changes based on the change of PR
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.
I would request a markdown of the design. Otherwise, it is too difficult to understand. Please provide an outline first, and then fill in the details.
cosign/go.mod
Outdated
|
||
go 1.23.4 | ||
|
||
toolchain go1.23.6 |
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.
need to remove
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.
resolved
cosign/truststore.go
Outdated
IgnoreSCT bool | ||
} | ||
|
||
type TrustStoreImp struct { |
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.
rename Imp
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.
resolved
cosign/truststore.go
Outdated
certChains map[string][]*x509.Certificate | ||
} | ||
|
||
func NewWithOpts(opts *VerifierOptions) TrustStore { |
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.
use NewTrustStore
cosign/truststore.go
Outdated
} | ||
|
||
func (t *TrustStoreImp) GetVerifyOpts(subjectRef string) (*VOptions, error) { | ||
return t.optsMap[subjectRef], nil |
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.
skip
} | ||
|
||
type verifyContextOptions struct { | ||
optsMap map[string]*VerifyContext |
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.
Would it be better to have a mapping function
cosign/verifier.go
Outdated
Verifier: v, | ||
} | ||
// TODO: update verify result | ||
_, err = cosign.VerifyImageSignature(ctx, sig, signatureDescHash, checkOpts) |
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.
You are right, We should also consider cases that fail to verify but no error.
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
Signed-off-by: Juncheng Zhu <[email protected]>
c3897f5
to
da7e072
Compare
Signed-off-by: Juncheng Zhu <[email protected]>
Convert to draft as a PoC |
What this PR does / why we need it:
Added design document
Implement cosign verifier
truststore
mapping, includingkeys
,certificates
, andcertchains
for verificationVerfierOptions
, is for verifier creatation andVerifyOption
andVerifyContext
for verificationWhich issue(s) this PR resolves
Resolves #39
Please check the following list: