Skip to content

Commit 3a5291e

Browse files
committed
Merge branch 'master' into cleanup
2 parents 3f371ee + e2bb44a commit 3a5291e

File tree

8 files changed

+23
-19
lines changed

8 files changed

+23
-19
lines changed

README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
[![Go Report Card](https://goreportcard.com/badge/github.com/Senetas/crypto-cli)](https://goreportcard.com/report/github.com/Senetas/crypto-cli)
2+
[![license](https://img.shields.io/badge/license-Apache-blue.svg?style=flat)](https://raw.githubusercontent.com/Senetas/crypto-cli/master/LICENSE)
3+
14
# Crypto-Cli
25

3-
A command line utility to push and pull encrypted docker images. This is in the pre-alpha proof of concept stage and is not indented for any use other than to prove that Docker Hub may be used to distribute encrypted docker images. Currently, it only runs on Linux with Linux images. See also the privacy section below.
6+
A command line utility to push and pull encrypted docker images. Currently, it only runs on Linux with Linux images. See also the privacy section below.
47

58
## Warning
6-
This application is not suitable for use in a production environment. There are no guarantees as to the security of these implementations. Use at your own risk.
9+
This application is not suitable for use in a production environment. There are no guarantees as to the security of these implementations. Use at your own risk...that being said we make a concerted effort on the crypto side. See the cryptography section below.
10+
11+
## Issues
12+
Don't try to pull an encrypted image with `docker pull`, it will fail.
713

814
## License
915
Apache 2.0
@@ -43,12 +49,12 @@ For example, in the following Dockerfile:
4349
```Dockerfile
4450
FROM alpine:latest
4551
LABEL "com.senetas.crypto.enabled"="true"
46-
RUN echo "hello" > file.txt
52+
RUN echo "some secret" > secret-file.txt
4753
LABEL "com.senetas.crypto.enabled"="false"
48-
RUN rm file.txt
54+
RUN echo "some not secret" > not-secret-file.txt
4955
ENTRYPOINT ["/bin/sh"]
5056
```
51-
only the layer resulting from the command `RUN echo "hello" > file.txt` will be encrypted.
57+
only the layer resulting from the command `RUN echo "some secret" > secret-file.txt` will be encrypted.
5258

5359
Note that although in general a `LABEL` line may contain multiple labels, this is not supported for the `com.senetas.crypto.enabled` label for the purposes of this application.
5460

cmd/pull.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var pullCmd = &cobra.Command{
3030
Use: "pull [OPTIONS] NAME[:TAG]",
3131
Short: "Download an image from a remote repository, decrypting if necessary.",
3232
Long: `pull is used to download an image from a repository, decrypt it if necessary and
33-
load that images into the local docker engine. It is then avaliable to be run under the same
33+
load that images into the local docker engine. It is then available to be run under the same
3434
name as it was downloaded.`,
3535
RunE: func(cmd *cobra.Command, args []string) error {
3636
cmd.Flags().VisitAll(checkFlagsPull)

crypto/algos.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ type versionData struct {
3838
nonceLength int
3939
}
4040

41-
var (
42-
versionDataStore = map[int]versionData{0: versionData{saltLength: 16, nonceLength: 12}}
43-
)
41+
var versionDataStore = map[int]versionData{0: {saltLength: 16, nonceLength: 12}}
4442

4543
// ValidateAlgos converts a string to valid Algos if possible
4644
func ValidateAlgos(ctstr string) (Algos, error) {

distribution/blob.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Blob interface {
3333
ReadCloser() (io.ReadCloser, error)
3434
}
3535

36-
// NoncryptedBlob is a vanilla blob with no encrpytion data
36+
// NoncryptedBlob is a vanilla blob with no encryption data
3737
// Despite appearnces, the MediaType type is not indicative of whether
3838
// the blob is compressed or not
3939
type NoncryptedBlob struct {

distribution/manifest.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func mkBlobs(
311311

312312
// read the archive manifest
313313
// manifestfile consists of information that is local to the os, or supplied by the user or the
314-
// docker daemon. Thus, assuming they are not comprimised, it is safe to open
314+
// docker daemon. Thus, assuming they are not compromised, it is safe to open
315315
manifestfile := filepath.Join(path, "manifest.json")
316316
manifestFH, err := os.Open(manifestfile) // #nosec
317317
defer func() { err = utils.CheckedClose(manifestFH, err) }()
@@ -406,7 +406,7 @@ func pbkdf2Aes256GcmEncrypt(
406406
// note its error are not wraped
407407
func fileDigest(filename string) (d digest.Digest, err error) {
408408
// filename consists of information that is local to the os or the docker
409-
// daemon. Thus assuming they are not comprimised, it is safe to open
409+
// daemon. Thus assuming they are not compromised, it is safe to open
410410
fh, err := os.Open(filename) // #nosec
411411
defer func() { err = utils.CheckedClose(fh, err) }()
412412
if err != nil {

registry/pull.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func PullImage(
5555
if err != nil {
5656
return nil, err
5757
}
58-
log.Info().Msg("Mainfest obtained.")
58+
log.Info().Msg("Manifest obtained.")
5959

6060
if err = manifest.DecryptKeys(ref, opts); err != nil {
6161
return
@@ -147,7 +147,7 @@ func PullManifest(
147147
return manifest, nil
148148
}
149149

150-
// PullFromDigest downloads a blob (refereced by its digest) from the registry to a temporay file.
150+
// PullFromDigest downloads a blob (refereced by its digest) from the registry to a temporary file.
151151
// It verifies that the downloaded file matches its digest, deleting if it does not. While the
152152
// digest is used to name the file, it is first verified to be a valid digest, so this cannot lead
153153
// to a file inclusion vulrenability.
@@ -233,7 +233,7 @@ func download(
233233
err = processResp(resp, d, fn, fh, timer)
234234
}
235235

236-
// processResp handles the responce to the request to download a blob
236+
// processResp handles the response to the request to download a blob
237237
// includeing: downloading any data, time handling, verifying that the
238238
// download matches the expected digest
239239
func processResp(

utils/io.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"golang.org/x/text/unicode/rangetable"
2424
)
2525

26-
// CounterWriter is a writer that counts the number bytes writen to it
26+
// CounterWriter is a writer that counts the number bytes written to it
2727
type CounterWriter struct {
2828
io.Writer
2929
Count int

utils/utils_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ func TestConcat(t *testing.T) {
6767
out []byte
6868
}{
6969
{[][]byte{[]byte("3.14"), []byte("159")}, []byte("3.14159")},
70-
{[][]byte{[]byte{}, []byte("159")}, []byte("159")},
71-
{[][]byte{[]byte("3.14"), []byte{}}, []byte("3.14")},
72-
{[][]byte{[]byte{}, []byte{}}, []byte{}},
70+
{[][]byte{{}, []byte("159")}, []byte("159")},
71+
{[][]byte{[]byte("3.14"), {}}, []byte("3.14")},
72+
{[][]byte{{}, {}}, []byte{}},
7373
{[][]byte{[]byte("3.14"), []byte("159"), []byte("265")}, []byte("3.14159265")},
7474
}
7575

0 commit comments

Comments
 (0)