Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rekor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SafSec
rekor
Commits
317e88db
Unverified
Commit
317e88db
authored
3 years ago
by
Andrew Block
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Correct Helm index keys (#474)
Signed-off-by:
Andrew Block
<
andy.block@gmail.com
>
parent
0c2b37c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pkg/types/helm/provenance_test.go
+6
-1
6 additions, 1 deletion
pkg/types/helm/provenance_test.go
pkg/types/helm/providence.go
+5
-5
5 additions, 5 deletions
pkg/types/helm/providence.go
pkg/types/helm/v0.0.1/entry.go
+5
-8
5 additions, 8 deletions
pkg/types/helm/v0.0.1/entry.go
with
16 additions
and
14 deletions
pkg/types/helm/provenance_test.go
+
6
−
1
View file @
317e88db
...
...
@@ -20,6 +20,7 @@ import (
"os"
"testing"
"github.com/sigstore/rekor/pkg/generated/models"
"github.com/sigstore/rekor/pkg/pki"
"github.com/sigstore/rekor/pkg/pki/pgp"
)
...
...
@@ -37,12 +38,16 @@ func TestProvenance(t *testing.T) {
t
.
Fatalf
(
"unmarshal error: %v"
,
err
)
}
checksum
,
err
:=
provenance
.
GetChartHash
()
algorithm
,
checksum
,
err
:=
provenance
.
GetChart
Algorithm
Hash
()
if
err
!=
nil
{
t
.
Fatalf
(
"Error retrieving chart hash: %v"
,
err
)
}
if
models
.
HelmV001SchemaChartHashAlgorithmSha256
!=
algorithm
{
t
.
Fatalf
(
"Unexpected checksum algorithm. Expected %s, found %s"
,
models
.
HelmV001SchemaChartHashAlgorithmSha256
,
algorithm
)
}
if
len
(
checksum
)
==
0
{
t
.
Fatal
(
"Empty checksum"
)
}
...
...
This diff is collapsed.
Click to expand it.
pkg/types/helm/providence.go
+
5
−
5
View file @
317e88db
...
...
@@ -94,10 +94,10 @@ func (p *Provenance) parseMessageBlock(data []byte) error {
return
nil
}
func
(
p
*
Provenance
)
GetChart
Hash
()
(
string
,
error
)
{
func
(
p
*
Provenance
)
GetChart
AlgorithmHash
()
(
string
,
string
,
error
)
{
if
p
.
SumCollection
==
nil
||
p
.
SumCollection
.
Files
==
nil
{
return
""
,
errors
.
New
(
"Unable to locate chart hash"
)
return
""
,
""
,
errors
.
New
(
"Unable to locate chart hash"
)
}
...
...
@@ -108,13 +108,13 @@ func (p *Provenance) GetChartHash() (string, error) {
parts
:=
strings
.
Split
(
value
,
":"
)
if
len
(
parts
)
!=
2
{
return
""
,
errors
.
New
(
"Invalid hash found in Provenance file"
)
return
""
,
""
,
errors
.
New
(
"Invalid hash found in Provenance file"
)
}
return
parts
[
1
],
nil
return
parts
[
0
],
parts
[
1
],
nil
}
// Return error if no keys found
return
""
,
errors
.
New
(
"No checksums found"
)
return
""
,
""
,
errors
.
New
(
"No checksums found"
)
}
This diff is collapsed.
Click to expand it.
pkg/types/helm/v0.0.1/entry.go
+
5
−
8
View file @
317e88db
...
...
@@ -87,16 +87,15 @@ func (v V001Entry) IndexKeys() []string {
result
=
append
(
result
,
v
.
keyObj
.
EmailAddresses
()
...
)
chartHash
,
err
:=
v
.
provenanceObj
.
GetChartHash
()
algorithm
,
chartHash
,
err
:=
v
.
provenanceObj
.
GetChart
Algorithm
Hash
()
if
err
!=
nil
{
log
.
Logger
.
Error
(
err
)
}
else
{
result
=
append
(
result
,
chartHash
)
hashKey
:=
strings
.
ToLower
(
fmt
.
Sprintf
(
"%s:%s"
,
algorithm
,
chartHash
))
result
=
append
(
result
,
hashKey
)
}
//TODO: Store signature as index
return
result
}
...
...
@@ -274,16 +273,14 @@ func (v *V001Entry) Canonicalize(ctx context.Context) ([]byte, error) {
canonicalEntry
.
Chart
=
&
models
.
HelmV001SchemaChart
{}
chartHash
,
err
:=
v
.
provenanceObj
.
GetChartHash
()
algorithm
,
chartHash
,
err
:=
v
.
provenanceObj
.
GetChart
Algorithm
Hash
()
if
err
!=
nil
{
return
nil
,
err
}
sha256
:=
models
.
AlpineV001SchemaPackageHashAlgorithmSha256
canonicalEntry
.
Chart
.
Hash
=
&
models
.
HelmV001SchemaChartHash
{}
canonicalEntry
.
Chart
.
Hash
.
Algorithm
=
&
sha256
canonicalEntry
.
Chart
.
Hash
.
Algorithm
=
&
algorithm
canonicalEntry
.
Chart
.
Hash
.
Value
=
&
chartHash
canonicalEntry
.
Chart
.
Provenance
=
&
models
.
HelmV001SchemaChartProvenance
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment