Skip to content

Commit e810969

Browse files
authored
Merge pull request #487 from fluxcd/sha256-backport
storage: change Artifact checksum to SHA256
2 parents f3f7193 + fb688ff commit e810969

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

api/v1beta1/artifact_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type Artifact struct {
3939
// +optional
4040
Revision string `json:"revision"`
4141

42-
// Checksum is the SHA1 checksum of the artifact.
42+
// Checksum is the SHA256 checksum of the artifact.
4343
// +optional
4444
Checksum string `json:"checksum"`
4545

config/crd/bases/source.toolkit.fluxcd.io_buckets.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ spec:
9999
description: Artifact represents the output of the last successful Bucket sync.
100100
properties:
101101
checksum:
102-
description: Checksum is the SHA1 checksum of the artifact.
102+
description: Checksum is the SHA256 checksum of the artifact.
103103
type: string
104104
lastUpdateTime:
105105
description: LastUpdateTime is the timestamp corresponding to the last update of this artifact.

config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ spec:
154154
description: Artifact represents the output of the last successful repository sync.
155155
properties:
156156
checksum:
157-
description: Checksum is the SHA1 checksum of the artifact.
157+
description: Checksum is the SHA256 checksum of the artifact.
158158
type: string
159159
lastUpdateTime:
160160
description: LastUpdateTime is the timestamp corresponding to the last update of this artifact.
@@ -223,7 +223,7 @@ spec:
223223
description: Artifact represents the output of a source synchronisation.
224224
properties:
225225
checksum:
226-
description: Checksum is the SHA1 checksum of the artifact.
226+
description: Checksum is the SHA256 checksum of the artifact.
227227
type: string
228228
lastUpdateTime:
229229
description: LastUpdateTime is the timestamp corresponding to the last update of this artifact.

config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ spec:
116116
description: Artifact represents the output of the last successful chart sync.
117117
properties:
118118
checksum:
119-
description: Checksum is the SHA1 checksum of the artifact.
119+
description: Checksum is the SHA256 checksum of the artifact.
120120
type: string
121121
lastUpdateTime:
122122
description: LastUpdateTime is the timestamp corresponding to the last update of this artifact.

config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ spec:
8383
description: Artifact represents the output of the last successful repository sync.
8484
properties:
8585
checksum:
86-
description: Checksum is the SHA1 checksum of the artifact.
86+
description: Checksum is the SHA256 checksum of the artifact.
8787
type: string
8888
lastUpdateTime:
8989
description: LastUpdateTime is the timestamp corresponding to the last update of this artifact.

controllers/storage.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package controllers
1919
import (
2020
"archive/tar"
2121
"compress/gzip"
22-
"crypto/sha1"
22+
"crypto/sha256"
2323
"fmt"
2424
"hash"
2525
"io"
@@ -421,7 +421,7 @@ func (s *Storage) Symlink(artifact sourcev1.Artifact, linkName string) (string,
421421
return url, nil
422422
}
423423

424-
// Checksum returns the SHA1 checksum for the data of the given io.Reader as a string.
424+
// Checksum returns the SHA256 checksum for the data of the given io.Reader as a string.
425425
func (s *Storage) Checksum(reader io.Reader) string {
426426
h := newHash()
427427
_, _ = io.Copy(h, reader)
@@ -447,7 +447,7 @@ func (s *Storage) LocalPath(artifact sourcev1.Artifact) string {
447447
return path
448448
}
449449

450-
// newHash returns a new SHA1 hash.
450+
// newHash returns a new SHA256 hash.
451451
func newHash() hash.Hash {
452-
return sha1.New()
452+
return sha256.New()
453453
}

docs/api/source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ string
856856
</td>
857857
<td>
858858
<em>(Optional)</em>
859-
<p>Checksum is the SHA1 checksum of the artifact.</p>
859+
<p>Checksum is the SHA256 checksum of the artifact.</p>
860860
</td>
861861
</tr>
862862
<tr>

0 commit comments

Comments
 (0)