Skip to content
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

Run codespell on codebase #1841

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ lint:

vendor-in-container:
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src golang go mod tidy

codespell:
codespell -S Makefile,build,buildah,buildah.spec,imgtype,copy,AUTHORS,bin,vendor,.git,go.sum,CHANGELOG.md,changelog.txt,seccomp.json,.cirrus.yml,"*.xz,*.gz,*.tar,*.tgz,*ico,*.png,*.1,*.5,*.orig,*.rej" -L keypair,flate,uint,iff,od,ERRO -w
2 changes: 1 addition & 1 deletion docker/archive/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Writer struct {
archive *tarfile.Writer
writer io.Closer

// The following state can only be acccessed with the mutex held.
// The following state can only be accessed with the mutex held.
mutex sync.Mutex
hadCommit bool // At least one successful commit has happened
}
Expand Down
4 changes: 2 additions & 2 deletions docker/body_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type bodyReader struct {
}

// newBodyReader creates a bodyReader for request path in c.
// firstBody is an already correctly opened body for the blob, returing the full blob from the start.
// firstBody is an already correctly opened body for the blob, returning the full blob from the start.
// If reading from firstBody fails, bodyReader may heuristically decide to resume.
func newBodyReader(ctx context.Context, c *dockerClient, path string, firstBody io.ReadCloser) (io.ReadCloser, error) {
logURL, err := c.resolveRequestURL(path)
Expand Down Expand Up @@ -186,7 +186,7 @@ func (br *bodyReader) Read(p []byte) (int, error) {
return n, fmt.Errorf("%w (after reconnecting, fetching blob: %v)", originalErr, err)
}

logrus.Debugf("Succesfully reconnected to %s", redactedURL)
logrus.Debugf("Successfully reconnected to %s", redactedURL)
consumedBody = true
br.body = res.Body
br.lastRetryOffset = br.offset
Expand Down
2 changes: 1 addition & 1 deletion docker/docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ func (c *dockerClient) getBlob(ctx context.Context, ref dockerReference, info ty
return reconnectingReader, blobSize, nil
}

// getOCIDescriptorContents returns the contents a blob spcified by descriptor in ref, which must fit within limit.
// getOCIDescriptorContents returns the contents a blob specified by descriptor in ref, which must fit within limit.
func (c *dockerClient) getOCIDescriptorContents(ctx context.Context, ref dockerReference, desc imgspecv1.Descriptor, maxSize int, cache types.BlobInfoCache) ([]byte, error) {
// Note that this copies all kinds of attachments: attestations, and whatever else is there,
// not just signatures. We leave the signature consumers to decide based on the MIME type.
Expand Down
2 changes: 1 addition & 1 deletion docker/docker_image_dest.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ func layerMatchesSigstoreSignature(layer imgspecv1.Descriptor, mimeType string,
}

// putBlobBytesAsOCI uploads a blob with the specified contents, and returns an appropriate
// OCI descriptior.
// OCI descriptor.
func (d *dockerImageDestination) putBlobBytesAsOCI(ctx context.Context, contents []byte, mimeType string, options private.PutBlobOptions) (imgspecv1.Descriptor, error) {
blobDigest := digest.FromBytes(contents)
info, err := d.PutBlobWithOptions(ctx, bytes.NewReader(contents),
Expand Down
4 changes: 2 additions & 2 deletions docker/reference/reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// domain := domain-component ['.' domain-component]* [':' port-number]
// domain-component := /([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/
// port-number := /[0-9]+/
// path-component := alpha-numeric [separator alpha-numeric]*
// alpha-numeric := /[a-z0-9]+/
// path-component := alphanumeric [separator alphanumeric]*
// alphanumeric := /[a-z0-9]+/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s a bit attractive to keep this in sync with distribution/distribution/reference.

OTOH we’ve been drifting away quite a bit in the last few months, so that’s non-blocking.

// separator := /[_.]|__|[-]*/
//
// tag := /[\w][\w.-]{0,127}/
Expand Down
2 changes: 1 addition & 1 deletion docs/containers-sigstore-signing-params.yaml.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ In addition, a Rekor server must be specified as well.
### Recording the Signature to a Rekor Transparency Server

This can be combined with either a private key or Fulcio.
It is, pratically speaking, required for Fulcio; it is optional when a static private key is used, but necessary for
It is, practically speaking, required for Fulcio; it is optional when a static private key is used, but necessary for
interoperability with the default configuration of `cosign`.

- `rekorURL`: _URL_
Expand Down
2 changes: 1 addition & 1 deletion internal/image/sourced.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// FromReference returns a types.ImageCloser implementation for the default instance reading from reference.
// If reference poitns to a manifest list, .Manifest() still returns the manifest list,
// If reference points to a manifest list, .Manifest() still returns the manifest list,
// but other methods transparently return data from an appropriate image instance.
//
// The caller must call .Close() on the returned ImageCloser.
Expand Down
2 changes: 1 addition & 1 deletion pkg/blobcache/src.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func streamChunksFromFile(streams chan io.ReadCloser, errs chan error, file io.R
defer file.Close()

for _, c := range chunks {
// Always seek to the desired offest; that way we don’t need to care about the consumer
// Always seek to the desired offset; that way we don’t need to care about the consumer
// not reading all of the chunk, or about the position going backwards.
if _, err := file.Seek(int64(c.Offset), io.SeekStart); err != nil {
errs <- err
Expand Down
2 changes: 1 addition & 1 deletion pkg/compression/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
// Zstd compression.
Zstd = internal.NewAlgorithm(types.ZstdAlgorithmName, types.ZstdAlgorithmName,
[]byte{0x28, 0xb5, 0x2f, 0xfd}, ZstdDecompressor, zstdCompressor)
// ZstdChunked is a Zstd compresion with chunk metadta which allows random access to individual files.
// ZstdChunked is a Zstd compression with chunk metadta which allows random access to individual files.
ZstdChunked = internal.NewAlgorithm(types.ZstdChunkedAlgorithmName, types.ZstdAlgorithmName, /* Note: InternalUnstableUndocumentedMIMEQuestionMark is not ZstdChunkedAlgorithmName */
nil, ZstdDecompressor, compressor.ZstdCompressor)

Expand Down
2 changes: 1 addition & 1 deletion signature/fulcio_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (f *fulcioTrustRoot) verifyFulcioCertificateAtTime(relevantTime time.Time,
// log of approved Fulcio invocations, and it’s not clear where that would come from, especially human users manually
// logging in using OpenID are not going to maintain a record of those actions.
//
// Also, the SCT does not help reveal _what_ was maliciously signed, nor does it protect against malicous signatures
// Also, the SCT does not help reveal _what_ was maliciously signed, nor does it protect against malicious signatures
// by correctly-issued certificates.
//
// So, pragmatically, the ideal design seem to be to only do signatures from a trusted build system (which is, by definition,
Expand Down
4 changes: 2 additions & 2 deletions signature/fulcio_cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/stretchr/testify/require"
)

// asssert that crypto.PublicKey matches the on in certPEM.
// assert that crypto.PublicKey matches the on in certPEM.
func assertPublicKeyMatchesCert(t *testing.T, certPEM []byte, pk crypto.PublicKey) {
pkInterface, ok := pk.(interface {
Equal(x crypto.PublicKey) bool
Expand Down Expand Up @@ -153,7 +153,7 @@ func TestFulcioTrustRootVerifyFulcioCertificateAtTime(t *testing.T) {
}{
{
// OtherName SAN element, with none of the Go-parsed SAN elements present,
// should not be a reason to reject the certficate entirely;
// should not be a reason to reject the certificate entirely;
// but we don’t actually support matching it, so this basically tests that the code
// gets far enough to do subject matching.
name: "OtherName in SAN",
Expand Down
2 changes: 1 addition & 1 deletion signature/internal/rekor_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func TestVerifyRekorSET(t *testing.T) {
// Invalid spec.signature
func(v mSA) { x(v, "spec")["signature"] = nil },
func(v mSA) { x(v, "spec")["signature"] = 1 },
// A spec.signature field is mising
// A spec.signature field is missing
func(v mSA) { delete(x(v, "spec", "signature"), "content") },
func(v mSA) { delete(x(v, "spec", "signature"), "publicKey") },
// Invalid spec.signature.content
Expand Down
2 changes: 1 addition & 1 deletion signature/sigstore/fulcio/fulcio.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func WithFulcioAndPreexistingOIDCIDToken(fulcioURL *url.URL, oidcIDToken string)
// WithFulcioAndDeviceAuthorizationGrantOIDC sets up signing to use a short-lived key and a Fulcio-issued certificate
// based on an OIDC ID token obtained using a device authorization grant (RFC 8628).
//
// interactiveOutput must be directly accesible to a human user in real time (i.e. not be just a log file).
// interactiveOutput must be directly accessible to a human user in real time (i.e. not be just a log file).
func WithFulcioAndDeviceAuthorizationGrantOIDC(fulcioURL *url.URL, oidcIssuerURL *url.URL, oidcClientID, oidcClientSecret string,
interactiveOutput io.Writer) internal.Option {
return func(s *internal.SigstoreSigner) error {
Expand Down