diff --git a/CHANGELOG.md b/CHANGELOG.md index 596271008c..a76be8da1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ ### Httputil - [ed8ffc5](https://github.com/quay/clair/commit/ed8ffc50b56c9b11873f00bb2deb4fba9107ec95): create package and RateLimiter ### Initialize -- [5df82e1](https://github.com/quay/clair/commit/5df82e19e971c67ebdecf3f92682d4ae897db53a): update call to Libindex contstructor +- [5df82e1](https://github.com/quay/clair/commit/5df82e19e971c67ebdecf3f92682d4ae897db53a): update call to Libindex constructor ### Introspection - [ec59a43](https://github.com/quay/clair/commit/ec59a431032713654e2eb7a29ad7c446dd16a490): enable readiness endpoint @@ -111,7 +111,7 @@ - [1ece08f](https://github.com/quay/clair/commit/1ece08f49434828c8c672f08ec45844b99187983): database metrics for notifier - [84ba35f](https://github.com/quay/clair/commit/84ba35f29ee81849cb2f424b3624895f9bd05a79): implement prometheus http ### Local-Dev -- [1c85589](https://github.com/quay/clair/commit/1c85589abdef98b5af8d4f6e2cd9eb5db6a723a0): remove unintented change in config.yaml +- [1c85589](https://github.com/quay/clair/commit/1c85589abdef98b5af8d4f6e2cd9eb5db6a723a0): remove unintended change in config.yaml ### Logging - [9f3d167](https://github.com/quay/clair/commit/9f3d167d5d85d345c7d0ee666be075a545a553f4): move to zlog throughout ### Matcher @@ -200,7 +200,7 @@ ### Clairctl - [835af27](https://github.com/quay/clair/commit/835af272fad49342f51adb4633ff639de3cc14a1): fix and codify import arguments - [b9ef107](https://github.com/quay/clair/commit/b9ef1073ca48ed5ed7caaa3e0fbad03a7d83592c): update import and export online help -- [9883e80](https://github.com/quay/clair/commit/9883e80f331190e60de711b0705e9b37017fc5b1): unifiy config, client handling +- [9883e80](https://github.com/quay/clair/commit/9883e80f331190e60de711b0705e9b37017fc5b1): unify config, client handling ### Config - [dc8ba89](https://github.com/quay/clair/commit/dc8ba8912fa482378ef393aa51b4e9528d2877f2): expose notification summary toggle - [bb3cd66](https://github.com/quay/clair/commit/bb3cd669f66345aaa0fc5df6f502f34922cc069e): add 'omitempty' to 'updaters' config struct for correct marshalling @@ -443,7 +443,7 @@ ### Config - [3ccc6e0](https://github.com/quay/clair/commit/3ccc6e03be0ce1b6c439d5c0649ee785dc7c559f): add support for per-scanner configuration ### Dockerfile -- [5a73cb4](https://github.com/quay/clair/commit/5a73cb49d64e839d7675979b5e3f348d94dd26a5): make -mod=vendor opportunisitic ([#999](https://github.com/quay/clair/issues/999)) +- [5a73cb4](https://github.com/quay/clair/commit/5a73cb49d64e839d7675979b5e3f348d94dd26a5): make -mod=vendor opportunistic ([#999](https://github.com/quay/clair/issues/999)) - [#999](https://github.com/quay/clair/issues/999)### Dockerfile: Update To Alpine - [de32b07](https://github.com/quay/clair/commit/de32b0728ccdbafb85988e2f87618c9d576fc87e): 3.11 for newest rpm ### Go.Mod @@ -480,7 +480,7 @@ ### Config - [b2666e5](https://github.com/quay/clair/commit/b2666e57202d7c690a40d7c86975c13e0b3db56e): set a canonical default port ### Dockerfile -- [33da12a](https://github.com/quay/clair/commit/33da12a3bb9a28fdbcc6302caa4212d38a2acbbb): run as unprivledged user by default +- [33da12a](https://github.com/quay/clair/commit/33da12a3bb9a28fdbcc6302caa4212d38a2acbbb): run as unprivileged user by default ### Documentation - [fe324a5](https://github.com/quay/clair/commit/fe324a58e6be8c36da74afcd5487d0da4a547d5b): start writing v4-specific docs ### Httptransport @@ -647,7 +647,7 @@ - [162e8cd](https://github.com/quay/clair/commit/162e8cdafc66be28b021f83da736a2b612ddda99): enable suse updater - [0609ed9](https://github.com/quay/clair/commit/0609ed964b0673806462a24147e6028da85d8a38): removed worker config - [af2c688](https://github.com/quay/clair/commit/af2c68863482ae9f93a2db1533be260468a6ea2d): not properly loaded error ([#140](https://github.com/quay/clair/issues/140)) - - [#140](https://github.com/quay/clair/issues/140) - fixes [#134](https://github.com/quay/clair/issues/134)- [30055af](https://github.com/quay/clair/commit/30055af03e357b44cfbacb3088eab337a94e51e8): fallover correctly to default config + - [#140](https://github.com/quay/clair/issues/140) - fixes [#134](https://github.com/quay/clair/issues/134)- [30055af](https://github.com/quay/clair/commit/30055af03e357b44cfbacb3088eab337a94e51e8): failover correctly to default config - [20af787](https://github.com/quay/clair/commit/20af78743774b18795cbf5210cc97cc172b1880d): fix default fallback - [4fc32d2](https://github.com/quay/clair/commit/4fc32d22713a47eabf5b12b81897fdd34d59935b): add top-level YAML namespace 'clair' - Fixes [#95](https://github.com/quay/clair/issues/95)- [bb7745f](https://github.com/quay/clair/commit/bb7745f3fe21e85b5fe37919e11d6d121e08b9a1): better document example @@ -773,7 +773,7 @@ - [627b98e](https://github.com/quay/clair/commit/627b98ef3126d517d3e80aef4c2ab9ed3d14b893): fix SQL error reporting ### Db/Pgsql/Migration - [8df8170](https://github.com/quay/clair/commit/8df8170ba54d945cf2e2ad201bcdb8cc09fddc06): convert to pure SQL -### Dckerfile +### Dockerfile - [80f150f](https://github.com/quay/clair/commit/80f150f93bf3b12e6c9bcea2d71ccfa956bd50c9): Add docker-compose.yml ### Detectors/Feature - [fc908e6](https://github.com/quay/clair/commit/fc908e65ba6c0ad3edb344cfb263adff8efe6f4e): add apk feature detector @@ -984,7 +984,7 @@ - [eeb13a0](https://github.com/quay/clair/commit/eeb13a02baa5db60b997454af8f059a6381f42da): add index on Vulnerability_Notification.deleted_at - [7cff31a](https://github.com/quay/clair/commit/7cff31a058230a94838b7fd8493380d444c31f5a): add ldfv compound index ### Pkg -- [c3904c9](https://github.com/quay/clair/commit/c3904c9696bddc20a27db9b4142ae704350bbe3f): Add fsutil to contian file system utility functions +- [c3904c9](https://github.com/quay/clair/commit/c3904c9696bddc20a27db9b4142ae704350bbe3f): Add fsutil to contain file system utility functions - [78cef02](https://github.com/quay/clair/commit/78cef02fdad4afd12a2a00df51d457c796278bfa): cerrors -> commonerr - [03bac0f](https://github.com/quay/clair/commit/03bac0f1b6f504a416937e309a62fdfc308dc397): utils/tar.go -> pkg/tarutil ### Pkg/Gitutil diff --git a/Documentation/concepts/api_internal.md b/Documentation/concepts/api_internal.md index 4abf673c4f..c8b2c99887 100644 --- a/Documentation/concepts/api_internal.md +++ b/Documentation/concepts/api_internal.md @@ -11,14 +11,14 @@ Further information and usage is an effort left to the reader. ## Updates Diffs The `update_diff/` endpoint exposes the api for diffing two update operations. -This is used by the notifier to determine the added and removed vulnerabilities on security databsae update. +This is used by the notifier to determine the added and removed vulnerabilities on security database update. ## Update Operation The `update_operation` endpoint exposes the api for viewing updaters' activity. -This is used by the notifier to determine if new updates have occured and triggers an update diff to see what has changed. +This is used by the notifier to determine if new updates have occurred and triggers an update diff to see what has changed. ## AffectedManifest -The `affected_manifest` endpoint exposes the api for retreiving affected manifests given a list of Vulnerabilities. +The `affected_manifest` endpoint exposes the api for retrieving affected manifests given a list of Vulnerabilities. This is used by the notifier to determine the manifests that need to have a notification generated. diff --git a/Documentation/concepts/indexing.md b/Documentation/concepts/indexing.md index 50227f936b..f1beccb01a 100644 --- a/Documentation/concepts/indexing.md +++ b/Documentation/concepts/indexing.md @@ -1,6 +1,6 @@ # Indexing -The [Indexer](../reference/indexer.md) service is responsble for "indexing a manifest". +The [Indexer](../reference/indexer.md) service is responsible for "indexing a manifest". Indexing involves taking a manifest representing a container image and computing its constituent parts. The indexer is trying to discover what packages exist in the image, what distribution the image is derived from, and what package repositories are used within the image. Once this information is computed it is persisted in an IndexReport. diff --git a/Documentation/concepts/notifications.md b/Documentation/concepts/notifications.md index db80a4fb76..14618437f4 100644 --- a/Documentation/concepts/notifications.md +++ b/Documentation/concepts/notifications.md @@ -2,7 +2,7 @@ ClairV4 implements a notification system. -The notifier service will keep track of new security database updates and inform an interested client if new or removed vulnerabilites affect an indexed manifest. +The notifier service will keep track of new security database updates and inform an interested client if new or removed vulnerabilities affect an indexed manifest. The interested client can subscribe to notifications via several mechanisms: * Webhook delivery @@ -58,7 +58,7 @@ When you configure notifier for webhook delivery you provide the service with th When the notifier has determined an updated security database has changed the affected status of an indexed manifest, it will deliver the following JSON body to the configured target: ```json { - "notifiction_id": {uuid_string}, + "notification_id": {uuid_string}, "callback": {url_to_notifications} } ``` diff --git a/Documentation/contribution.md b/Documentation/contribution.md index c8e742e180..617e7c0e39 100644 --- a/Documentation/contribution.md +++ b/Documentation/contribution.md @@ -1,4 +1,4 @@ -# Contribuion +# Contribution The following sections provides information on how to contribute to Clair. - [Commit Style](./contribution/commit_style.md) diff --git a/Documentation/howto/deployment.md b/Documentation/howto/deployment.md index f2be20db59..baa73daee3 100644 --- a/Documentation/howto/deployment.md +++ b/Documentation/howto/deployment.md @@ -14,7 +14,7 @@ In a combined deployment, all the Clair processes run in a single OS process. Th A load balancer is still recommended if you plan on performing TLS termination. Typically this will be a OpenShift route or a Kubernetes ingress. -![combo mode single db deployment diagran](./clairv4_combo_single_db.png) +![combo mode single db deployment diagram](./clairv4_combo_single_db.png) In the above diagram, Clair is running in combo mode and talking to a single database. To configure this model you will provide all node types the same database and start Clair in **combo** mode. @@ -33,7 +33,7 @@ In this mode, any configuration informing Clair how to talk to other nodes is ig For added flexibility, it's also supported to split the databases while in combo mode. -![combo mode multiple db deployment diagran](./clairv4_combo_multi_db.png) +![combo mode multiple db deployment diagram](./clairv4_combo_multi_db.png) In the above diagram, Clair is running in combo mode but database load is split between multiple databases. Since Clair is conceptually a set of micro-services, its processes do not share database tables even when combined into the same OS process. @@ -58,7 +58,7 @@ In a distributed deployment, each Clair process runs in its own OS process. Typi A load balancer **must** be setup in this deployment model. The load balancer will route traffic between Clair nodes along with routing API requests via [path based routing](https://devcentral.f5.com/s/articles/the-three-http-routing-patterns-you-should-know-30764) to the correct services. In a Kubernetes or OpenShift deployment this is usually handled with the Service and Routes abstractions. If deploying on bare metal, a load balancer will need to be configured appropriately. -![distributed mode multiple db deployment diagran](./clairv4_distributed_multi_db.png) +![distributed mode multiple db deployment diagram](./clairv4_distributed_multi_db.png) In the above diagram, a load balancer is configured to route traffic coming from the client to the correct service. This routing is path based routing and requires a layer 7 load balancer. Traefik, Nginx, and HAProxy are all capable of this. As mentioned above, this functionality is native to OpenShift and Kubernetes. diff --git a/Documentation/reference/api.md b/Documentation/reference/api.md index c6842e4b33..4c9a5a79a0 100644 --- a/Documentation/reference/api.md +++ b/Documentation/reference/api.md @@ -3,7 +3,7 @@ title: ClairV4 v0.1 language_tabs: - python: Python - go: Golang - - javascript: Javascript + - javascript: JavaScript language_clients: - python: "" - go: "" @@ -1184,7 +1184,7 @@ Notification |---|---|---|---|---| |id|string|false|none|a unique identifier for this notification| |manifest|string|false|none|The hash of the manifest affected by the provided vulnerability.| -|reason|string|false|none|the reason for the notifcation, [added | removed]| +|reason|string|false|none|the reason for the notification, [added | removed]| |vulnerability|[VulnSummary](#schemavulnsummary)|false|none|A summary of a vulnerability|

Environment

@@ -1285,7 +1285,7 @@ IndexReport |» **additionalProperties**|[Distribution](#schemadistribution)|false|none|An indexed distribution discovered in a layer. See
https://www.freedesktop.org/software/systemd/man/os-release.html
for explanations and example of fields.| |environments|object|true|none|A map of lists containing Environment objects keyed by the
associated Package.id.| |» **additionalProperties**|[[Environment](#schemaenvironment)]|false|none|[The environment a particular package was discovered in.]| -|success|boolean|true|none|A bool indicating succcessful index| +|success|boolean|true|none|A bool indicating successful index| |err|string|true|none|An error message on event of unsuccessful index|

VulnerabilityReport

diff --git a/Documentation/reference/config.md b/Documentation/reference/config.md index 67a487006e..9dcc53d34d 100644 --- a/Documentation/reference/config.md +++ b/Documentation/reference/config.md @@ -564,7 +564,7 @@ An address in `:` syntax where traces can be submitted. #### `$.trace.jaeger.collector.username` a string value -#### `$.trace.jaeger.collector.passwordd` +#### `$.trace.jaeger.collector.password` a string value #### `$.trace.jaeger.service_name` diff --git a/Makefile b/Makefile index f08baa4a9d..ec8a0a0519 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ goimports-local: # you'll need to have npx to run this gen. .PHONY: gen-api-reference gen-api-reference: - npx widdershins --search false --language_tabs 'python:Python' 'go:Golang' 'javascript:Javascript' --summary ./openapi.yaml -o ./Documentation/reference/api.md + npx widdershins --search false --language_tabs 'python:Python' 'go:Golang' 'javascript:JavaScript' --summary ./openapi.yaml -o ./Documentation/reference/api.md # start a local development environment. # each services runs in it's own container to test service->service communication. diff --git a/clair-error/errors.go b/clair-error/errors.go index 947b368084..820f02822c 100644 --- a/clair-error/errors.go +++ b/clair-error/errors.go @@ -16,7 +16,7 @@ func (e *ErrRequestFail) Error() string { return fmt.Sprintf("code: %v status %v", e.Code, e.Status) } -// ErrBadManifest inidcates a manifest could not be parsed +// ErrBadManifest indicates a manifest could not be parsed type ErrBadManifest struct { E error } @@ -29,7 +29,7 @@ func (e *ErrBadManifest) Unwrap() error { return e.E } -// ErrBadManifest inidcates a manifest could not be parsed +// ErrBadManifest indicates a manifest could not be parsed type ErrBadIndexReport struct { E error } diff --git a/clair-error/notifications.go b/clair-error/notifications.go index 7298a4723c..f1e4018517 100644 --- a/clair-error/notifications.go +++ b/clair-error/notifications.go @@ -6,7 +6,7 @@ import ( "github.com/google/uuid" ) -// ErrNoUpdateOperation inidcates that the queried updater has no +// ErrNoUpdateOperation indicates that the queried updater has no // update operations associated. type ErrNoUpdateOperation struct { Updater string @@ -31,7 +31,7 @@ func (e ErrBadNotification) Unwrap() error { return e.E } -// ErrDeleteNotification indicates an error while deleting notifcations. +// ErrDeleteNotification indicates an error while deleting notifications. // The wrapped error will contain further details. type ErrDeleteNotification struct { NotificationID uuid.UUID @@ -55,7 +55,7 @@ func (e ErrNoReceipt) Error() string { return fmt.Sprintf("no receipt exists for notification id %s", e.NotificationID) } -// ErrReceipt indicates an error retreiving a receipt for referenced notification id. +// ErrReceipt indicates an error retrieving a receipt for referenced notification id. type ErrReceipt struct { NotificationID uuid.UUID E error @@ -69,7 +69,7 @@ func (e ErrReceipt) Unwrap() error { return e.E } -// ErrCreated indicates an error occured when retrieving created notification ids. +// ErrCreated indicates an error occurred when retrieving created notification ids. type ErrCreated struct { E error } @@ -82,7 +82,7 @@ func (e ErrCreated) Unwrap() error { return e.E } -// ErrFailed indicates an error occured when retrieving created notification ids. +// ErrFailed indicates an error occurred when retrieving created notification ids. type ErrFailed struct { E error } @@ -95,7 +95,7 @@ func (e ErrFailed) Unwrap() error { return e.E } -// ErrPutNotifications indicates an issues occured when persisting a slice of +// ErrPutNotifications indicates an issues occurred when persisting a slice of // computed notifications. // The wrapped error will contain further details. type ErrPutNotifications struct { diff --git a/config.yaml.sample b/config.yaml.sample index 09094dacc0..bb2835d5e5 100644 --- a/config.yaml.sample +++ b/config.yaml.sample @@ -76,10 +76,10 @@ notifier: callback: "http://clair-notifier/notifier/api/v1/notifications" tls: root_ca: "optional/path/to/rootca" - cert: "madatory/path/to/cert" - key: "madatory/path/to/key" + cert: "mandatory/path/to/cert" + key: "mandatory/path/to/key" stomp: - desitnation: "notifications" + destination: "notifications" direct: false callback: "http://clair-notifier/notifier/api/v1/notifications" login: @@ -87,8 +87,8 @@ notifier: passcode: "passcode" tls: root_ca: "optional/path/to/rootca" - cert: "madatory/path/to/cert" - key: "madatory/path/to/key" + cert: "mandatory/path/to/cert" + key: "mandatory/path/to/key" diff --git a/config/config_test.go b/config/config_test.go index 75916a4773..e95df9dba5 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -70,7 +70,7 @@ func Test_Config_Validate_Failure(t *testing.T) { } } -func TestConfigUpateRetention(t *testing.T) { +func TestConfigUpdateRetention(t *testing.T) { var table = []struct { name string conf config.Config diff --git a/config/indexer.go b/config/indexer.go index 36c73bb1c4..934f683720 100644 --- a/config/indexer.go +++ b/config/indexer.go @@ -21,7 +21,7 @@ type Indexer struct { // This value tunes how often a waiting Indexer will poll for the lock. // TODO: Move to async operating mode ScanLockRetry int `yaml:"scanlock_retry" json:"scanlock_retry"` - // A positive values represeting quantity. + // A positive values representing quantity. // // Indexers will index a Manifest's layers concurrently. // This value tunes the number of layers an Indexer will scan in parallel. diff --git a/httptransport/client/matcher.go b/httptransport/client/matcher.go index 015b8a5252..d6c9c4df16 100644 --- a/httptransport/client/matcher.go +++ b/httptransport/client/matcher.go @@ -178,7 +178,7 @@ func (c *HTTP) LatestUpdateOperations(ctx context.Context, k driver.UpdateKind) // updateOperations is a private method implementing the common bits for retrieving UpdateOperations // // an ouCache is passed in by the caller to cache any responses providing an etag. -// if a subsequent response provides a StatusNotModified status, the map of UpdateOprations is served from cache. +// if a subsequent response provides a StatusNotModified status, the map of UpdateOperations is served from cache. func (c *HTTP) updateOperations(ctx context.Context, req *http.Request, cache *uoCache) (map[string][]driver.UpdateOperation, error) { res, err := c.c.Do(req) if err != nil { diff --git a/httptransport/discoveryhandler_test.go b/httptransport/discoveryhandler_test.go index 32c1e527ab..e9ad49fc52 100644 --- a/httptransport/discoveryhandler_test.go +++ b/httptransport/discoveryhandler_test.go @@ -43,7 +43,7 @@ func TestDiscoveryEndpoint(t *testing.T) { if _, ok := m["openapi"]; !ok { t.Fatalf("returned json did not container openapi key at the root") } - t.Logf("openapi verion: %v", m["openapi"]) + t.Logf("openapi version: %v", m["openapi"]) } func TestDiscoveryFailure(t *testing.T) { diff --git a/httptransport/indexstatehandler.go b/httptransport/indexstatehandler.go index 5ee772a697..b9a4dcf47f 100644 --- a/httptransport/indexstatehandler.go +++ b/httptransport/indexstatehandler.go @@ -10,7 +10,7 @@ import ( ) // IndexStateHandler utilizes a Stater to report the -// curent runtime state of an Indexer. +// current runtime state of an Indexer. // // Indexers running with different scanner versions // will produce unique states and indicate to clients diff --git a/httptransport/server.go b/httptransport/server.go index a54aa0f98e..7cb657ec1c 100644 --- a/httptransport/server.go +++ b/httptransport/server.go @@ -137,7 +137,7 @@ func (t *Server) configureDiscovery(_ context.Context) error { func (t *Server) configureComboMode(ctx context.Context) error { // requires both indexer and matcher services if t.indexer == nil || t.matcher == nil { - return clairerror.ErrNotInitialized{Msg: "Combo mode requires both indexer and macher services"} + return clairerror.ErrNotInitialized{Msg: "Combo mode requires both indexer and matcher services"} } err := t.configureIndexerMode(ctx) diff --git a/httptransport/updateoperationhandler_test.go b/httptransport/updateoperationhandler_test.go index 4191b036c7..63db4875fc 100644 --- a/httptransport/updateoperationhandler_test.go +++ b/httptransport/updateoperationhandler_test.go @@ -22,7 +22,7 @@ func TestUpdateOperationHandler(t *testing.T) { t.Run("Errors", testUpdateOperationHandlerErrors) } -// testUpdateOperationHandlerErrors confirms the handler perfoms the correct +// testUpdateOperationHandlerErrors confirms the handler performs the correct // actions when a matcher.Differ is failing. func testUpdateOperationHandlerErrors(t *testing.T) { t.Parallel() diff --git a/httptransport/vulnerabilityreporthandler.go b/httptransport/vulnerabilityreporthandler.go index 3d48ba76db..44ab6b4fbe 100644 --- a/httptransport/vulnerabilityreporthandler.go +++ b/httptransport/vulnerabilityreporthandler.go @@ -59,7 +59,7 @@ func (h *VulnerabilityReportHandler) ServeHTTP(w http.ResponseWriter, r *http.Re return } - initd, err := h.Matcher.Initialized(ctx) + inited, err := h.Matcher.Initialized(ctx) if err != nil { resp := &je.Response{ Code: "internal-server-error", @@ -68,7 +68,7 @@ func (h *VulnerabilityReportHandler) ServeHTTP(w http.ResponseWriter, r *http.Re je.Error(w, resp, http.StatusInternalServerError) return } - if !initd { + if !inited { w.WriteHeader(http.StatusAccepted) return } diff --git a/httptransport/vulnerabilityreporthandler_test.go b/httptransport/vulnerabilityreporthandler_test.go index adc819654d..32e2f7fc65 100644 --- a/httptransport/vulnerabilityreporthandler_test.go +++ b/httptransport/vulnerabilityreporthandler_test.go @@ -14,12 +14,12 @@ import ( ) func TestInitialized(t *testing.T) { - var initd bool + var inited bool digest := claircore.MustParseDigest("sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") h := &VulnerabilityReportHandler{ Matcher: &matcher.Mock{ Initialized_: func(_ context.Context) (bool, error) { - return initd, nil + return inited, nil }, }, Indexer: &indexer.Mock{ @@ -45,7 +45,7 @@ func TestInitialized(t *testing.T) { t.Errorf("unexpected response") } - initd = true + inited = true res, err = c.Get(srv.URL + "/" + digest.String()) if err != nil { t.Fatal(err) diff --git a/indexer/service.go b/indexer/service.go index d39f437640..a92130dad9 100644 --- a/indexer/service.go +++ b/indexer/service.go @@ -36,7 +36,7 @@ type Indexer interface { Index(ctx context.Context, manifest *claircore.Manifest) (*claircore.IndexReport, error) } -// Reporter is an interface for retreiving an IndexReport given a manifest digest. +// Reporter is an interface for retrieving an IndexReport given a manifest digest. type Reporter interface { IndexReport(ctx context.Context, digest claircore.Digest) (*claircore.IndexReport, bool, error) } diff --git a/introspection/server.go b/introspection/server.go index 83e8dcf458..95017cc41c 100644 --- a/introspection/server.go +++ b/introspection/server.go @@ -134,7 +134,7 @@ func New(ctx context.Context, conf config.Config, health func() bool) (*Server, return i, nil } -// withDiagnotics enables healthz and pprof endpoints +// withDiagnostics enables healthz and pprof endpoints func (i *Server) withDiagnostics(_ context.Context) error { health := i.health i.HandleFunc(HealthEndpoint, func(w http.ResponseWriter, r *http.Request) { diff --git a/middleware/auth/httpauth_keyserver.go b/middleware/auth/httpauth_keyserver.go index 3a57f54c56..dbfb8d6da3 100644 --- a/middleware/auth/httpauth_keyserver.go +++ b/middleware/auth/httpauth_keyserver.go @@ -117,7 +117,7 @@ HeaderSearch: jwk, ok := s.cache[ck] s.mu.RUnlock() // If not in our deserialized cache or our response has been served from the - // remote server, do the deserializtion and cache it. + // remote server, do the deserialization and cache it. if !ok || res.Header.Get(httpcache.XFromCache) != "" { jwk = &jose.JSONWebKey{} dec := codec.GetDecoder(res.Body) diff --git a/middleware/compress/handler.go b/middleware/compress/handler.go index 4e19ec620a..5d28593739 100644 --- a/middleware/compress/handler.go +++ b/middleware/compress/handler.go @@ -114,7 +114,7 @@ func (c *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Find the first accept-encoding we support. // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 for - // all the sematics. + // all the semantics. for _, a := range ae { switch a.Type { case "gzip": diff --git a/middleware/introspection/instrumentedhandler.go b/middleware/introspection/instrumentedhandler.go index 76ace1bc57..4609381f11 100644 --- a/middleware/introspection/instrumentedhandler.go +++ b/middleware/introspection/instrumentedhandler.go @@ -1,4 +1,4 @@ -package instrospection +package introspection import ( "net/http" diff --git a/notifier/amqp/directdeliverer.go b/notifier/amqp/directdeliverer.go index 062889f714..e8b919f6da 100644 --- a/notifier/amqp/directdeliverer.go +++ b/notifier/amqp/directdeliverer.go @@ -76,7 +76,7 @@ func (d *DirectDeliverer) Deliver(ctx context.Context, _ uuid.UUID) error { if err != nil { return &clairerror.ErrDeliveryFailed{err} } - // TODO: can tx.Rollback be safely defered? + // TODO: can tx.Rollback be safely deferred? // block loop publishing smaller blocks of max(rollup) length via reslicing. var rollup int = d.conf.Rollup diff --git a/notifier/callback_test.go b/notifier/callback_test.go index f56c33b1c5..609ccef70f 100644 --- a/notifier/callback_test.go +++ b/notifier/callback_test.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" ) -func TestCallbackSerializtion(t *testing.T) { +func TestCallbackSerialization(t *testing.T) { var want = []byte(`{"callback":"https://example.com","notification_id":"00000000-0000-0000-0000-000000000000"}`) cb := Callback{ NotificationID: uuid.Nil, diff --git a/notifier/mockstore.go b/notifier/mockstore.go index 98fdb455ed..90ea1bcce6 100644 --- a/notifier/mockstore.go +++ b/notifier/mockstore.go @@ -8,18 +8,18 @@ import ( // MockStore implements a mock Store. type MockStore struct { - Notifications_ func(ctx context.Context, id uuid.UUID, page *Page) ([]Notification, Page, error) - PutNotifications_ func(ctx context.Context, opts PutOpts) error - PutReceipt_ func(ctx context.Context, updater string, r Receipt) error - DeleteNotitfications_ func(ctx context.Context, id uuid.UUID) error - Receipt_ func(ctx context.Context, id uuid.UUID) (Receipt, error) - ReceiptByUOID_ func(ctx context.Context, id uuid.UUID) (Receipt, error) - Created_ func(ctx context.Context) ([]uuid.UUID, error) - Failed_ func(ctx context.Context) ([]uuid.UUID, error) - Deleted_ func(ctx context.Context) ([]uuid.UUID, error) - SetDelivered_ func(ctx context.Context, id uuid.UUID) error - SetDeliveredFailed_ func(ctx context.Context, id uuid.UUID) error - SetDeleted_ func(ctx context.Context, id uuid.UUID) error + Notifications_ func(ctx context.Context, id uuid.UUID, page *Page) ([]Notification, Page, error) + PutNotifications_ func(ctx context.Context, opts PutOpts) error + PutReceipt_ func(ctx context.Context, updater string, r Receipt) error + DeleteNotifications_ func(ctx context.Context, id uuid.UUID) error + Receipt_ func(ctx context.Context, id uuid.UUID) (Receipt, error) + ReceiptByUOID_ func(ctx context.Context, id uuid.UUID) (Receipt, error) + Created_ func(ctx context.Context) ([]uuid.UUID, error) + Failed_ func(ctx context.Context) ([]uuid.UUID, error) + Deleted_ func(ctx context.Context) ([]uuid.UUID, error) + SetDelivered_ func(ctx context.Context, id uuid.UUID) error + SetDeliveredFailed_ func(ctx context.Context, id uuid.UUID) error + SetDeleted_ func(ctx context.Context, id uuid.UUID) error } // Notifications retrieves the list of notifications associated with a @@ -58,7 +58,7 @@ func (m *MockStore) PutReceipt(ctx context.Context, updater string, r Receipt) e // set deleted after some period of time, thus this condition should not // be checked. func (m *MockStore) DeleteNotifications(ctx context.Context, id uuid.UUID) error { - return m.DeleteNotitfications_(ctx, id) + return m.DeleteNotifications_(ctx, id) } // Receipt returns the Receipt for a given notification id @@ -91,7 +91,7 @@ func (m *MockStore) SetDelivered(ctx context.Context, id uuid.UUID) error { return m.SetDelivered_(ctx, id) } -// SetDeliveryFailed marks the provided notification id failed to be delivere +// SetDeliveryFailed marks the provided notification id failed to be delivered func (m *MockStore) SetDeliveryFailed(ctx context.Context, id uuid.UUID) error { return m.SetDeliveredFailed_(ctx, id) } diff --git a/notifier/pager.go b/notifier/pager.go index d84e653749..4180115482 100644 --- a/notifier/pager.go +++ b/notifier/pager.go @@ -4,7 +4,7 @@ import ( "github.com/google/uuid" ) -// Page communicates a bare-minimum paging procotol with clients +// Page communicates a bare-minimum paging protocol with clients type Page struct { // the max number of elements returned in a page Size uint64 `json:"size"` diff --git a/notifier/postgres/e2e_test.go b/notifier/postgres/e2e_test.go index 327cbcdb30..8aea0c7ef2 100644 --- a/notifier/postgres/e2e_test.go +++ b/notifier/postgres/e2e_test.go @@ -20,14 +20,14 @@ const ( ) // TestE2E performs an end to end test ensuring creating, -// retreiving, bookkeeping, and deleting of notifications -// and asssociated data works correctly +// retrieving, bookkeeping, and deleting of notifications +// and associated data works correctly func TestE2E(t *testing.T) { integration.NeedDB(t) ctx := zlog.Test(nil, t) digest, _ := claircore.ParseDigest("sha256:35c102085707f703de2d9eaad8752d6fe1b8f02b5d2149f1d8357c9cc7fb7d0a") notificationID := uuid.New() - // this function puts a single noification undertest + // this function puts a single notification undertest vuln, vsummary := cctest.GenUniqueVulnerabilities(1, updater)[0], notifier.VulnSummary{} vsummary.FromVulnerability(vuln) notifications := []notifier.Notification{ @@ -39,7 +39,7 @@ func TestE2E(t *testing.T) { } store := TestStore(ctx, t) e := e2e{ - notificaitonID: notificationID, + notificationID: notificationID, updater: updater, updateID: uuid.New(), notification: notifications[0], @@ -59,7 +59,7 @@ func TestE2E(t *testing.T) { // failure type e2e struct { // the notification ID this e2e test will use - notificaitonID uuid.UUID + notificationID uuid.UUID // the updater associated with the set of notifications under test updater string // the update operation ID associated with the set of notifications under test @@ -100,14 +100,14 @@ func (e *e2e) Run(t *testing.T) { } // PutNotifications adds a set of notifications to the database -// and confims no error occurs +// and confirms no error occurs func (e *e2e) PutNotifications(t *testing.T) { defer func() { e.failed = t.Failed() }() opts := notifier.PutOpts{ Updater: e.updater, - NotificationID: e.notificaitonID, + NotificationID: e.notificationID, Notifications: []notifier.Notification{e.notification}, UpdateID: e.updateID, } @@ -131,16 +131,16 @@ func (e *e2e) Created(t *testing.T) { if len(ids) != 1 { t.Fatalf("expected a single notification id. got: %v", ids) } - if !cmp.Equal(ids[0], e.notificaitonID) { - t.Fatalf(cmp.Diff(ids[0], e.notificaitonID)) + if !cmp.Equal(ids[0], e.notificationID) { + t.Fatalf(cmp.Diff(ids[0], e.notificationID)) } - receipt, err := e.store.Receipt(e.ctx, e.notificaitonID) + receipt, err := e.store.Receipt(e.ctx, e.notificationID) if err != nil { t.Fatalf("failed to retrieve receipt by notification id") } - if !cmp.Equal(receipt.NotificationID, e.notificaitonID) { - t.Fatal(cmp.Diff(receipt.NotificationID, e.notificaitonID)) + if !cmp.Equal(receipt.NotificationID, e.notificationID) { + t.Fatal(cmp.Diff(receipt.NotificationID, e.notificationID)) } if !cmp.Equal(receipt.Status, notifier.Created) { t.Fatal(cmp.Diff(receipt.Status, notifier.Delivered)) @@ -148,10 +148,10 @@ func (e *e2e) Created(t *testing.T) { receipt, err = e.store.ReceiptByUOID(e.ctx, e.updateID) if err != nil { - t.Fatalf("failed to retrieve receipt by OUID") + t.Fatalf("failed to retrieve receipt by UOID") } - if !cmp.Equal(receipt.NotificationID, e.notificaitonID) { - t.Fatal(cmp.Diff(receipt.NotificationID, e.notificaitonID)) + if !cmp.Equal(receipt.NotificationID, e.notificationID) { + t.Fatal(cmp.Diff(receipt.NotificationID, e.notificationID)) } if !cmp.Equal(receipt.Status, notifier.Created) { t.Fatal(cmp.Diff(receipt.Status, notifier.Delivered)) @@ -164,12 +164,12 @@ func (e *e2e) Notifcations(t *testing.T) { defer func() { e.failed = t.Failed() }() - notifications, _, err := e.store.Notifications(e.ctx, e.notificaitonID, nil) + notifications, _, err := e.store.Notifications(e.ctx, e.notificationID, nil) if err != nil { t.Fatalf("failed to retrieve persisted notification: %v", err) } if len(notifications) != 1 { - t.Fatalf("expected a single notifcation to be returned for notification id %v but received %d", e.notificaitonID, len(notifications)) + t.Fatalf("expected a single notification to be returned for notification id %v but received %d", e.notificationID, len(notifications)) } opts := cmpopts.IgnoreUnexported(claircore.Digest{}) if !cmp.Equal(notifications[0].Manifest, e.notification.Manifest, opts) { @@ -190,16 +190,16 @@ func (e *e2e) SetDelivered(t *testing.T) { defer func() { e.failed = t.Failed() }() - err := e.store.SetDelivered(e.ctx, e.notificaitonID) + err := e.store.SetDelivered(e.ctx, e.notificationID) if err != nil { t.Fatalf("failed to set notification receipt to delivered") } - receipt, err := e.store.Receipt(e.ctx, e.notificaitonID) + receipt, err := e.store.Receipt(e.ctx, e.notificationID) if err != nil { t.Fatalf("failed to retrieve receipt after setting it's status to delivered") } - if !cmp.Equal(receipt.NotificationID, e.notificaitonID) { - t.Fatal(cmp.Diff(receipt.NotificationID, e.notificaitonID)) + if !cmp.Equal(receipt.NotificationID, e.notificationID) { + t.Fatal(cmp.Diff(receipt.NotificationID, e.notificationID)) } if !cmp.Equal(receipt.Status, notifier.Delivered) { t.Fatal(cmp.Diff(receipt.Status, notifier.Delivered)) @@ -212,16 +212,16 @@ func (e *e2e) SetDeliveryFailed(t *testing.T) { defer func() { e.failed = t.Failed() }() - err := e.store.SetDeliveryFailed(e.ctx, e.notificaitonID) + err := e.store.SetDeliveryFailed(e.ctx, e.notificationID) if err != nil { t.Fatalf("failed to set notification receipt to delivered") } - receipt, err := e.store.Receipt(e.ctx, e.notificaitonID) + receipt, err := e.store.Receipt(e.ctx, e.notificationID) if err != nil { t.Fatalf("failed to retrieve receipt after setting it's status to delete") } - if !cmp.Equal(receipt.NotificationID, e.notificaitonID) { - t.Fatal(cmp.Diff(receipt.NotificationID, e.notificaitonID)) + if !cmp.Equal(receipt.NotificationID, e.notificationID) { + t.Fatal(cmp.Diff(receipt.NotificationID, e.notificationID)) } if !cmp.Equal(receipt.Status, notifier.DeliveryFailed) { t.Fatal(cmp.Diff(receipt.Status, notifier.DeliveryFailed)) @@ -233,8 +233,8 @@ func (e *e2e) SetDeliveryFailed(t *testing.T) { if len(ids) != 1 { t.Fatalf("expected a single notification id. got: %v", ids) } - if !cmp.Equal(ids[0], e.notificaitonID) { - t.Fatalf(cmp.Diff(ids[0], e.notificaitonID)) + if !cmp.Equal(ids[0], e.notificationID) { + t.Fatalf(cmp.Diff(ids[0], e.notificationID)) } } @@ -245,16 +245,16 @@ func (e *e2e) SetDeleted(t *testing.T) { defer func() { e.failed = t.Failed() }() - err := e.store.SetDeleted(e.ctx, e.notificaitonID) + err := e.store.SetDeleted(e.ctx, e.notificationID) if err != nil { t.Fatalf("failed to set notification receipt to delivered") } - receipt, err := e.store.Receipt(e.ctx, e.notificaitonID) + receipt, err := e.store.Receipt(e.ctx, e.notificationID) if err != nil { t.Fatalf("failed to retrieve receipt after setting it's status to delete") } - if !cmp.Equal(receipt.NotificationID, e.notificaitonID) { - t.Fatal(cmp.Diff(receipt.NotificationID, e.notificaitonID)) + if !cmp.Equal(receipt.NotificationID, e.notificationID) { + t.Fatal(cmp.Diff(receipt.NotificationID, e.notificationID)) } if !cmp.Equal(receipt.Status, notifier.Deleted) { t.Fatal(cmp.Diff(receipt.Status, notifier.Deleted)) diff --git a/notifier/postgres/notification_pagination_test.go b/notifier/postgres/notification_pagination_test.go index 3088f9e9fe..3544c01b9b 100644 --- a/notifier/postgres/notification_pagination_test.go +++ b/notifier/postgres/notification_pagination_test.go @@ -107,7 +107,7 @@ func TestNotePagination(t *testing.T) { for outPage.Next != nil { if err != nil { - t.Fatalf("failed to retreive initial page: %v", err) + t.Fatalf("failed to retrieve initial page: %v", err) } if outPage.Size != tt.pageSize { t.Fatalf("got: %v, want: %v", outPage.Size, tt.pageSize) diff --git a/notifier/postgres/putnotifications.go b/notifier/postgres/putnotifications.go index 075a157064..1cdfff33e4 100644 --- a/notifier/postgres/putnotifications.go +++ b/notifier/postgres/putnotifications.go @@ -21,9 +21,9 @@ type notificationJSONB notifier.Notification // putNotifications inserts the provided notifications, updates the latest seen update // operation for the provide updater, and creates a receipt in created status for the -// notifiation id. +// notification id. // -// these operations occur under a transcation to preserve an atomic operation. +// these operations occur under a transaction to preserve an atomic operation. func putNotifications(ctx context.Context, pool *pgxpool.Pool, opts notifier.PutOpts) error { const ( insertNotification = `INSERT INTO notification (id) VALUES ($1);` diff --git a/notifier/postgres/setdeleted.go b/notifier/postgres/setdeleted.go index 8c321a586c..7bd3f09c07 100644 --- a/notifier/postgres/setdeleted.go +++ b/notifier/postgres/setdeleted.go @@ -32,7 +32,7 @@ var ( ) ) -// setDeleted will update the receipt's status to "deleted" for the provied +// setDeleted will update the receipt's status to "deleted" for the provided // notification id func setDeleted(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID) error { const ( diff --git a/notifier/postgres/setdeliveryfailed.go b/notifier/postgres/setdeliveryfailed.go index 3c2b8af927..207feb50db 100644 --- a/notifier/postgres/setdeliveryfailed.go +++ b/notifier/postgres/setdeliveryfailed.go @@ -32,7 +32,7 @@ var ( ) ) -// setDeliveryFailed will update the receipt's status to "delivery_failed" for the provied +// setDeliveryFailed will update the receipt's status to "delivery_failed" for the provided // notification id func setDeliveryFailed(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID) error { const ( diff --git a/notifier/postgres/store.go b/notifier/postgres/store.go index 8290863851..a7ad3f176a 100644 --- a/notifier/postgres/store.go +++ b/notifier/postgres/store.go @@ -82,7 +82,7 @@ func (s *Store) SetDelivered(ctx context.Context, id uuid.UUID) error { return setDelivered(ctx, s.pool, id) } -// SetDeliveryFailed marks the provided notification id failed to be delivere +// SetDeliveryFailed marks the provided notification id failed to be delivered func (s *Store) SetDeliveryFailed(ctx context.Context, id uuid.UUID) error { return setDeliveryFailed(ctx, s.pool, id) } diff --git a/notifier/service/testmode.go b/notifier/service/testmode.go index 4c54d81f5c..efc75e91fc 100644 --- a/notifier/service/testmode.go +++ b/notifier/service/testmode.go @@ -49,10 +49,10 @@ func indexerForTestMode(mock *indexer.Mock) { // MatcherForTestMode configures a mock Matcher service for notifier test mode. // // in notifier test mode a notifier.Poller will request "matcher.LatestUpdateOperations" at which point -// a new UO pair will be smithed. +// a new UO pair will be created. // // next a notifier.Processor will request "matcher.UpdateOperations" and look for "test-updater" UOs in which -// the smithed pair will be returned. +// the created pair will be returned. // // finally a notifier.Processor will request to "matcher.UpdateDiff" will be created where a mock added vulnerability // will be returned. diff --git a/notifier/store.go b/notifier/store.go index 3f7675a740..de66879f50 100644 --- a/notifier/store.go +++ b/notifier/store.go @@ -6,7 +6,7 @@ import ( "github.com/google/uuid" ) -// PutOpts is provided to Notificationer.Put +// PutOpts is provided to Notifier.Put // with fields necessary to persist a notification id type PutOpts struct { // the updater triggering a notification @@ -24,12 +24,12 @@ type PutOpts struct { // Store is an aggregate interface implementing all methods // necessary for a notifier persistence layer type Store interface { - Notificationer + Notifier Receipter } -// Notificationer implements persistence methods for Notification models -type Notificationer interface { +// Notifier implements persistence methods for Notification models +type Notifier interface { // Notifications retrieves the list of notifications associated with a // notification id // diff --git a/notifier/webhook/config.go b/notifier/webhook/config.go index 475b235d1f..981a53fbe7 100644 --- a/notifier/webhook/config.go +++ b/notifier/webhook/config.go @@ -16,7 +16,7 @@ type Config struct { // the notification will be appended to this url Callback string `yaml:"callback" json:"callback"` callback *url.URL - // any htp headers necessary for the request to Target + // any http headers necessary for the request to Target Headers http.Header `yaml:"headers" json:"headers"` // whether the webhook deliverer will sign out going. // if true webhooks will be sent with a jwt signed by diff --git a/openapi.yaml b/openapi.yaml index 774faed552..7cc92916e1 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -466,7 +466,7 @@ components: example: |- sha256:35c102085707f703de2d9eaad8752d6fe1b8f02b5d2149f1d8357c9cc7fb7d0a reason: - description: "the reason for the notifcation, [added | removed]" + description: "the reason for the notification, [added | removed]" type: string example: "added" vulnerability: @@ -547,7 +547,7 @@ components: $ref: '#/components/schemas/Environment' success: type: boolean - description: "A bool indicating succcessful index" + description: "A bool indicating successful index" example: true err: type: string