Compare commits

...

920 Commits
v0.0.6 ... main

Author SHA1 Message Date
dependabot[bot] 9f30cce152 chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 28.3.2+incompatible to 28.3.3+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v28.3.2...v28.3.3)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-version: 28.3.3+incompatible
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-30 04:47:14 +02:00
Dominic Evans 090d95418e chore(deps): bump driverkit to v0.21.2
Pulling in https://github.com/falcosecurity/driverkit/pull/389 to bring
docker libraries up-to-date at v28 level, which will allow other
co-dependents like cosign to also be updated in the future.

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
2025-07-29 23:40:12 +02:00
Dominic Evans 6a25fa9f5a chore(deps): bump github.com/go-oauth2/oauth2 to v4.5.3
As they've updated to jwt/v5 this prevents us from pulling in the legacy
vulnerable github.com/golang-jwt/jwt@v3.2.2+incompatible dependency

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
2025-07-28 10:26:04 +02:00
dependabot[bot] ffb6e688e8 chore(deps): Bump sigstore/cosign-installer in the actions group
---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.9.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-21 09:40:32 +02:00
dependabot[bot] a7b6cc6b6b chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) and [slsa-framework/slsa-verifier](https://github.com/slsa-framework/slsa-verifier).


Updates `sigstore/cosign-installer` from 3.9.0 to 3.9.1
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](fb28c2b633...398d4b0eee)

Updates `slsa-framework/slsa-verifier` from 2.7.0 to 2.7.1
- [Release notes](https://github.com/slsa-framework/slsa-verifier/releases)
- [Changelog](https://github.com/slsa-framework/slsa-verifier/blob/main/RELEASE.md)
- [Commits](https://github.com/slsa-framework/slsa-verifier/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.9.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: slsa-framework/slsa-verifier
  dependency-version: 2.7.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 08:18:16 +02:00
dependabot[bot] fd12beb1cd chore(deps): Bump github.com/go-viper/mapstructure/v2
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.3.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.3.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-27 18:50:01 +02:00
dependabot[bot] d3c99d5dfc chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) and [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer).


Updates `docker/setup-buildx-action` from 3.10.0 to 3.11.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](b5ca514318...e468171a9d)

Updates `sigstore/cosign-installer` from 3.8.2 to 3.9.0
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](3454372f43...fb28c2b633)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: 3.11.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-23 10:21:35 +02:00
dependabot[bot] 6d9b57671f chore(deps): Bump github.com/cloudflare/circl from 1.3.8 to 1.6.1
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.8 to 1.6.1.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.8...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-version: 1.6.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-11 07:46:04 +02:00
dependabot[bot] 54c47d097f chore(deps): Bump docker/build-push-action in the actions group
Bumps the actions group with 1 update: [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `docker/build-push-action` from 6.17.0 to 6.18.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](1dc7386353...263435318d)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 6.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-02 09:42:59 +02:00
Luca Guerra 7a94528218 chore(build): update golang and net packages
Signed-off-by: Luca Guerra <luca@guerra.sh>
2025-05-27 13:15:11 +02:00
dependabot[bot] 876dcf4653 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) and [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `aws-actions/configure-aws-credentials` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](f24d7193d9...b475783126)

Updates `docker/build-push-action` from 6.16.0 to 6.17.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](14487ce63c...1dc7386353)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 4.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-version: 6.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-19 08:57:00 +02:00
chenliu1993 581cbbc316 feat: change aws-sdk-go from v1 to v2
Signed-off-by: chenliu1993 <cl2037829916@gmail.com>
2025-05-16 09:58:46 +02:00
dependabot[bot] b26c309f4d chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) and [actions/setup-go](https://github.com/actions/setup-go).


Updates `aws-actions/configure-aws-credentials` from 4.1.0 to 4.2.0
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](ececac1a45...f24d7193d9)

Updates `actions/setup-go` from 5.4.0 to 5.5.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0aaccfd150...d35c59abb0)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 4.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/setup-go
  dependency-version: 5.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-12 07:26:21 +02:00
dependabot[bot] 15dd8fde15 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [docker/build-push-action](https://github.com/docker/build-push-action) and [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer).


Updates `docker/build-push-action` from 6.15.0 to 6.16.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](471d1dc4e0...14487ce63c)

Updates `sigstore/cosign-installer` from 3.8.1 to 3.8.2
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](d7d6bc7722...3454372f43)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 6.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-28 08:18:58 +02:00
dependabot[bot] abdf330e55 chore(deps): Bump goreleaser/goreleaser-action in the actions group
Bumps the actions group with 1 update: [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action).


Updates `goreleaser/goreleaser-action` from 6.2.1 to 6.3.0
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](90a3faa9d0...9c156ee8a1)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-31 11:02:58 +02:00
dependabot[bot] 2b06411214 chore(deps): Bump github.com/spf13/viper from 1.19.0 to 1.20.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.19.0 to 1.20.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.19.0...v1.20.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 09:03:16 +01:00
dependabot[bot] 295c633684 chore(deps): Bump cloud.google.com/go/storage from 1.50.0 to 1.51.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.50.0 to 1.51.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.50.0...spanner/v1.51.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 09:02:17 +01:00
dependabot[bot] bccca00d90 chore(deps): Bump github.com/distribution/distribution/v3
Bumps [github.com/distribution/distribution/v3](https://github.com/distribution/distribution) from 3.0.0-rc.3 to 3.0.0-rc.4.
- [Release notes](https://github.com/distribution/distribution/releases)
- [Commits](https://github.com/distribution/distribution/compare/v3.0.0-rc.3...v3.0.0-rc.4)

---
updated-dependencies:
- dependency-name: github.com/distribution/distribution/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 09:00:17 +01:00
dependabot[bot] 54ef1cbbf1 chore(deps): Bump google.golang.org/api from 0.224.0 to 0.227.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.224.0 to 0.227.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.224.0...v0.227.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 08:51:17 +01:00
dependabot[bot] 464a8a3cf9 chore(deps): Bump the gomod group with 5 updates
Bumps the gomod group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/docker/cli](https://github.com/docker/cli) | `28.0.1+incompatible` | `28.0.2+incompatible` |
| [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) | `2.23.0` | `2.23.3` |
| [github.com/onsi/gomega](https://github.com/onsi/gomega) | `1.36.2` | `1.36.3` |
| [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign) | `2.4.1` | `2.4.3` |
| [golang.org/x/exp](https://github.com/golang/exp) | `0.0.0-20240719175910-8a7402abbf56` | `0.0.0-20241108190413-2d47ceb2692f` |


Updates `github.com/docker/cli` from 28.0.1+incompatible to 28.0.2+incompatible
- [Commits](https://github.com/docker/cli/compare/v28.0.1...v28.0.2)

Updates `github.com/onsi/ginkgo/v2` from 2.23.0 to 2.23.3
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.23.0...v2.23.3)

Updates `github.com/onsi/gomega` from 1.36.2 to 1.36.3
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.36.2...v1.36.3)

Updates `github.com/sigstore/cosign/v2` from 2.4.1 to 2.4.3
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.4.1...v2.4.3)

Updates `golang.org/x/exp` from 0.0.0-20240719175910-8a7402abbf56 to 0.0.0-20241108190413-2d47ceb2692f
- [Commits](https://github.com/golang/exp/commits)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: golang.org/x/exp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 08:40:43 +01:00
dependabot[bot] e632903105 chore(deps): Bump the actions group with 3 updates
Bumps the actions group with 3 updates: [actions/setup-go](https://github.com/actions/setup-go), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action).


Updates `actions/setup-go` from 5.3.0 to 5.4.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](f111f3307d...0aaccfd150)

Updates `actions/upload-artifact` from 4.6.1 to 4.6.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](4cec3d8aa0...ea165f8d65)

Updates `golangci/golangci-lint-action` from 6.5.1 to 6.5.2
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](4696ba8bab...55c2c1448f)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 08:36:43 +01:00
dependabot[bot] 48a247e521 chore(deps): Bump github.com/golang-jwt/jwt/v5 from 5.2.1 to 5.2.2
Bumps [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) from 5.2.1 to 5.2.2.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v5.2.1...v5.2.2)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-22 09:57:33 +01:00
dependabot[bot] 47ad8d0e29 chore(deps): Bump github.com/golang-jwt/jwt/v4 from 4.5.1 to 4.5.2
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.1 to 4.5.2.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-22 09:48:33 +01:00
dependabot[bot] 3bf89dd0c9 chore(deps): Bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.3
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.7.0 to 9.7.3.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.7.0...v9.7.3)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-20 20:39:36 +01:00
dependabot[bot] bb64751b9f chore(deps): Bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 27.5.1+incompatible to 28.0.1+incompatible.
- [Commits](https://github.com/docker/cli/compare/v27.5.1...v28.0.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-17 14:56:08 +01:00
Leonardo Grasso 1765e1d326 update(go.mod): bulk deps upgrade
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-03-17 14:03:07 +01:00
Leonardo Grasso a6dcad415c fix(internal/utils): correct t.Fatal usage
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-03-17 12:22:06 +01:00
Leonardo Grasso cead711238 update(.github): bump golangci-lint to v1.64.7
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-03-17 12:22:06 +01:00
Leonardo Grasso 33c01252f6 update: bump go to 1.24.1
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2025-03-17 12:22:06 +01:00
dependabot[bot] 537ebcf446 chore(deps): Bump golang.org/x/term from 0.29.0 to 0.30.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.29.0 to 0.30.0.
- [Commits](https://github.com/golang/term/compare/v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-17 12:22:06 +01:00
Aldo Lacuku 918e88464d chore(deps): bump oauth2 to v0.28.0
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2025-03-17 11:19:06 +01:00
Aldo Lacuku 4bfeb0b0b5 chore(toolchain): bump go to version 1.23.7
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2025-03-17 09:09:06 +01:00
dependabot[bot] dfa4c583b1 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [docker/login-action](https://github.com/docker/login-action) and [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action).


Updates `docker/login-action` from 3.3.0 to 3.4.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](9780b0c442...74a5d14239)

Updates `golangci/golangci-lint-action` from 6.5.0 to 6.5.1
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](2226d7cb06...4696ba8bab)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-17 08:19:05 +01:00
dependabot[bot] 7d5aee8bb2 chore(deps): Bump golang.org/x/net from 0.35.0 to 0.36.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.35.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.35.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 06:33:43 +01:00
dependabot[bot] 0bce031350 chore(deps): Bump the gomod group across 1 directory with 5 updates
Bumps the gomod group with 4 updates in the / directory: [github.com/cilium/ebpf](https://github.com/cilium/ebpf), [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec), [k8s.io/api](https://github.com/kubernetes/api) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `github.com/cilium/ebpf` from 0.17.1 to 0.17.3
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.17.1...v0.17.3)

Updates `github.com/opencontainers/image-spec` from 1.1.0 to 1.1.1
- [Release notes](https://github.com/opencontainers/image-spec/releases)
- [Changelog](https://github.com/opencontainers/image-spec/blob/main/RELEASES.md)
- [Commits](https://github.com/opencontainers/image-spec/compare/v1.1.0...v1.1.1)

Updates `k8s.io/api` from 0.32.1 to 0.32.2
- [Commits](https://github.com/kubernetes/api/compare/v0.32.1...v0.32.2)

Updates `k8s.io/apimachinery` from 0.32.1 to 0.32.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.32.1...v0.32.2)

Updates `k8s.io/client-go` from 0.32.1 to 0.32.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.32.1...v0.32.2)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/opencontainers/image-spec
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-12 15:20:42 +01:00
Aldo Lacuku 84d7fc852e fix(driver): build specific code only for linux platform
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2025-03-12 15:03:42 +01:00
dependabot[bot] a420868063 chore(deps): Bump the actions group with 5 updates
Bumps the actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.4.0` | `3.6.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.9.0` | `3.10.0` |
| [docker/metadata-action](https://github.com/docker/metadata-action) | `5.6.1` | `5.7.0` |
| [docker/build-push-action](https://github.com/docker/build-push-action) | `6.14.0` | `6.15.0` |
| [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) | `2.0.0` | `2.1.0` |


Updates `docker/setup-qemu-action` from 3.4.0 to 3.6.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](4574d27a47...29109295f8)

Updates `docker/setup-buildx-action` from 3.9.0 to 3.10.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](f7ce87c1d6...b5ca514318)

Updates `docker/metadata-action` from 5.6.1 to 5.7.0
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](369eb591f4...902fa8ec7d)

Updates `docker/build-push-action` from 6.14.0 to 6.15.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](0adf995921...471d1dc4e0)

Updates `slsa-framework/slsa-github-generator` from 2.0.0 to 2.1.0
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: slsa-framework/slsa-github-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 08:40:53 +01:00
dependabot[bot] dabadcec4f chore(deps): Bump github.com/go-jose/go-jose/v3 from 3.0.3 to 3.0.4
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.3 to 3.0.4.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.3...v3.0.4)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-27 08:30:30 +01:00
dependabot[bot] 68484cd32b chore(deps): Bump github.com/go-jose/go-jose/v4 from 4.0.4 to 4.0.5
Bumps [github.com/go-jose/go-jose/v4](https://github.com/go-jose/go-jose) from 4.0.4 to 4.0.5.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v4.0.4...v4.0.5)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-25 09:06:20 +01:00
dependabot[bot] 3319e217d0 chore(deps): Bump the actions group with 3 updates
Bumps the actions group with 3 updates: [docker/build-push-action](https://github.com/docker/build-push-action), [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `docker/build-push-action` from 6.13.0 to 6.14.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](ca877d9245...0adf995921)

Updates `sigstore/cosign-installer` from 3.8.0 to 3.8.1
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](c56c2d3e59...d7d6bc7722)

Updates `actions/upload-artifact` from 4.6.0 to 4.6.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65c4c4a1dd...4cec3d8aa0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 08:38:13 +01:00
dependabot[bot] 99e76506f0 chore(deps): Bump the actions group with 3 updates
Bumps the actions group with 3 updates: [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials), [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) and [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action).


Updates `aws-actions/configure-aws-credentials` from 4.0.3 to 4.1.0
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](4fc4975a85...ececac1a45)

Updates `golangci/golangci-lint-action` from 6.3.1 to 6.5.0
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](2e788936b0...2226d7cb06)

Updates `goreleaser/goreleaser-action` from 6.1.0 to 6.2.1
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](9ed2f89a66...90a3faa9d0)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 10:11:32 +01:00
Aldo Lacuku 4da81510d1 fix(CI): remove deprecated configuration from .golangci.yml
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2025-02-17 09:51:31 +01:00
dependabot[bot] 1a71698e3f chore(deps): Bump github.com/spf13/cobra from 1.8.1 to 1.9.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.1 to 1.9.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.1...v1.9.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 08:56:31 +01:00
dependabot[bot] 94b56ea805 chore(deps): Bump golang.org/x/net from 0.34.0 to 0.35.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.34.0 to 0.35.0.
- [Commits](https://github.com/golang/net/compare/v0.34.0...v0.35.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 08:54:31 +01:00
dependabot[bot] ec3025e878 chore(deps): Bump github.com/distribution/distribution/v3
Bumps [github.com/distribution/distribution/v3](https://github.com/distribution/distribution) from 3.0.0-rc.2 to 3.0.0-rc.3.
- [Release notes](https://github.com/distribution/distribution/releases)
- [Commits](https://github.com/distribution/distribution/compare/v3.0.0-rc.2...v3.0.0-rc.3)

---
updated-dependencies:
- dependency-name: github.com/distribution/distribution/v3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-13 10:05:09 +01:00
dependabot[bot] 6c71d1551e chore(deps): Bump golang.org/x/oauth2 from 0.25.0 to 0.26.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.25.0 to 0.26.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.25.0...v0.26.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 10:22:52 +01:00
dependabot[bot] d715341096 chore(deps): Bump golang.org/x/crypto from 0.32.0 to 0.33.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/crypto/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 10:11:51 +01:00
dependabot[bot] 335e365a78 chore(deps): Bump golang.org/x/sys from 0.29.0 to 0.30.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.29.0 to 0.30.0.
- [Commits](https://github.com/golang/sys/compare/v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 10:00:51 +01:00
Aldo Lacuku 946d8f7b05 Revert "chore(deps): Bump the gomod group with 2 updates"
This reverts commit 6bcfad674e.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2025-02-10 09:35:51 +01:00
dependabot[bot] 088e2b45ec chore(deps): Bump the actions group with 5 updates
Bumps the actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.3.0` | `3.4.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.8.0` | `3.9.0` |
| [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) | `3.7.0` | `3.8.0` |
| [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) | `6.2.0` | `6.3.1` |
| [slsa-framework/slsa-verifier](https://github.com/slsa-framework/slsa-verifier) | `2.6.0` | `2.7.0` |


Updates `docker/setup-qemu-action` from 3.3.0 to 3.4.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](53851d1459...4574d27a47)

Updates `docker/setup-buildx-action` from 3.8.0 to 3.9.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](6524bf65af...f7ce87c1d6)

Updates `sigstore/cosign-installer` from 3.7.0 to 3.8.0
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](dc72c7d5c4...c56c2d3e59)

Updates `golangci/golangci-lint-action` from 6.2.0 to 6.3.1
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](ec5d18412c...2e788936b0)

Updates `slsa-framework/slsa-verifier` from 2.6.0 to 2.7.0
- [Release notes](https://github.com/slsa-framework/slsa-verifier/releases)
- [Changelog](https://github.com/slsa-framework/slsa-verifier/blob/main/RELEASE.md)
- [Commits](https://github.com/slsa-framework/slsa-verifier/compare/v2.6.0...v2.7.0)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: slsa-framework/slsa-verifier
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 09:20:51 +01:00
dependabot[bot] 6bcfad674e chore(deps): Bump the gomod group with 2 updates
Bumps the gomod group with 2 updates: [github.com/cilium/ebpf](https://github.com/cilium/ebpf) and [github.com/spf13/pflag](https://github.com/spf13/pflag).


Updates `github.com/cilium/ebpf` from 0.17.1 to 0.17.2
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.17.1...v0.17.2)

Updates `github.com/spf13/pflag` from 1.0.5 to 1.0.6
- [Release notes](https://github.com/spf13/pflag/releases)
- [Commits](https://github.com/spf13/pflag/compare/v1.0.5...v1.0.6)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/spf13/pflag
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 09:54:06 +01:00
dependabot[bot] f9734bb752 chore(deps): Bump aws-actions/configure-aws-credentials
Bumps the actions group with 1 update: [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials).


Updates `aws-actions/configure-aws-credentials` from 4.0.2 to 4.0.3
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](e3dd6a429d...4fc4975a85)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 08:46:06 +01:00
Tiago Martins dc7634cc28 fix(follow): file handling of artifacts with directories
Signed-off-by: Tiago Martins <tiago.martins@hotjar.com>
2025-01-27 10:56:31 +01:00
dependabot[bot] e71898ce53 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [docker/build-push-action](https://github.com/docker/build-push-action) and [actions/setup-go](https://github.com/actions/setup-go).


Updates `docker/build-push-action` from 6.12.0 to 6.13.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](67a2d409c0...ca877d9245)

Updates `actions/setup-go` from 5.2.0 to 5.3.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](3041bf56c9...f111f3307d)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 08:51:30 +01:00
dependabot[bot] 8a4febabe5 chore(deps): Bump the gomod group with 2 updates
Bumps the gomod group with 2 updates: [github.com/docker/cli](https://github.com/docker/cli) and [github.com/docker/docker](https://github.com/docker/docker).


Updates `github.com/docker/cli` from 27.5.0+incompatible to 27.5.1+incompatible
- [Commits](https://github.com/docker/cli/compare/v27.5.0...v27.5.1)

Updates `github.com/docker/docker` from 27.5.0+incompatible to 27.5.1+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v27.5.0...v27.5.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 08:43:30 +01:00
dependabot[bot] cd992ad99c chore(deps): Bump the gomod group with 5 updates
Bumps the gomod group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.55.5` | `1.55.6` |
| [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) | `0.20.2` | `0.20.3` |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.32.0` | `0.32.1` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.32.0` | `0.32.1` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.32.0` | `0.32.1` |


Updates `github.com/aws/aws-sdk-go` from 1.55.5 to 1.55.6
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG_PENDING.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.55.5...v1.55.6)

Updates `github.com/google/go-containerregistry` from 0.20.2 to 0.20.3
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.20.2...v0.20.3)

Updates `k8s.io/api` from 0.32.0 to 0.32.1
- [Commits](https://github.com/kubernetes/api/compare/v0.32.0...v0.32.1)

Updates `k8s.io/apimachinery` from 0.32.0 to 0.32.1
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.32.0...v0.32.1)

Updates `k8s.io/client-go` from 0.32.0 to 0.32.1
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.32.0...v0.32.1)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-20 09:05:47 +01:00
dependabot[bot] 730f80f471 chore(deps): Bump the actions group with 5 updates
Bumps the actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.2.0` | `3.3.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.7.1` | `3.8.0` |
| [docker/build-push-action](https://github.com/docker/build-push-action) | `6.10.0` | `6.12.0` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.4.3` | `4.6.0` |
| [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) | `6.1.1` | `6.2.0` |


Updates `docker/setup-qemu-action` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](49b3bc8e6b...53851d1459)

Updates `docker/setup-buildx-action` from 3.7.1 to 3.8.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](c47758b77c...6524bf65af)

Updates `docker/build-push-action` from 6.10.0 to 6.12.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](48aba3b46d...67a2d409c0)

Updates `actions/upload-artifact` from 4.4.3 to 4.6.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](b4b15b8c7c...65c4c4a1dd)

Updates `golangci/golangci-lint-action` from 6.1.1 to 6.2.0
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](971e284b60...ec5d18412c)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-20 08:58:48 +01:00
dependabot[bot] 18c4322102 chore(deps): Bump the gomod group across 1 directory with 5 updates
Bumps the gomod group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore) | `1.8.11` | `1.8.12` |
| [github.com/sigstore/sigstore/pkg/signature/kms/aws](https://github.com/sigstore/sigstore) | `1.8.11` | `1.8.12` |
| [github.com/sigstore/sigstore/pkg/signature/kms/azure](https://github.com/sigstore/sigstore) | `1.8.11` | `1.8.12` |
| [github.com/sigstore/sigstore/pkg/signature/kms/gcp](https://github.com/sigstore/sigstore) | `1.8.11` | `1.8.12` |
| [github.com/sigstore/sigstore/pkg/signature/kms/hashivault](https://github.com/sigstore/sigstore) | `1.8.11` | `1.8.12` |



Updates `github.com/sigstore/sigstore` from 1.8.11 to 1.8.12
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.11...v1.8.12)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/aws` from 1.8.11 to 1.8.12
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.11...v1.8.12)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/azure` from 1.8.11 to 1.8.12
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.11...v1.8.12)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/gcp` from 1.8.11 to 1.8.12
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.11...v1.8.12)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/hashivault` from 1.8.11 to 1.8.12
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.11...v1.8.12)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/aws
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/azure
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/gcp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/hashivault
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-13 07:37:37 +01:00
dependabot[bot] 769a3e5683 chore(deps): Bump cloud.google.com/go/storage from 1.49.0 to 1.50.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.49.0 to 1.50.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.49.0...spanner/v1.50.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-13 07:35:38 +01:00
dependabot[bot] 38f2b1d703 chore(deps): Bump golang.org/x/net from 0.33.0 to 0.34.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-13 07:27:37 +01:00
dependabot[bot] ba2730f048 chore(deps): Bump k8s.io/client-go from 0.31.3 to 0.32.0
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.31.3 to 0.32.0.
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.31.3...v0.32.0)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-09 19:02:46 +01:00
dependabot[bot] b6e47e6ea5 chore(deps): Bump k8s.io/apimachinery from 0.31.3 to 0.32.0
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.31.3 to 0.32.0.
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.3...v0.32.0)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-09 18:53:46 +01:00
Aldo Lacuku 84edb08963 chore(go.mod): bump go version to 1.23.4
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2025-01-09 18:24:46 +01:00
dependabot[bot] 6bcda9881d chore(deps): Bump golang.org/x/oauth2 from 0.24.0 to 0.25.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.24.0 to 0.25.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-07 09:48:33 +01:00
dependabot[bot] 186b281e71 chore(deps): Bump golang.org/x/term from 0.27.0 to 0.28.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/term/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 09:09:27 +01:00
dependabot[bot] 2b11bc95df chore(deps): Bump golang.org/x/sys from 0.28.0 to 0.29.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.28.0 to 0.29.0.
- [Commits](https://github.com/golang/sys/compare/v0.28.0...v0.29.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 08:49:26 +01:00
dependabot[bot] c1ac24469d chore(deps): Bump github.com/onsi/ginkgo/v2 in the gomod group
Bumps the gomod group with 1 update: [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo).


Updates `github.com/onsi/ginkgo/v2` from 2.22.1 to 2.22.2
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.22.1...v2.22.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 08:48:27 +01:00
dependabot[bot] bbdf8ac2f2 chore(deps): Bump github.com/onsi/gomega in the gomod group
Bumps the gomod group with 1 update: [github.com/onsi/gomega](https://github.com/onsi/gomega).


Updates `github.com/onsi/gomega` from 1.36.1 to 1.36.2
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.36.1...v1.36.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-30 08:52:48 +01:00
dependabot[bot] 310a119170 chore(deps): Bump cloud.google.com/go/storage from 1.48.0 to 1.49.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.48.0 to 1.49.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.48.0...spanner/v1.49.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-30 08:34:48 +01:00
dependabot[bot] f222cf4174 chore(deps): Bump github.com/distribution/distribution/v3
Bumps [github.com/distribution/distribution/v3](https://github.com/distribution/distribution) from 3.0.0-rc.1 to 3.0.0-rc.2.
- [Release notes](https://github.com/distribution/distribution/releases)
- [Commits](https://github.com/distribution/distribution/compare/v3.0.0-rc.1...v3.0.0-rc.2)

---
updated-dependencies:
- dependency-name: github.com/distribution/distribution/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 09:36:11 +01:00
dependabot[bot] af1ebe264b chore(deps): Bump github.com/cilium/ebpf from 0.16.0 to 0.17.1
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.16.0 to 0.17.1.
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.16.0...v0.17.1)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 09:16:10 +01:00
dependabot[bot] 70dda77939 chore(deps): Bump the gomod group with 2 updates
Bumps the gomod group with 2 updates: [github.com/docker/docker](https://github.com/docker/docker) and [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo).


Updates `github.com/docker/docker` from 27.4.0+incompatible to 27.4.1+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v27.4.0...v27.4.1)

Updates `github.com/onsi/ginkgo/v2` from 2.22.0 to 2.22.1
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.22.0...v2.22.1)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 09:15:10 +01:00
dependabot[bot] 40b9e11683 chore(deps): Bump golang.org/x/net from 0.32.0 to 0.33.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 09:14:10 +01:00
dependabot[bot] be7d5c2a55 chore(deps): Bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 27.3.1+incompatible to 27.4.1+incompatible.
- [Commits](https://github.com/docker/cli/compare/v27.3.1...v27.4.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 08:59:11 +01:00
dependabot[bot] 6f64f37774 chore(deps): Bump google.golang.org/api from 0.210.0 to 0.211.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.210.0 to 0.211.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.210.0...v0.211.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 09:18:32 +01:00
dependabot[bot] 9dafcec9af chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 27.3.1+incompatible to 27.4.0+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v27.3.1...v27.4.0)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 09:03:32 +01:00
dependabot[bot] 6f241ae803 chore(deps): Bump actions/setup-go in the actions group
Bumps the actions group with 1 update: [actions/setup-go](https://github.com/actions/setup-go).


Updates `actions/setup-go` from 5.1.0 to 5.2.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](41dfa10bad...3041bf56c9)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 09:02:32 +01:00
dependabot[bot] 5bf4186068 chore(deps): Bump the gomod group with 6 updates
Bumps the gomod group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/onsi/gomega](https://github.com/onsi/gomega) | `1.36.0` | `1.36.1` |
| [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore) | `1.8.10` | `1.8.11` |
| [github.com/sigstore/sigstore/pkg/signature/kms/aws](https://github.com/sigstore/sigstore) | `1.8.10` | `1.8.11` |
| [github.com/sigstore/sigstore/pkg/signature/kms/azure](https://github.com/sigstore/sigstore) | `1.8.10` | `1.8.11` |
| [github.com/sigstore/sigstore/pkg/signature/kms/gcp](https://github.com/sigstore/sigstore) | `1.8.10` | `1.8.11` |
| [github.com/sigstore/sigstore/pkg/signature/kms/hashivault](https://github.com/sigstore/sigstore) | `1.8.10` | `1.8.11` |


Updates `github.com/onsi/gomega` from 1.36.0 to 1.36.1
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.36.0...v1.36.1)

Updates `github.com/sigstore/sigstore` from 1.8.10 to 1.8.11
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.10...v1.8.11)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/aws` from 1.8.10 to 1.8.11
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.10...v1.8.11)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/azure` from 1.8.10 to 1.8.11
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.10...v1.8.11)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/gcp` from 1.8.10 to 1.8.11
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.10...v1.8.11)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/hashivault` from 1.8.10 to 1.8.11
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.10...v1.8.11)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/aws
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/azure
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/gcp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/hashivault
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 08:27:32 +01:00
dependabot[bot] 98c4183dd5 chore(deps): Bump golang.org/x/crypto from 0.30.0 to 0.31.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 16:21:12 +01:00
Aldo Lacuku 9f360e12dd update(linter): remove deprecated linters
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-12-12 16:11:13 +01:00
Aldo Lacuku a40d97f766 update(ci/linter): bump golangci-lint to v1.62.2
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-12-12 16:11:13 +01:00
Aldo Lacuku cdd984dbf2 update(makefile): bump golangci-lint to v1.62.2
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-12-12 16:11:13 +01:00
Aldo Lacuku 61d9c71d96 fix(mediaType): do not omit the original media type if not a well-known media type
While converting a media type to a human-friendly one, we omit the original
one when handling unknown media types. Usually, we convert
the media type when logging errors, so keeping the
original media type when reporting an error is important.
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-12-12 15:26:12 +01:00
dependabot[bot] 5776706e3c chore(deps): Bump github.com/falcosecurity/driverkit in the gomod group
Bumps the gomod group with 1 update: [github.com/falcosecurity/driverkit](https://github.com/falcosecurity/driverkit).


Updates `github.com/falcosecurity/driverkit` from 0.20.4 to 0.20.5
- [Release notes](https://github.com/falcosecurity/driverkit/releases)
- [Changelog](https://github.com/falcosecurity/driverkit/blob/master/RELEASE.md)
- [Commits](https://github.com/falcosecurity/driverkit/compare/v0.20.4...v0.20.5)

---
updated-dependencies:
- dependency-name: github.com/falcosecurity/driverkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 14:24:57 +01:00
dependabot[bot] 46a22251cd chore(deps): Bump golang.org/x/net from 0.31.0 to 0.32.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.31.0 to 0.32.0.
- [Commits](https://github.com/golang/net/compare/v0.31.0...v0.32.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 14:22:57 +01:00
dependabot[bot] 28ccc66497 chore(deps): Bump golang.org/x/term from 0.26.0 to 0.27.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.26.0 to 0.27.0.
- [Commits](https://github.com/golang/term/compare/v0.26.0...v0.27.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 14:21:57 +01:00
dependabot[bot] 4599fe26b8 chore(deps): Bump cloud.google.com/go/storage from 1.47.0 to 1.48.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.47.0 to 1.48.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.47.0...spanner/v1.48.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 14:07:57 +01:00
dependabot[bot] a06072bd76 chore(deps): Bump golang.org/x/sys from 0.27.0 to 0.28.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/sys/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 14:04:58 +01:00
dependabot[bot] 3967730442 chore(deps): Bump docker/build-push-action in the actions group
Bumps the actions group with 1 update: [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `docker/build-push-action` from 6.9.0 to 6.10.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](4f58ea7922...48aba3b46d)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-02 09:49:19 +01:00
dependabot[bot] 076aef28c1 chore(deps): Bump github.com/pterm/pterm in the gomod group
Bumps the gomod group with 1 update: [github.com/pterm/pterm](https://github.com/pterm/pterm).


Updates `github.com/pterm/pterm` from 0.12.79 to 0.12.80
- [Release notes](https://github.com/pterm/pterm/releases)
- [Commits](https://github.com/pterm/pterm/compare/v0.12.79...v0.12.80)

---
updated-dependencies:
- dependency-name: github.com/pterm/pterm
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-02 09:47:20 +01:00
dependabot[bot] cb7fd150ba chore(deps): Bump github.com/onsi/gomega from 1.35.1 to 1.36.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.35.1 to 1.36.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.35.1...v1.36.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-02 09:45:20 +01:00
dependabot[bot] afaa782db6 chore(deps): Bump docker/metadata-action in the actions group
Bumps the actions group with 1 update: [docker/metadata-action](https://github.com/docker/metadata-action).


Updates `docker/metadata-action` from 5.5.1 to 5.6.1
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](8e5442c4ef...369eb591f4)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 10:27:40 +01:00
dependabot[bot] cc97e5ebaa chore(deps): Bump github.com/stretchr/testify from 1.9.0 to 1.10.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 10:26:40 +01:00
dependabot[bot] c29cad76b0 chore(deps): Bump github.com/onsi/ginkgo/v2 from 2.21.0 to 2.22.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.21.0 to 2.22.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.21.0...v2.22.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 08:27:39 +01:00
dependabot[bot] 2604fe2228 chore(deps): Bump google.golang.org/api from 0.206.0 to 0.209.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.206.0 to 0.209.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.206.0...v0.209.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 08:13:39 +01:00
dependabot[bot] 1ac62368af chore(deps): Bump the gomod group with 3 updates
Bumps the gomod group with 3 updates: [k8s.io/api](https://github.com/kubernetes/api), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `k8s.io/api` from 0.31.2 to 0.31.3
- [Commits](https://github.com/kubernetes/api/compare/v0.31.2...v0.31.3)

Updates `k8s.io/apimachinery` from 0.31.2 to 0.31.3
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.2...v0.31.3)

Updates `k8s.io/client-go` from 0.31.2 to 0.31.3
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.31.2...v0.31.3)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 07:30:38 +01:00
Vincent 063491c111 fix(auth/gcp): ensure correct OAuth scope for Artifact Registry with service account
Adjusted OAuth scope to `https://www.googleapis.com/auth/cloud-platform` for compatibility with both service account and Workload Identity setups, resolving invalid scope errors when accessing Artifact Registry.

Signed-off-by: Vincent <evict@users.noreply.github.com>
2024-11-22 15:23:28 +01:00
Federico Di Pierro 5846155f97 update(go): bumped driverkit dep to v0.20.4.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-20 16:54:19 +01:00
Federico Di Pierro 131abecc4b fix(pkg/oci): fix Tags pagination support.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-11-20 15:03:18 +01:00
dependabot[bot] d35acb1b98 chore(deps): Bump cloud.google.com/go/storage from 1.46.0 to 1.47.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.46.0 to 1.47.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.46.0...spanner/v1.47.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 17:23:13 +01:00
dependabot[bot] 2e87813a52 chore(deps): Bump google.golang.org/api from 0.205.0 to 0.206.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.205.0 to 0.206.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.205.0...v0.206.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 08:11:09 +01:00
dependabot[bot] eb9e67af1f chore(deps): Bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.0...v4.5.1)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-12 09:58:46 +01:00
dependabot[bot] 029726ec5d chore(deps): Bump golang.org/x/oauth2 from 0.23.0 to 0.24.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.23.0 to 0.24.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.23.0...v0.24.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 10:33:41 +01:00
dependabot[bot] ad33f00b56 chore(deps): Bump github.com/distribution/distribution/v3
Bumps [github.com/distribution/distribution/v3](https://github.com/distribution/distribution) from 3.0.0-beta.1 to 3.0.0-rc.1.
- [Release notes](https://github.com/distribution/distribution/releases)
- [Commits](https://github.com/distribution/distribution/compare/v3.0.0-beta.1...v3.0.0-rc.1)

---
updated-dependencies:
- dependency-name: github.com/distribution/distribution/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 10:20:42 +01:00
dependabot[bot] 23094128e8 chore(deps): Bump golang.org/x/net from 0.30.0 to 0.31.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/net/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 10:12:41 +01:00
dependabot[bot] 3d077a8cac chore(deps): Bump golang.org/x/term from 0.25.0 to 0.26.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.25.0 to 0.26.0.
- [Commits](https://github.com/golang/term/compare/v0.25.0...v0.26.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 10:11:41 +01:00
dependabot[bot] 503961ae91 chore(deps): Bump google.golang.org/api from 0.204.0 to 0.205.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.204.0 to 0.205.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.204.0...v0.205.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 10:10:41 +01:00
dependabot[bot] b041a7c6df chore(deps): Bump goreleaser/goreleaser-action in the actions group
Bumps the actions group with 1 update: [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action).


Updates `goreleaser/goreleaser-action` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](286f3b13b1...9ed2f89a66)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 10:09:43 +01:00
dependabot[bot] c3cd34939b chore(deps): Bump github.com/onsi/ginkgo/v2 from 2.20.2 to 2.21.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.20.2 to 2.21.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.20.2...v2.21.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 09:29:03 +01:00
dependabot[bot] fb0a65a113 chore(deps): Bump google.golang.org/api from 0.200.0 to 0.204.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.200.0 to 0.204.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.200.0...v0.204.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 09:01:04 +01:00
dependabot[bot] f737d5f5ac chore(deps): Bump cloud.google.com/go/storage from 1.45.0 to 1.46.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.45.0 to 1.46.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.45.0...spanner/v1.46.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 07:32:02 +01:00
dependabot[bot] 59245fdd66 chore(deps): Bump github.com/onsi/gomega from 1.34.2 to 1.35.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.34.2 to 1.35.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.34.2...v1.35.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 07:31:03 +01:00
dependabot[bot] d6b1cfbff3 chore(deps): Bump k8s.io/client-go from 0.30.2 to 0.31.2
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.30.2 to 0.31.2.
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.30.2...v0.31.2)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:43:27 +01:00
dependabot[bot] f5722b9482 chore(deps): Bump github.com/sigstore/cosign/v2 from 2.2.4 to 2.4.1
Bumps [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign) from 2.2.4 to 2.4.1.
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.2.4...v2.4.1)

---
updated-dependencies:
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:42:27 +01:00
dependabot[bot] 7c57d3ee69 chore(deps): Bump github.com/onsi/ginkgo/v2 from 2.19.0 to 2.20.2
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.19.0 to 2.20.2.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.19.0...v2.20.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:38:27 +01:00
dependabot[bot] fac6f31c61 chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 27.1.1+incompatible to 27.3.1+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v27.1.1...v27.3.1)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:27:27 +01:00
dependabot[bot] 133952e1a6 chore(deps): Bump k8s.io/apimachinery from 0.30.2 to 0.31.2
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.30.2 to 0.31.2.
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.30.2...v0.31.2)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:26:27 +01:00
dependabot[bot] 1f19a08b6a chore(deps): Bump cloud.google.com/go/storage from 1.43.0 to 1.45.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.43.0 to 1.45.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.43.0...pubsub/v1.45.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:06:27 +01:00
dependabot[bot] c3a8850de6 chore(deps): Bump github.com/onsi/gomega from 1.33.1 to 1.34.2
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.33.1 to 1.34.2.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.33.1...v1.34.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:05:27 +01:00
dependabot[bot] ebafd49a81 chore(deps): Bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 27.1.1+incompatible to 27.3.1+incompatible.
- [Commits](https://github.com/docker/cli/compare/v27.1.1...v27.3.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:04:27 +01:00
dependabot[bot] 3662765ac3 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [actions/setup-go](https://github.com/actions/setup-go).


Updates `actions/checkout` from 4.2.1 to 4.2.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](eef61447b9...11bd71901b)

Updates `actions/setup-go` from 5.0.2 to 5.1.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0a12ed9d6a...41dfa10bad)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 08:47:27 +01:00
dependabot[bot] 46a47e0ef0 chore(deps): Bump github.com/cilium/ebpf from 0.15.0 to 0.16.0
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 08:46:28 +01:00
dependabot[bot] 3b3b535632 chore(deps): Bump github.com/distribution/distribution/v3
Bumps [github.com/distribution/distribution/v3](https://github.com/distribution/distribution) from 3.0.0-alpha.1 to 3.0.0-beta.1.
- [Release notes](https://github.com/distribution/distribution/releases)
- [Commits](https://github.com/distribution/distribution/compare/v3.0.0-alpha.1...v3.0.0-beta.1)

---
updated-dependencies:
- dependency-name: github.com/distribution/distribution/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 08:17:26 +01:00
Massimiliano Giovagnoli fad320efff chore(deps): align go.opentelemetry.io/otel/sdk/metric with otel/sdk v1.29.0
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2024-10-22 11:59:04 +02:00
cpanato 7a741b57a9 update go to 1.22.8
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-10-22 11:59:04 +02:00
dependabot[bot] 11b95ab75f chore(deps): Bump the gomod group across 1 directory with 11 updates
Bumps the gomod group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore) | `1.8.4` | `1.8.10` |
| [github.com/sigstore/sigstore/pkg/signature/kms/aws](https://github.com/sigstore/sigstore) | `1.8.4` | `1.8.10` |
| [github.com/sigstore/sigstore/pkg/signature/kms/azure](https://github.com/sigstore/sigstore) | `1.8.4` | `1.8.10` |
| [github.com/sigstore/sigstore/pkg/signature/kms/gcp](https://github.com/sigstore/sigstore) | `1.8.4` | `1.8.10` |
| [github.com/sigstore/sigstore/pkg/signature/kms/hashivault](https://github.com/sigstore/sigstore) | `1.8.4` | `1.8.10` |



Updates `github.com/sigstore/sigstore` from 1.8.4 to 1.8.10
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.4...v1.8.10)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/aws` from 1.8.4 to 1.8.10
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.4...v1.8.10)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/azure` from 1.8.4 to 1.8.10
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.4...v1.8.10)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/gcp` from 1.8.4 to 1.8.10
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.4...v1.8.10)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/hashivault` from 1.8.4 to 1.8.10
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.4...v1.8.10)

Updates `golang.org/x/crypto` from 0.24.0 to 0.28.0
- [Commits](https://github.com/golang/crypto/compare/v0.24.0...v0.28.0)

Updates `google.golang.org/api` from 0.186.0 to 0.200.0
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.186.0...v0.200.0)

Updates `golang.org/x/net` from 0.26.0 to 0.30.0
- [Commits](https://github.com/golang/net/compare/v0.26.0...v0.30.0)

Updates `golang.org/x/oauth2` from 0.21.0 to 0.23.0
- [Commits](https://github.com/golang/oauth2/compare/v0.21.0...v0.23.0)

Updates `golang.org/x/sys` from 0.21.0 to 0.26.0
- [Commits](https://github.com/golang/sys/compare/v0.21.0...v0.26.0)

Updates `golang.org/x/term` from 0.21.0 to 0.25.0
- [Commits](https://github.com/golang/term/compare/v0.21.0...v0.25.0)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/aws
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/azure
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/gcp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/hashivault
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-22 11:59:04 +02:00
dependabot[bot] b00c0bd462 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/checkout` from 4.2.0 to 4.2.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](d632683dd7...eef61447b9)

Updates `actions/upload-artifact` from 4.4.0 to 4.4.3
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](50769540e7...b4b15b8c7c)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-14 07:30:30 +02:00
Leonardo Grasso 4f562a2884 fix(cmd): relax file perms for Falco driver config override
Falco config files are not supposed to contain sensitive information, so read permissions are given to all users.
With this fix, the permissions of the config file for the driver engine override will be aligned to other Falco configs files under `/etc/falco`.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2024-10-08 18:17:10 +02:00
dependabot[bot] 7e06ca9fe2 chore(deps): Bump the actions group with 4 updates
Bumps the actions group with 4 updates: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [docker/build-push-action](https://github.com/docker/build-push-action), [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) and [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action).


Updates `docker/setup-buildx-action` from 3.6.1 to 3.7.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](988b5a0280...c47758b77c)

Updates `docker/build-push-action` from 6.8.0 to 6.9.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](32945a3392...4f58ea7922)

Updates `sigstore/cosign-installer` from 3.6.0 to 3.7.0
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](4959ce089c...dc72c7d5c4)

Updates `golangci/golangci-lint-action` from 6.1.0 to 6.1.1
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](aaa42aa062...971e284b60)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 07:28:02 +02:00
dependabot[bot] 0a0cd490c5 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `actions/checkout` from 4.1.7 to 4.2.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](692973e3d9...d632683dd7)

Updates `docker/build-push-action` from 6.7.0 to 6.8.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](5cd11c3a4c...32945a3392)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 09:10:31 +02:00
Aldo Lacuku 4fce8b537b fix(goreleaser): use latest tag when two tags point to the same commit
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-09-16 09:59:46 +02:00
Federico Di Pierro 9c510af202 update(go,pkg): updated driverkit to v0.20.3.
Moreover, removed useless line in cos distro.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-09-09 11:14:23 +02:00
Aldo Lacuku db496e591d update(driver/config): add new unit tests
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-09-04 14:38:04 +02:00
Aldo Lacuku 27d569627e update(driver/config)!: use the same logic to configure engine kind for different enviroments
When running in kubernetes, falcoctl does not update the falco config map but creates a new
specialized config file with the selected engine kind. The command expects the name of the Falco
configmap from which to read the Falco configuration. This is needed to avoid conflicts when multiple
Falco's are deployed in the same cluster and namespace. Keep in mind that this are breaking changes.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-09-04 14:38:04 +02:00
dependabot[bot] ce6e1eef36 chore(deps): Bump actions/upload-artifact in the actions group
Bumps the actions group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 4.3.6 to 4.4.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](834a144ee9...50769540e7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-02 10:04:54 +02:00
Aldo Lacuku e0d71e7da4 fix(auth/basic): bind pflags to viper only when required
Binding pflags to Viper too early will generate a faulty configuration
file for falcoctl. This commit ensures binding is done only when the
basic authentication command is called.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-08-26 13:15:25 +02:00
dependabot[bot] 7e6b79e9bd chore(deps): Bump the actions group across 1 directory with 3 updates
Bumps the actions group with 3 updates in the / directory: [docker/build-push-action](https://github.com/docker/build-push-action), [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `docker/build-push-action` from 6.5.0 to 6.7.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](5176d81f87...5cd11c3a4c)

Updates `sigstore/cosign-installer` from 3.5.0 to 3.6.0
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](59acb6260d...4959ce089c)

Updates `actions/upload-artifact` from 4.3.5 to 4.3.6
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](89ef406dd8...834a144ee9)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-20 14:46:45 +02:00
dependabot[bot] fcf4def293 chore(deps): Bump the actions group with 3 updates
Bumps the actions group with 3 updates: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action).


Updates `docker/setup-buildx-action` from 3.5.0 to 3.6.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](aa33708b10...988b5a0280)

Updates `actions/upload-artifact` from 4.3.4 to 4.3.5
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b2256b8c0...89ef406dd8)

Updates `golangci/golangci-lint-action` from 6.0.1 to 6.1.0
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](a4f60bb28d...aaa42aa062)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-05 09:37:39 +02:00
Lorenzo Susini 1632a2d4f7 update(OWNERS): remove new line
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Lorenzo Susini <49318629+loresuso@users.noreply.github.com>
2024-07-31 12:54:44 +02:00
Lorenzo Susini 7e05ec1b73 update(OWNERS): add loresuso to approvers
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-07-31 12:54:44 +02:00
dependabot[bot] 006301cd5a chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 27.0.3+incompatible to 27.1.1+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v27.0.3...v27.1.1)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-30 17:31:40 +02:00
Aldo Lacuku d1a3559878 chore(pkg): bump driverkit to 0.20.0
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-07-30 17:20:40 +02:00
dependabot[bot] 1a5aee911f chore(deps): Bump the actions group with 4 updates
Bumps the actions group with 4 updates: [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [docker/login-action](https://github.com/docker/login-action) and [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `docker/setup-qemu-action` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](5927c834f5...49b3bc8e6b)

Updates `docker/setup-buildx-action` from 3.4.0 to 3.5.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](4fd812986e...aa33708b10)

Updates `docker/login-action` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](0d4c9c5ea7...9780b0c442)

Updates `docker/build-push-action` from 6.4.1 to 6.5.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](1ca370b3a9...5176d81f87)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-29 09:23:35 +02:00
dependabot[bot] 45af0b205a chore(deps): Bump goreleaser/goreleaser-action from 5.1.0 to 6.0.0
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5.1.0 to 6.0.0.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](5742e2a039...286f3b13b1)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-25 15:21:17 +02:00
Aldo Lacuku 73bfdb5b56 update(.goreleaser): bump version to v2
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-07-25 15:20:16 +02:00
dependabot[bot] cfe101856a chore(deps): Bump slsa-framework/slsa-verifier in the actions group
Bumps the actions group with 1 update: [slsa-framework/slsa-verifier](https://github.com/slsa-framework/slsa-verifier).


Updates `slsa-framework/slsa-verifier` from 2.5.1 to 2.6.0
- [Release notes](https://github.com/slsa-framework/slsa-verifier/releases)
- [Changelog](https://github.com/slsa-framework/slsa-verifier/blob/main/RELEASE.md)
- [Commits](https://github.com/slsa-framework/slsa-verifier/compare/v2.5.1...v2.6.0)

---
updated-dependencies:
- dependency-name: slsa-framework/slsa-verifier
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-25 14:38:16 +02:00
dependabot[bot] 2dcedc0511 chore(deps): Bump docker/build-push-action from 5.4.0 to 6.4.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5.4.0 to 6.4.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](ca052bb54a...1ca370b3a9)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-25 14:37:16 +02:00
Aldo Lacuku d2a010445f fix(push): use basename for artifacts when compressed in tar.gz
When the artifact to be pushed has a folder in its path the full
name is used in the tar headers. This is an issue when we install the
artifact. This commits adds a flag that uses the basename when compressing
the artifact in the tar header.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-07-24 16:59:09 +02:00
Aldo Lacuku 36b951fff3 chore(Makefile): add .PHONY to falcoctl target
The target will run independent from the state of the file.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-07-24 15:53:09 +02:00
Brenno Oliveira 228cb06d4f Add support for S3 index storage backend
Signed-off-by: Brenno Oliveira <brenno.oliveira@deliveryhero.com>
2024-07-24 14:30:10 +02:00
Lorenzo Susini f55a5e6a06 fix: allow login to express registry as ref but actually extract the registry
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-07-23 16:41:45 +02:00
dependabot[bot] fc648dcf0e chore(deps): Bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 26.1.4+incompatible to 27.0.2+incompatible.
- [Commits](https://github.com/docker/cli/compare/v26.1.4...v27.0.2)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-18 16:09:28 +02:00
dependabot[bot] 8c56a3c85c chore(deps): Bump the actions group across 1 directory with 4 updates
Bumps the actions group with 4 updates in the / directory: [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [actions/setup-go](https://github.com/actions/setup-go) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `docker/setup-qemu-action` from 3.0.0 to 3.1.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](68827325e0...5927c834f5)

Updates `docker/setup-buildx-action` from 3.3.0 to 3.4.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](d70bba72b1...4fd812986e)

Updates `actions/setup-go` from 5.0.1 to 5.0.2
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](cdcb360436...0a12ed9d6a)

Updates `actions/upload-artifact` from 4.3.3 to 4.3.4
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65462800fd...0b2256b8c0)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-15 09:15:07 +02:00
dependabot[bot] 1f8d186326 chore(deps): Bump google.golang.org/grpc from 1.64.0 to 1.64.1
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.64.0 to 1.64.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.64.0...v1.64.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-10 09:11:43 +02:00
Aldo Lacuku 913d8b44eb feat(dockerfile): use distroless image for falcoctl docker image
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-07-04 11:30:21 +02:00
Aldo Lacuku ee92cbf49b chore(go.mod): bump go version to 1.22.5
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-07-04 11:12:21 +02:00
Federico Di Pierro 150ef391f5 chore(cmd/driver,pkg/driver): allow to disable kernel headers automatic download.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-07-02 10:22:12 +02:00
dependabot[bot] 76be634364 chore(deps): Bump google.golang.org/api from 0.185.0 to 0.186.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.185.0 to 0.186.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.185.0...v0.186.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 14:05:10 +02:00
dependabot[bot] 096b8eaac2 chore(deps): Bump github.com/hashicorp/go-retryablehttp
Bumps [github.com/hashicorp/go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) from 0.7.6 to 0.7.7.
- [Changelog](https://github.com/hashicorp/go-retryablehttp/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/go-retryablehttp/compare/v0.7.6...v0.7.7)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-retryablehttp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-25 09:52:36 +02:00
dependabot[bot] d6dd5cdf2f chore(deps): Bump google.golang.org/api from 0.184.0 to 0.185.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.184.0 to 0.185.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.184.0...v0.185.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-24 08:53:30 +02:00
dependabot[bot] 11182eb1b8 chore(deps): Bump github.com/Azure/azure-sdk-for-go/sdk/azidentity
Bumps [github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://github.com/Azure/azure-sdk-for-go) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/Azure/azure-sdk-for-go/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md)
- [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/internal/v1.5.2...sdk/azcore/v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/Azure/azure-sdk-for-go/sdk/azidentity
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 09:37:04 +02:00
Aldo Lacuku 1b6596b5f2 feat(auth/basic): extend auth basic command
Username and password can be set using cli flags, env variables and stdin.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-06-17 13:59:00 +02:00
dependabot[bot] dbf56c0a2c chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `actions/checkout` from 4.1.6 to 4.1.7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](a5ac7e51b4...692973e3d9)

Updates `docker/build-push-action` from 5.3.0 to 5.4.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](2cdde995de...ca052bb54a)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:30:59 +02:00
dependabot[bot] f5ebba87f8 chore(deps): Bump the gomod group with 4 updates
Bumps the gomod group with 4 updates: [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry), [github.com/spf13/cobra](https://github.com/spf13/cobra), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `github.com/google/go-containerregistry` from 0.19.1 to 0.19.2
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.19.1...v0.19.2)

Updates `github.com/spf13/cobra` from 1.8.0 to 1.8.1
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.0...v1.8.1)

Updates `k8s.io/apimachinery` from 0.30.1 to 0.30.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.30.1...v0.30.2)

Updates `k8s.io/client-go` from 0.30.1 to 0.30.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.30.1...v0.30.2)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:28:59 +02:00
dependabot[bot] cd5ac2c073 chore(deps): Bump cloud.google.com/go/storage from 1.41.0 to 1.42.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.41.0 to 1.42.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.41.0...spanner/v1.42.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:25:59 +02:00
dependabot[bot] d7d61f4a55 chore(deps): Bump google.golang.org/api from 0.183.0 to 0.184.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.183.0 to 0.184.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.183.0...v0.184.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 09:04:59 +02:00
dependabot[bot] eb8fbb741e chore(deps): Bump the gomod group with 2 updates
Bumps the gomod group with 2 updates: [github.com/docker/cli](https://github.com/docker/cli) and [github.com/docker/docker](https://github.com/docker/docker).


Updates `github.com/docker/cli` from 26.1.3+incompatible to 26.1.4+incompatible
- [Commits](https://github.com/docker/cli/compare/v26.1.3...v26.1.4)

Updates `github.com/docker/docker` from 26.1.3+incompatible to 26.1.4+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.3...v26.1.4)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 15:00:35 +02:00
dependabot[bot] 9d429de90d chore(deps): Bump golang.org/x/net from 0.25.0 to 0.26.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.25.0 to 0.26.0.
- [Commits](https://github.com/golang/net/compare/v0.25.0...v0.26.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 09:45:33 +02:00
dependabot[bot] f82978f817 chore(deps): Bump golang.org/x/term from 0.20.0 to 0.21.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.20.0 to 0.21.0.
- [Commits](https://github.com/golang/term/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 09:43:33 +02:00
dependabot[bot] ab0bebd8b3 chore(deps): Bump google.golang.org/api from 0.182.0 to 0.183.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.182.0 to 0.183.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.182.0...v0.183.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 09:16:33 +02:00
dependabot[bot] 0d663fc1c6 chore(deps): Bump golang.org/x/sys from 0.20.0 to 0.21.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.20.0 to 0.21.0.
- [Commits](https://github.com/golang/sys/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 09:07:33 +02:00
dependabot[bot] 219f3d7955 chore(deps): Bump the gomod group with 5 updates
Bumps the gomod group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore) | `1.8.3` | `1.8.4` |
| [github.com/sigstore/sigstore/pkg/signature/kms/aws](https://github.com/sigstore/sigstore) | `1.8.3` | `1.8.4` |
| [github.com/sigstore/sigstore/pkg/signature/kms/azure](https://github.com/sigstore/sigstore) | `1.8.3` | `1.8.4` |
| [github.com/sigstore/sigstore/pkg/signature/kms/gcp](https://github.com/sigstore/sigstore) | `1.8.3` | `1.8.4` |
| [github.com/sigstore/sigstore/pkg/signature/kms/hashivault](https://github.com/sigstore/sigstore) | `1.8.3` | `1.8.4` |


Updates `github.com/sigstore/sigstore` from 1.8.3 to 1.8.4
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.3...v1.8.4)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/aws` from 1.8.3 to 1.8.4
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.3...v1.8.4)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/azure` from 1.8.3 to 1.8.4
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.3...v1.8.4)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/gcp` from 1.8.3 to 1.8.4
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.3...v1.8.4)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/hashivault` from 1.8.3 to 1.8.4
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.3...v1.8.4)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/aws
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/azure
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/gcp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/hashivault
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-04 12:31:13 +02:00
dependabot[bot] 6c5f43833f chore(deps): Bump docker/login-action in the actions group
Bumps the actions group with 1 update: [docker/login-action](https://github.com/docker/login-action).


Updates `docker/login-action` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](e92390c5fb...0d4c9c5ea7)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-04 12:02:13 +02:00
dependabot[bot] 72e7129727 chore(deps): Bump google.golang.org/api from 0.181.0 to 0.182.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.181.0 to 0.182.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.181.0...v0.182.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-04 12:01:13 +02:00
dependabot[bot] addd0cd577 chore(deps): Bump github.com/spf13/viper from 1.18.2 to 1.19.0
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.18.2 to 1.19.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.18.2...v1.19.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-04 12:00:14 +02:00
dependabot[bot] 5cb609d1f9 chore(deps): Bump github.com/onsi/ginkgo/v2 from 2.17.3 to 2.19.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.17.3 to 2.19.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.17.3...v2.19.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-29 09:22:49 +02:00
dependabot[bot] 048e8a1375 chore(deps): Bump google.golang.org/api from 0.180.0 to 0.181.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.180.0 to 0.181.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.180.0...v0.181.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 08:32:13 +02:00
dependabot[bot] dd7b7169a4 chore(deps): Bump the gomod group with 4 updates
Bumps the gomod group with 4 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `github.com/docker/cli` from 26.1.2+incompatible to 26.1.3+incompatible
- [Commits](https://github.com/docker/cli/compare/v26.1.2...v26.1.3)

Updates `github.com/docker/docker` from 26.1.2+incompatible to 26.1.3+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.2...v26.1.3)

Updates `k8s.io/apimachinery` from 0.30.0 to 0.30.1
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.30.0...v0.30.1)

Updates `k8s.io/client-go` from 0.30.0 to 0.30.1
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.30.0...v0.30.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 08:31:13 +02:00
dependabot[bot] 5af9b5290a chore(deps): Bump actions/checkout in the actions group
Bumps the actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.5 to 4.1.6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](44c2b7a8a4...a5ac7e51b4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 08:30:13 +02:00
dependabot[bot] 655f0ea1d4 chore(deps): Bump cloud.google.com/go/storage from 1.40.0 to 1.41.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.40.0 to 1.41.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.40.0...spanner/v1.41.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 07:22:14 +02:00
Federico Di Pierro 6b4ddd46eb chore(pkg/driver): restored `uek` kernel check.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-17 14:16:57 +02:00
Federico Di Pierro ae5a30be6b chore(cmd,internal): expose FALCOCTL_DRIVER_CONFIG_UPDATE_FALCO env var.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-16 16:06:54 +02:00
Federico Di Pierro da932e4bc8 chore(cmd/driver): small improvements.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-16 10:26:54 +02:00
Federico Di Pierro 8ec7466b1c chore(cmd/driver): retry logic for k8s configmap Update on conflict.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-16 10:26:54 +02:00
Federico Di Pierro d3f4b8c902 fix(cmd/driver): use `update` command instead of `patch` to update configmap.
Moreover fixes some issues with the k8s config map updater.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-16 10:26:54 +02:00
Federico Di Pierro 6b870bc5ed new(cmd,internal): allow to pass driver config namespace flag from env.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-16 10:26:54 +02:00
Kevin Paulisse 04abd653ef feat: Add file backend to fetcher
Signed-off-by: Kevin Paulisse <kpaulisse@users.noreply.github.com>
2024-05-15 09:09:50 +02:00
dependabot[bot] 8fb4c37130 chore(deps): Bump golangci/golangci-lint-action from 5.3.0 to 6.0.1
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5.3.0 to 6.0.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](38e1018663...a4f60bb28d)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-14 15:29:46 +02:00
dependabot[bot] f660a9bca0 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action).


Updates `actions/checkout` from 4.1.4 to 4.1.5
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](0ad4b8fada...44c2b7a8a4)

Updates `goreleaser/goreleaser-action` from 5.0.0 to 5.1.0
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](7ec5c2b0c6...5742e2a039)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-13 13:56:43 +02:00
Kevin Paulisse 9584f0e57a Add --platform option to artifact/install
Signed-off-by: Kevin Paulisse <kpaulisse@users.noreply.github.com>
2024-05-13 13:14:43 +02:00
dependabot[bot] ffbdac3d85 chore(deps): Bump the gomod group with 3 updates
Bumps the gomod group with 3 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker) and [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo).


Updates `github.com/docker/cli` from 26.1.1+incompatible to 26.1.2+incompatible
- [Commits](https://github.com/docker/cli/compare/v26.1.1...v26.1.2)

Updates `github.com/docker/docker` from 26.1.1+incompatible to 26.1.2+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.1...v26.1.2)

Updates `github.com/onsi/ginkgo/v2` from 2.17.2 to 2.17.3
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.17.2...v2.17.3)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-13 09:32:42 +02:00
dependabot[bot] 352ceeb019 chore(deps): Bump google.golang.org/api from 0.178.0 to 0.180.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.178.0 to 0.180.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.178.0...v0.180.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-13 09:30:43 +02:00
Federico Di Pierro ff7bc7817e chore(go): bumped driverkit to v0.19.2.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-10 18:19:33 +02:00
Federico Di Pierro 0469ee9353 chore(pkg/distro): driverkit does validate env now.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-10 18:19:33 +02:00
Federico Di Pierro 30429211f5 chore(cmd/driver): remove redundant log.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-09 18:09:59 +02:00
Federico Di Pierro 7982692c6d fix(pkg/driver): create envmap if nil since driverkit expects it.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 17:28:54 +02:00
Federico Di Pierro d0523cae9d update(go): bumped all deps.
This was needed because of a cross-deps build issue because of versions mismatches.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 15:51:55 +02:00
Federico Di Pierro 00d41694af update(go): bumped driverkit to v0.19.1.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 15:51:55 +02:00
Federico Di Pierro bf405ec0d1 chore(go,pkg/driver): bumped driverkit to https://github.com/falcosecurity/driverkit/pull/342.
This fixes the build.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 15:51:55 +02:00
Federico Di Pierro d772260f9b update: bumped driverkit to v0.19.0.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 15:51:55 +02:00
Federico Di Pierro 67e2bb4e28 chore(pkg/driver): small refactor.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 15:51:55 +02:00
Federico Di Pierro 2524b16440 cleanup(pkg/driver): ported drivers build to use driverkit local builder logic.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-08 15:51:55 +02:00
Federico Di Pierro b98eff4e7a cleanup(cmd,pkg): moved `enum` to its own package.
Moreover, moved logLevel and logFormat enums under pkg/output.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-05-07 11:17:48 +02:00
dependabot[bot] cce5b80106 chore(deps): Bump github.com/cilium/ebpf from 0.14.0 to 0.15.0
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 10:14:48 +02:00
dependabot[bot] 64f00cd2dd chore(deps): Bump golang.org/x/term from 0.19.0 to 0.20.0
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.19.0 to 0.20.0.
- [Commits](https://github.com/golang/term/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 10:02:44 +02:00
dependabot[bot] ea3fe222cc chore(deps): Bump golang.org/x/oauth2 from 0.19.0 to 0.20.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.19.0 to 0.20.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 09:47:44 +02:00
dependabot[bot] 058f959467 chore(deps): Bump the gomod group with 3 updates
Bumps the gomod group with 3 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker) and [github.com/onsi/gomega](https://github.com/onsi/gomega).


Updates `github.com/docker/cli` from 26.1.0+incompatible to 26.1.1+incompatible
- [Commits](https://github.com/docker/cli/compare/v26.1.0...v26.1.1)

Updates `github.com/docker/docker` from 26.1.0+incompatible to 26.1.1+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.0...v26.1.1)

Updates `github.com/onsi/gomega` from 1.33.0 to 1.33.1
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.33.0...v1.33.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 09:38:44 +02:00
dependabot[bot] 913962c6cf chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/setup-go](https://github.com/actions/setup-go) and [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action).


Updates `actions/setup-go` from 5.0.0 to 5.0.1
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0c52d547c9...cdcb360436)

Updates `golangci/golangci-lint-action` from 5.0.0 to 5.3.0
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](82d40c283a...38e1018663)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 09:37:44 +02:00
dependabot[bot] aaf3c4d778 chore(deps): Bump google.golang.org/api from 0.176.1 to 0.177.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.176.1 to 0.177.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.176.1...v0.177.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 07:21:43 +02:00
Thomas Labarussias 27c653f9e5 add new boolean arg for 'registry push' --add-floating-tags, it will auto add the tags for the major and the minor versions
Signed-off-by: Thomas Labarussias <issif+github@gadz.org>
2024-05-02 17:09:57 +02:00
dependabot[bot] da9865e209 chore(deps): Bump slsa-framework/slsa-github-generator
Bumps [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) from 1.10.0 to 2.0.0.
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v1.10.0...v2.0.0)

---
updated-dependencies:
- dependency-name: slsa-framework/slsa-github-generator
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-30 11:54:50 +02:00
dependabot[bot] d2be4ab6b8 chore(deps): Bump google.golang.org/api from 0.175.0 to 0.176.1
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.175.0 to 0.176.1.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.175.0...v0.176.1)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 14:45:47 +02:00
dependabot[bot] c30089c970 chore(deps): Bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 26.0.2+incompatible to 26.1.0+incompatible.
- [Commits](https://github.com/docker/cli/compare/v26.0.2...v26.1.0)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 14:42:46 +02:00
dependabot[bot] 5bb003a24b chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 26.0.2+incompatible to 26.1.0+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.0.2...v26.1.0)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 14:31:46 +02:00
dependabot[bot] 72bc9dd259 chore(deps): Bump github.com/onsi/ginkgo/v2 in the gomod group
Bumps the gomod group with 1 update: [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo).


Updates `github.com/onsi/ginkgo/v2` from 2.17.1 to 2.17.2
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.17.1...v2.17.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 14:30:47 +02:00
dependabot[bot] d26a3eded2 chore(deps): Bump golangci/golangci-lint-action from 4.0.0 to 5.0.0
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](3cfe3a4abb...82d40c283a)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 10:00:46 +02:00
dependabot[bot] 10cb99c4c9 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/checkout` from 4.1.3 to 4.1.4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](1d96c772d1...0ad4b8fada)

Updates `actions/upload-artifact` from 4.3.2 to 4.3.3
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](1746f4ab65...65462800fd)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 09:57:46 +02:00
dependabot[bot] aefeac7221 chore(deps): Bump k8s.io/client-go from 0.29.3 to 0.30.0
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.29.3 to 0.30.0.
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.29.3...v0.30.0)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-23 15:43:20 +02:00
Aldo Lacuku 24c44967e8 chore(CI): use go.mod as source for go version
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-04-23 14:57:19 +02:00
dependabot[bot] 6de519341a chore(deps): Bump k8s.io/apimachinery from 0.29.3 to 0.30.0
Bumps [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) from 0.29.3 to 0.30.0.
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.29.3...v0.30.0)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-23 14:25:19 +02:00
Federico Di Pierro 38ea1a3aea fix(pkg/driver): fixed tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-23 09:55:17 +02:00
Federico Di Pierro 390edc9e54 fix(pkg/driver): avoid source of crash during distro Discovery.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-23 09:55:17 +02:00
dependabot[bot] f6b76de25c chore(deps): Bump google.golang.org/api from 0.172.0 to 0.175.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.172.0 to 0.175.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.172.0...v0.175.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-22 09:23:16 +02:00
dependabot[bot] da016311a5 chore(deps): Bump github.com/onsi/gomega from 1.32.0 to 1.33.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.32.0 to 1.33.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.32.0...v1.33.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-22 07:51:15 +02:00
dependabot[bot] c36c065856 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/checkout` from 4.1.2 to 4.1.3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](9bb56186c3...1d96c772d1)

Updates `actions/upload-artifact` from 4.3.1 to 4.3.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](5d5d22a312...1746f4ab65)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-22 07:48:15 +02:00
Federico Di Pierro f7bcb4af5c chore(internal): old ebpf probe must have lowest priority.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-19 10:52:56 +02:00
dependabot[bot] ecf420f9f7 chore(deps): Bump github.com/docker/cli in the gomod group
Bumps the gomod group with 1 update: [github.com/docker/cli](https://github.com/docker/cli).


Updates `github.com/docker/cli` from 26.0.0+incompatible to 26.0.2+incompatible
- [Commits](https://github.com/docker/cli/compare/v26.0.0...v26.0.2)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 10:18:56 +02:00
dependabot[bot] 5a9cc2909c chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 26.0.0+incompatible to 26.0.2+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.0.0...v26.0.2)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 09:19:56 +02:00
QJoly e5bc056ce6 fix: Add backend 'https' to default index
Signed-off-by: QJoly <quentinj@une-pause-cafe.fr>
2024-04-17 18:39:54 +02:00
dependabot[bot] 72decef12a chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) and [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer).


Updates `docker/setup-buildx-action` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](2b51285047...d70bba72b1)

Updates `sigstore/cosign-installer` from 3.4.0 to 3.5.0
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](e1523de757...59acb6260d)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-15 07:31:42 +02:00
Federico Di Pierro 7c36297edf chore(cmd): dropped leftover `experimental` for driver-loader.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-12 10:17:32 +02:00
dependabot[bot] 363047407e chore(deps): Bump github.com/sigstore/cosign/v2 from 2.2.3 to 2.2.4
Bumps [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign) from 2.2.3 to 2.2.4.
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.2.3...v2.2.4)

---
updated-dependencies:
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-12 09:00:31 +02:00
dependabot[bot] 3e10f205ef chore(deps): Bump golang.org/x/net from 0.22.0 to 0.24.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.22.0 to 0.24.0.
- [Commits](https://github.com/golang/net/compare/v0.22.0...v0.24.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 09:05:12 +02:00
dependabot[bot] f0827ad844 chore(deps): Bump golang.org/x/oauth2 from 0.18.0 to 0.19.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.18.0 to 0.19.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 07:47:11 +02:00
dependabot[bot] c73bac5113 chore(deps): Bump golang.org/x/crypto from 0.21.0 to 0.22.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.21.0 to 0.22.0.
- [Commits](https://github.com/golang/crypto/compare/v0.21.0...v0.22.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 07:34:11 +02:00
dependabot[bot] 358abeb70a chore(deps): Bump golang.org/x/sys from 0.18.0 to 0.19.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.18.0 to 0.19.0.
- [Commits](https://github.com/golang/sys/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 07:27:11 +02:00
Luca Guerra 75a2e12512 fix(install): fix missing dependency signature verification
Signed-off-by: Luca Guerra <luca@guerra.sh>
2024-04-04 15:01:58 +02:00
Federico Di Pierro 5d5b16f3fd fix(goreleaser): disable release build for windows i386.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-04 11:48:57 +02:00
Federico Di Pierro 7783ee535c cleanup(cmd/driver): drop preview tag.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-04 10:38:56 +02:00
Aldo Lacuku d94e19ec24 docs(OWNERS): add alacuku (Aldo Lacuku) to approvers
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-04-03 11:31:50 +02:00
Aldo Lacuku 388b8b02ba fix(artifact/info): filter out signature tags
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-04-03 10:37:49 +02:00
Federico Di Pierro 0296002808 chore(pkg/driver): bump driverkit to v0.18.2 and adjust kernel-download script helper.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-03 09:57:49 +02:00
Federico Di Pierro 4e3c510ed2 fix(pkg/driver): properly fixup KernelVersion before executing driverkit kernel download script template.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-04-03 09:57:49 +02:00
dependabot[bot] 1bda127c79 chore(deps): Bump google.golang.org/api from 0.171.0 to 0.172.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.171.0 to 0.172.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.171.0...v0.172.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 12:13:42 +02:00
dependabot[bot] c81c1b8c8b chore(deps): Bump the actions group with 1 update
Bumps the actions group with 1 update: [slsa-framework/slsa-verifier](https://github.com/slsa-framework/slsa-verifier).


Updates `slsa-framework/slsa-verifier` from 2.4.1 to 2.5.1
- [Release notes](https://github.com/slsa-framework/slsa-verifier/releases)
- [Changelog](https://github.com/slsa-framework/slsa-verifier/blob/main/RELEASE.md)
- [Commits](https://github.com/slsa-framework/slsa-verifier/compare/v2.4.1...v2.5.1)

---
updated-dependencies:
- dependency-name: slsa-framework/slsa-verifier
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 12:10:42 +02:00
dependabot[bot] 1c8c697051 chore(deps): Bump github.com/cilium/ebpf from 0.13.2 to 0.14.0
Bumps [github.com/cilium/ebpf](https://github.com/cilium/ebpf) from 0.13.2 to 0.14.0.
- [Release notes](https://github.com/cilium/ebpf/releases)
- [Commits](https://github.com/cilium/ebpf/compare/v0.13.2...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/cilium/ebpf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 12:08:42 +02:00
dependabot[bot] a46a849389 chore(deps): Bump the gomod group with 8 updates
Bumps the gomod group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/falcosecurity/driverkit](https://github.com/falcosecurity/driverkit) | `0.18.0` | `0.18.2` |
| [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore) | `1.8.2` | `1.8.3` |
| [github.com/sigstore/sigstore/pkg/signature/kms/aws](https://github.com/sigstore/sigstore) | `1.8.2` | `1.8.3` |
| [github.com/sigstore/sigstore/pkg/signature/kms/azure](https://github.com/sigstore/sigstore) | `1.8.2` | `1.8.3` |
| [github.com/sigstore/sigstore/pkg/signature/kms/gcp](https://github.com/sigstore/sigstore) | `1.8.2` | `1.8.3` |
| [github.com/sigstore/sigstore/pkg/signature/kms/hashivault](https://github.com/sigstore/sigstore) | `1.8.2` | `1.8.3` |
| [golang.org/x/exp](https://github.com/golang/exp) | `0.0.0-20240213143201-ec583247a57a` | `0.0.0-20240325151524-a685a6edb6d8` |
| [k8s.io/utils](https://github.com/kubernetes/utils) | `0.0.0-20240102154912-e7106e64919e` | `0.0.0-20240310230437-4693a0247e57` |


Updates `github.com/falcosecurity/driverkit` from 0.18.0 to 0.18.2
- [Release notes](https://github.com/falcosecurity/driverkit/releases)
- [Changelog](https://github.com/falcosecurity/driverkit/blob/master/RELEASE.md)
- [Commits](https://github.com/falcosecurity/driverkit/compare/v0.18.0...v0.18.2)

Updates `github.com/sigstore/sigstore` from 1.8.2 to 1.8.3
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.2...v1.8.3)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/aws` from 1.8.2 to 1.8.3
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.2...v1.8.3)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/azure` from 1.8.2 to 1.8.3
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.2...v1.8.3)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/gcp` from 1.8.2 to 1.8.3
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.2...v1.8.3)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/hashivault` from 1.8.2 to 1.8.3
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.2...v1.8.3)

Updates `golang.org/x/exp` from 0.0.0-20240213143201-ec583247a57a to 0.0.0-20240325151524-a685a6edb6d8
- [Commits](https://github.com/golang/exp/commits)

Updates `k8s.io/utils` from 0.0.0-20240102154912-e7106e64919e to 0.0.0-20240310230437-4693a0247e57
- [Commits](https://github.com/kubernetes/utils/commits)

---
updated-dependencies:
- dependency-name: github.com/falcosecurity/driverkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/aws
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/azure
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/gcp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/hashivault
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: golang.org/x/exp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/utils
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 12:06:42 +02:00
dependabot[bot] a1e10ab84a chore(deps): Bump cloud.google.com/go/storage from 1.39.1 to 1.40.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.39.1 to 1.40.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/storage/v1.39.1...spanner/v1.40.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 09:27:41 +02:00
Aldo Lacuku 92188837b5 chore(cmd/push): uniform receiver for push command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-03-29 11:41:24 +01:00
Federico Di Pierro 7a2d69e2e3 chore(cmd,pkg,internal): switch to use `oras-go` credentials package since `oras-go-credentials` is deprecated.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-28 09:42:15 +01:00
Federico Di Pierro 064c201df3 fix(cmd/driver,pkg/driver): fixed a check in install.go.
Moreover, added a couple of debug logs when automatically fetching headers.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-28 09:14:15 +01:00
Federico Di Pierro e596dea6bb chore: bumped driverkit to v0.18.0.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-28 09:14:15 +01:00
Federico Di Pierro 8f98b0db57 chore(pkg/driver): use `exec.LookPath` instead of `exec.Command("hash", ...)`.
Moreover, bumped driverkit to latest HEAD of PR324.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-28 09:14:15 +01:00
Federico Di Pierro d5539af528 new(pkg): implemented kernel headers automatic download + extraction.
Also, bumped driverkit to https://github.com/falcosecurity/driverkit/pull/324 HEAD.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-28 09:14:15 +01:00
Federico Di Pierro 1c6ab282db new(pkg/driver): initial work towards kernel headers download leveraging driverkit library when building drivers.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-28 09:14:15 +01:00
dependabot[bot] c2dead34f1 chore(deps): Bump github.com/onsi/ginkgo/v2 from 2.16.0 to 2.17.1
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.16.0 to 2.17.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.16.0...v2.17.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 11:08:05 +01:00
dependabot[bot] 72a5d38754 chore(deps): Bump oras.land/oras-go/v2 from 2.4.0 to 2.5.0
Bumps [oras.land/oras-go/v2](https://github.com/oras-project/oras-go) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/oras-project/oras-go/releases)
- [Commits](https://github.com/oras-project/oras-go/compare/v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: oras.land/oras-go/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 11:07:05 +01:00
Mark Gerard a89aa89890 chore(docco): Add Homebrew as a MacOS install option
Signed-off-by: Mark Gerard <kata.mapkon@gmail.com>
2024-03-25 11:06:05 +01:00
Federico Di Pierro cf958dc2d9 chore(cmdk,pkg,internal): bump copyright year for all touched files.
Also, allow `FetchInfo` to override kernelrelease/version if only one of them is enforced.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
Federico Di Pierro 7977184710 chore(pkg/driver/kernel): moved driverkernel FetchInfo to linux only version.
Moreover, added a version for others OS.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
Federico Di Pierro 18982d3434 chore(pkg/driver): less verbose ProgramSpec for modern bpf Tracing program type check.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
Federico Di Pierro 7667649a2e chore(cmd,pkg): fixed tests and linter.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
Federico Di Pierro 8ec25c9287 chore(cmd/driver,pkg/driver): only load distro and kernelrelease in cmd/driver_linux root command.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
Federico Di Pierro 1d9d19d833 chore(cmd/driver,pkg/driver): use cilium/ebpf library to check for modern bpf support.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
Federico Di Pierro 0532e71ccd chore(pkg/driver): COS does only support ebpf probes.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
Federico Di Pierro 580d49884a new(cmd,internal,pkg): added support for driver automatic selection logic.
`Driver.Type` will now be a slice in config.
Then, cmd/driver_linux will take care of discovering,
given the list of allowed driver types loaded from the config,
the correct driver to be used.

This has multple consequencies:
* enforcing a single `--type` works like the existing behavior
* allowed driver types are in descending priority order

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-25 10:59:05 +01:00
dependabot[bot] 46a3602fcf chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 25.0.5+incompatible to 26.0.0+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v25.0.5...v26.0.0)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 09:56:05 +01:00
dependabot[bot] 1673558c55 chore(deps): Bump github.com/onsi/gomega from 1.31.1 to 1.32.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.31.1 to 1.32.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.31.1...v1.32.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 08:47:05 +01:00
dependabot[bot] b6b799bc96 chore(deps): Bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 25.0.4+incompatible to 26.0.0+incompatible.
- [Commits](https://github.com/docker/cli/compare/v25.0.4...v26.0.0)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 08:42:05 +01:00
dependabot[bot] 477f2c3786 chore(deps): Bump google.golang.org/api from 0.170.0 to 0.171.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.170.0 to 0.171.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.170.0...v0.171.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 08:39:05 +01:00
dependabot[bot] d73a859e62 chore(deps): Bump the actions group with 1 update
Bumps the actions group with 1 update: [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator).


Updates `slsa-framework/slsa-github-generator` from 1.9.0 to 1.10.0
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: slsa-framework/slsa-github-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 08:38:05 +01:00
Aldo Lacuku fb82fec00c update(tests/push): add new tests for push command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-03-21 10:32:47 +01:00
dependabot[bot] 82c2307d1a chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 25.0.4+incompatible to 25.0.5+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v25.0.4...v25.0.5)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-21 01:22:47 +01:00
dependabot[bot] d1f70386ea chore(deps): Bump the actions group with 4 updates
Bumps the actions group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [docker/login-action](https://github.com/docker/login-action) and [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `actions/checkout` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](b4ffde65f4...9bb56186c3)

Updates `docker/setup-buildx-action` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](0d103c3126...2b51285047)

Updates `docker/login-action` from 3.0.0 to 3.1.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](343f7c4344...e92390c5fb)

Updates `docker/build-push-action` from 5.2.0 to 5.3.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](af5a7ed5ba...2cdde995de)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 14:40:37 +01:00
dependabot[bot] e6665cd8fc chore(deps): Bump the gomod group with 4 updates
Bumps the gomod group with 4 updates: [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go), [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `cloud.google.com/go/storage` from 1.39.0 to 1.39.1
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.39.0...storage/v1.39.1)

Updates `github.com/google/go-containerregistry` from 0.19.0 to 0.19.1
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.19.0...v0.19.1)

Updates `k8s.io/apimachinery` from 0.29.2 to 0.29.3
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.29.2...v0.29.3)

Updates `k8s.io/client-go` from 0.29.2 to 0.29.3
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.29.2...v0.29.3)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 14:38:37 +01:00
dependabot[bot] 379832c738 chore(deps): Bump google.golang.org/api from 0.169.0 to 0.170.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.169.0 to 0.170.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.169.0...v0.170.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 13:20:37 +01:00
Aldo Lacuku 803c08e374 fix(registry/push): correctly remove temporary dir
When pushing multiple plugins we need to remove the temporary dirs created
when compressing them. This commit implements a fix that tracks
all the temporary dirs created at runtime and removes them at the end.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-03-15 10:47:27 +01:00
Federico Di Pierro 816f79cf1e update(cmd): bumped oras to v.2.4.0.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-03-14 09:58:24 +01:00
dependabot[bot] 4dd3f2a631 chore(deps): Bump google.golang.org/protobuf from 1.32.0 to 1.33.0
Bumps google.golang.org/protobuf from 1.32.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-14 08:26:24 +01:00
Aldo Lacuku c95c65af00 feat(cmd/push): parse requirements and deps from rulesfile
When the user does not provide requirements and dependencies
when pushing a rulefile artifact, it will try to parse the
rulefile and automatically set them in the config layer.
It only supports files in .yaml format.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-03-13 08:25:20 +01:00
dependabot[bot] be3ce60a75 chore(deps): Bump the gomod group with 2 updates
Bumps the gomod group with 2 updates: [github.com/docker/cli](https://github.com/docker/cli) and [github.com/docker/docker](https://github.com/docker/docker).


Updates `github.com/docker/cli` from 25.0.3+incompatible to 25.0.4+incompatible
- [Commits](https://github.com/docker/cli/compare/v25.0.3...v25.0.4)

Updates `github.com/docker/docker` from 25.0.3+incompatible to 25.0.4+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v25.0.3...v25.0.4)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-12 20:03:17 +01:00
dependabot[bot] 2d0a52a967 chore(deps): Bump github.com/onsi/ginkgo/v2 from 2.15.0 to 2.16.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.15.0 to 2.16.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.15.0...v2.16.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-12 20:02:18 +01:00
dependabot[bot] 3575a81966 chore(deps): Bump golang.org/x/oauth2 from 0.17.0 to 0.18.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.17.0 to 0.18.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 15:36:15 +01:00
dependabot[bot] 1b23e3f4f7 chore(deps): Bump google.golang.org/api from 0.167.0 to 0.169.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.167.0 to 0.169.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.167.0...v0.169.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 15:35:15 +01:00
dependabot[bot] 9163a85547 chore(deps): Bump golang.org/x/net from 0.21.0 to 0.22.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.21.0 to 0.22.0.
- [Commits](https://github.com/golang/net/compare/v0.21.0...v0.22.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 13:53:15 +01:00
dependabot[bot] cf773bcfc0 chore(deps): Bump the actions group with 1 update
Bumps the actions group with 1 update: [docker/build-push-action](https://github.com/docker/build-push-action).


Updates `docker/build-push-action` from 5.1.0 to 5.2.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](4a13e500e5...af5a7ed5ba)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 13:51:15 +01:00
dependabot[bot] b9d5516f68 chore(deps): Bump golang.org/x/sys from 0.17.0 to 0.18.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.17.0 to 0.18.0.
- [Commits](https://github.com/golang/sys/compare/v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 13:21:15 +01:00
dependabot[bot] 6e39c4665f chore(deps): Bump gopkg.in/go-jose/go-jose.v2 from 2.6.1 to 2.6.3
Bumps gopkg.in/go-jose/go-jose.v2 from 2.6.1 to 2.6.3.

---
updated-dependencies:
- dependency-name: gopkg.in/go-jose/go-jose.v2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-08 00:47:01 +01:00
dependabot[bot] ad38eaf8f3 chore(deps): Bump github.com/go-jose/go-jose/v3 from 3.0.2 to 3.0.3
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/v3.0.3/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.2...v3.0.3)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-08 00:44:00 +01:00
dependabot[bot] 15b4ff9017 chore(deps): Bump github.com/stretchr/testify from 1.8.4 to 1.9.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 11:14:46 +01:00
dependabot[bot] f2a5a9060e chore(deps): Bump the actions group with 1 update
Bumps the actions group with 1 update: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action).


Updates `docker/setup-buildx-action` from 3.0.0 to 3.1.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](f95db51fdd...0d103c3126)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 11:09:47 +01:00
dependabot[bot] e005be04e7 chore(deps): Bump the gomod group with 6 updates
Bumps the gomod group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore) | `1.8.1` | `1.8.2` |
| [github.com/sigstore/sigstore/pkg/signature/kms/aws](https://github.com/sigstore/sigstore) | `1.8.1` | `1.8.2` |
| [github.com/sigstore/sigstore/pkg/signature/kms/azure](https://github.com/sigstore/sigstore) | `1.8.1` | `1.8.2` |
| [github.com/sigstore/sigstore/pkg/signature/kms/gcp](https://github.com/sigstore/sigstore) | `1.8.1` | `1.8.2` |
| [github.com/sigstore/sigstore/pkg/signature/kms/hashivault](https://github.com/sigstore/sigstore) | `1.8.1` | `1.8.2` |
| [golang.org/x/crypto](https://github.com/golang/crypto) | `0.19.0` | `0.20.0` |


Updates `github.com/sigstore/sigstore` from 1.8.1 to 1.8.2
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.1...v1.8.2)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/aws` from 1.8.1 to 1.8.2
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.1...v1.8.2)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/azure` from 1.8.1 to 1.8.2
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.1...v1.8.2)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/gcp` from 1.8.1 to 1.8.2
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.1...v1.8.2)

Updates `github.com/sigstore/sigstore/pkg/signature/kms/hashivault` from 1.8.1 to 1.8.2
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.8.1...v1.8.2)

Updates `golang.org/x/crypto` from 0.19.0 to 0.20.0
- [Commits](https://github.com/golang/crypto/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/aws
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/azure
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/gcp
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/sigstore/pkg/signature/kms/hashivault
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 05:30:45 +01:00
dependabot[bot] 5d5632c5f0 chore(deps): Bump cloud.google.com/go/storage from 1.38.0 to 1.39.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.38.0 to 1.39.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.38.0...spanner/v1.39.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 05:21:46 +01:00
Jeff Larson 85f1edd708 Remove extra '$' character.
Fixes #457

Signed-off-by: Jeff Larson <thejefflarson@gmail.com>
2024-02-28 07:52:26 +01:00
dependabot[bot] c62ffbd24f chore(deps): Bump google.golang.org/api from 0.165.0 to 0.167.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.165.0 to 0.167.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.165.0...v0.167.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-26 09:05:19 +01:00
Aldo Lacuku e827ba1cee fix(CI): add permissions to login-to-amazon-ecr job
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-02-22 16:11:05 +01:00
Aldo Lacuku ac15f50d35 new(ci): add provenance for main tag
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-02-22 15:37:05 +01:00
Aldo Lacuku 2ed594744c fix(CI): properly get credentials for amazon ecr registry
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-02-22 12:37:05 +01:00
Aldo Lacuku 0763d7d1bb new(CI): add provenance for ecr image
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-02-22 09:46:05 +01:00
Aldo Lacuku f5a8d65b88 fix(ci): add permissions for AWS ecr
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-02-20 12:27:55 +01:00
Aldo Lacuku 8859d1e625 new(CI): add ecr repository
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-02-20 11:41:55 +01:00
dependabot[bot] 4e745c1813 chore(deps): Bump the gomod group with 2 updates
Bumps the gomod group with 2 updates: [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `k8s.io/apimachinery` from 0.29.1 to 0.29.2
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.29.1...v0.29.2)

Updates `k8s.io/client-go` from 0.29.1 to 0.29.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.29.1...v0.29.2)

---
updated-dependencies:
- dependency-name: k8s.io/apimachinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 09:37:47 +01:00
dependabot[bot] 1fd04e0dbf chore(deps): Bump github.com/opencontainers/image-spec
Bumps [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec) from 1.1.0-rc6 to 1.1.0.
- [Release notes](https://github.com/opencontainers/image-spec/releases)
- [Changelog](https://github.com/opencontainers/image-spec/blob/main/RELEASES.md)
- [Commits](https://github.com/opencontainers/image-spec/compare/v1.1.0-rc6...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/image-spec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 09:33:47 +01:00
dependabot[bot] 869fcbe642 chore(deps): Bump google.golang.org/api from 0.163.0 to 0.165.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.163.0 to 0.165.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.163.0...v0.165.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 09:29:46 +01:00
dependabot[bot] 3337612782 chore(deps): Bump cloud.google.com/go/storage from 1.37.0 to 1.38.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.37.0 to 1.38.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/spanner/v1.37.0...spanner/v1.38.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 09:22:47 +01:00
Aldo Lacuku 43f1d3c7f9 fix(pusher): correctly report artifact type
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2024-02-13 10:34:21 +01:00
dependabot[bot] 5d2bfa7b49 chore(deps): Bump google.golang.org/api from 0.161.0 to 0.163.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.161.0 to 0.163.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.161.0...v0.163.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 09:21:15 +01:00
dependabot[bot] 2b5982cd0b chore(deps): Bump github.com/distribution/distribution/v3
Bumps [github.com/distribution/distribution/v3](https://github.com/distribution/distribution) from 3.0.0-20230608105614-4501a6e06d3b to 3.0.0-alpha.1.
- [Release notes](https://github.com/distribution/distribution/releases)
- [Commits](https://github.com/distribution/distribution/commits/v3.0.0-alpha.1)

---
updated-dependencies:
- dependency-name: github.com/distribution/distribution/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 09:20:15 +01:00
dependabot[bot] 6ee5a87614 chore(deps): Bump golang.org/x/net from 0.20.0 to 0.21.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.20.0 to 0.21.0.
- [Commits](https://github.com/golang/net/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 08:46:15 +01:00
dependabot[bot] 16dd7b093c chore(deps): Bump golang.org/x/crypto from 0.18.0 to 0.19.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.18.0 to 0.19.0.
- [Commits](https://github.com/golang/crypto/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 08:38:14 +01:00
dependabot[bot] de9b39bad1 chore(deps): Bump the gomod group with 3 updates
Bumps the gomod group with 3 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker) and [github.com/pterm/pterm](https://github.com/pterm/pterm).


Updates `github.com/docker/cli` from 25.0.2+incompatible to 25.0.3+incompatible
- [Commits](https://github.com/docker/cli/compare/v25.0.2...v25.0.3)

Updates `github.com/docker/docker` from 25.0.2+incompatible to 25.0.3+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v25.0.2...v25.0.3)

Updates `github.com/pterm/pterm` from 0.12.78 to 0.12.79
- [Release notes](https://github.com/pterm/pterm/releases)
- [Commits](https://github.com/pterm/pterm/compare/v0.12.78...v0.12.79)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/pterm/pterm
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 08:37:15 +01:00
dependabot[bot] 18bae1d745 chore(deps): Bump golangci/golangci-lint-action from 3.7.0 to 4.0.0
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.7.0 to 4.0.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](3a91952989...3cfe3a4abb)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 08:36:14 +01:00
dependabot[bot] d08fead3d3 chore(deps): Bump the actions group with 1 update
Bumps the actions group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 4.3.0 to 4.3.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](26f96dfa69...5d5d22a312)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 08:35:15 +01:00
Tom Müller e03c73c33d bumped helper message
Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>
2024-02-09 14:55:05 +01:00
Tom Müller 270f36234b added http-header option in driver download
Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

fixed linting for http-header option

fixed syntax error in driver download options

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

fixed syntax error in driver download options

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

fixed syntax error in driver download options

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

fixed linting for driver download options

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

moved header injection below error check

No need to inject a header into an empty request

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

fixed linting for Download function call

Line was too long so needed to be split in multiple lines

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

rearranged http-headers flag

http-headers flag moved to driverDownloadOptions

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

added leading space trimming for header keys

Added leading space trimming for header keys in order to make the function more robust

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

forwarding of the headers variable into the http GET request

Added functionality which parses the comma separated string of headers which were provided with the --http-headers flag to the Download function. The headers are unpacked and injected into the http GET request.

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>

added header options for driver download

Added header options for the driver download via http GET. Headers should be provided via the --http-headers flag as a comma separated string (e.g. --http-headers="x-emc-namespace:default")

Signed-off-by: Tom Müller <60851960+toamto94@users.noreply.github.com>
2024-02-09 14:55:05 +01:00
Federico Di Pierro 0ff99bd776 chore(pkg/driver): ubuntu has its own specific FixupKernel logic now.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-08 17:09:59 +01:00
Federico Di Pierro bf23a65bcc fix(pkg/driver): fixed generic kernelversion fixup method.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-02-08 17:09:59 +01:00
Krzesimir Nowak 95104b15c6 pkg/driver/flatcar: Update the script
It was taken straight from the old driver loader bash script, but now
it's a separate script, so some constructs like `local` make no sense
there. A result was that no kernel tools were patched, thus they could
fail to run if they were built against a newer glibc than the one
provided by the falco-driver-loader image.

Also print both standard output and standard error on failure, so we
may have some idea about what's going on here.

Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
2024-02-07 18:01:57 +01:00
Krzesimir Nowak d3dbcbd6bb fix: Dead link in PR template
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
2024-02-07 14:20:56 +01:00
dependabot[bot] 215569116f chore(deps): Bump google.golang.org/api from 0.159.0 to 0.161.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.159.0 to 0.161.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.159.0...v0.161.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 17:23:50 +01:00
dependabot[bot] 3eb92959c3 chore(deps): Bump the gomod group with 4 updates
Bumps the gomod group with 4 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker), [github.com/pterm/pterm](https://github.com/pterm/pterm) and [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign).


Updates `github.com/docker/cli` from 25.0.1+incompatible to 25.0.2+incompatible
- [Commits](https://github.com/docker/cli/compare/v25.0.1...v25.0.2)

Updates `github.com/docker/docker` from 25.0.1+incompatible to 25.0.2+incompatible
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v25.0.1...v25.0.2)

Updates `github.com/pterm/pterm` from 0.12.76 to 0.12.78
- [Release notes](https://github.com/pterm/pterm/releases)
- [Commits](https://github.com/pterm/pterm/compare/v0.12.76...v0.12.78)

Updates `github.com/sigstore/cosign/v2` from 2.2.2 to 2.2.3
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.2.2...v2.2.3)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/pterm/pterm
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 17:08:50 +01:00
dependabot[bot] 0a29ccc7fd chore(deps): Bump github.com/google/go-containerregistry
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.18.0 to 0.19.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 16:33:50 +01:00
cpanato 16e2d1a45d bump github.com/opencontainers/image-spec to v1.1.0-rc6
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-02-05 16:30:50 +01:00
dependabot[bot] 128916b4b4 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [docker/metadata-action](https://github.com/docker/metadata-action) and [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer).


Updates `docker/metadata-action` from 5.5.0 to 5.5.1
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](dbef88086f...8e5442c4ef)

Updates `sigstore/cosign-installer` from 3.3.0 to 3.4.0
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](9614fae9e5...e1523de757)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 12:39:49 +01:00
Brenno Oliveira 4f9b935aea feat: adding support for KMS in cosign
Signed-off-by: Brenno Oliveira <brenno.oliveira@deliveryhero.com>
2024-02-03 21:35:43 +01:00
dependabot[bot] 919a307bc2 chore(deps): Bump cloud.google.com/go/storage from 1.36.0 to 1.37.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.36.0 to 1.37.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.36.0...spanner/v1.37.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-30 18:31:33 +01:00
Federico Di Pierro da51356ef5 fix: fixed go.sum entry to fix build.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-30 10:40:31 +01:00
dependabot[bot] ef15eb2e4a chore(deps): Bump github.com/sigstore/sigstore from 1.7.6 to 1.8.1
Bumps [github.com/sigstore/sigstore](https://github.com/sigstore/sigstore) from 1.7.6 to 1.8.1.
- [Release notes](https://github.com/sigstore/sigstore/releases)
- [Commits](https://github.com/sigstore/sigstore/compare/v1.7.6...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/sigstore/sigstore
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 07:51:26 +01:00
dependabot[bot] ff244b6d34 chore(deps): Bump k8s.io/client-go from 0.28.3 to 0.29.1
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.28.3 to 0.29.1.
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.28.3...v0.29.1)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 07:43:26 +01:00
dependabot[bot] e4ced876ba chore(deps): Bump google.golang.org/api from 0.153.0 to 0.159.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.153.0 to 0.159.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.153.0...v0.159.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 07:33:27 +01:00
dependabot[bot] 3a8ac8e708 chore(deps): Bump github.com/docker/cli
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 24.0.7+incompatible to 25.0.1+incompatible.
- [Commits](https://github.com/docker/cli/compare/v24.0.7...v25.0.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 07:32:27 +01:00
dependabot[bot] bb3ee1d550 chore(deps): Bump the gomod group with 5 updates
Bumps the gomod group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/falcosecurity/driverkit](https://github.com/falcosecurity/driverkit) | `0.16.0` | `0.16.3` |
| [github.com/oras-project/oras-credentials-go](https://github.com/oras-project/oras-credentials-go) | `0.3.0` | `0.3.1` |
| [github.com/pterm/pterm](https://github.com/pterm/pterm) | `0.12.67` | `0.12.76` |
| [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign) | `2.2.1` | `2.2.2` |
| [oras.land/oras-go/v2](https://github.com/oras-project/oras-go) | `2.3.0` | `2.3.1` |


Updates `github.com/falcosecurity/driverkit` from 0.16.0 to 0.16.3
- [Release notes](https://github.com/falcosecurity/driverkit/releases)
- [Changelog](https://github.com/falcosecurity/driverkit/blob/master/RELEASE.md)
- [Commits](https://github.com/falcosecurity/driverkit/compare/v0.16.0...v0.16.3)

Updates `github.com/oras-project/oras-credentials-go` from 0.3.0 to 0.3.1
- [Release notes](https://github.com/oras-project/oras-credentials-go/releases)
- [Commits](https://github.com/oras-project/oras-credentials-go/compare/v0.3.0...v0.3.1)

Updates `github.com/pterm/pterm` from 0.12.67 to 0.12.76
- [Release notes](https://github.com/pterm/pterm/releases)
- [Commits](https://github.com/pterm/pterm/compare/v0.12.67...v0.12.76)

Updates `github.com/sigstore/cosign/v2` from 2.2.1 to 2.2.2
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.2.1...v2.2.2)

Updates `oras.land/oras-go/v2` from 2.3.0 to 2.3.1
- [Release notes](https://github.com/oras-project/oras-go/releases)
- [Commits](https://github.com/oras-project/oras-go/compare/v2.3.0...v2.3.1)

---
updated-dependencies:
- dependency-name: github.com/falcosecurity/driverkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/oras-project/oras-credentials-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/pterm/pterm
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
- dependency-name: oras.land/oras-go/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gomod
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-25 18:15:16 +01:00
Federico Di Pierro 4ec8660ed2 chore(cmd): fixed up some strings.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-25 09:32:15 +01:00
dependabot[bot] 139527dad6 chore(deps): Bump github.com/onsi/gomega from 1.27.8 to 1.31.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.8 to 1.31.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.8...v1.31.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 21:13:14 +01:00
dependabot[bot] e87c302591 chore(deps): Bump github.com/spf13/viper from 1.17.0 to 1.18.2
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.17.0 to 1.18.2.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.17.0...v1.18.2)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 21:12:14 +01:00
dependabot[bot] 1e299e6b48 chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.7+incompatible to 25.0.1+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v24.0.7...v25.0.1)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 21:05:14 +01:00
dependabot[bot] 8717a9eeff chore(deps): Bump github.com/onsi/ginkgo/v2 from 2.10.0 to 2.15.0
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.10.0 to 2.15.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.10.0...v2.15.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 21:04:14 +01:00
dependabot[bot] 405e341449 chore(deps): Bump golang.org/x/oauth2 from 0.13.0 to 0.16.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.13.0 to 0.16.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.13.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 20:40:14 +01:00
dependabot[bot] 79a1b7f9f6 chore(deps): Bump docker/build-push-action from 4.0.0 to 5.1.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4.0.0 to 5.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](3b5e8027fc...4a13e500e5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 20:39:14 +01:00
dependabot[bot] 478c7c6630 chore(deps): Bump goreleaser/goreleaser-action from 4.2.0 to 5.0.0
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 4.2.0 to 5.0.0.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](f82d6c1c34...7ec5c2b0c6)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 20:38:14 +01:00
dependabot[bot] d86ed68ad1 chore(deps): Bump actions/upload-artifact from 3.1.2 to 4.3.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.2 to 4.3.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b7f8abb15...26f96dfa69)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 20:37:14 +01:00
dependabot[bot] 889a6346ea chore(deps): Bump github.com/google/go-containerregistry
Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.16.1 to 0.18.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](https://github.com/google/go-containerregistry/compare/v0.16.1...v0.18.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 20:36:14 +01:00
dependabot[bot] 28dd5f6307 chore(deps): Bump cloud.google.com/go/storage from 1.33.0 to 1.36.0
Bumps [cloud.google.com/go/storage](https://github.com/googleapis/google-cloud-go) from 1.33.0 to 1.36.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.33.0...spanner/v1.36.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 17:09:14 +01:00
dependabot[bot] a5f0ecd1cf chore(deps): Bump actions/checkout from 3.5.0 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8f4b7f8486...b4ffde65f4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 17:07:14 +01:00
dependabot[bot] bf2aec883d chore(deps): Bump actions/setup-go from 4.0.0 to 5.0.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](4d34df0c23...0c52d547c9)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 16:27:13 +01:00
dependabot[bot] e6d75ca083 chore(deps): Bump docker/setup-buildx-action from 2.5.0 to 3.0.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.5.0 to 3.0.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](4b4e9c3e2d...f95db51fdd)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 16:26:14 +01:00
dependabot[bot] 1f079780d7 chore(deps): Bump docker/login-action from 2.1.0 to 3.0.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 2.1.0 to 3.0.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](f4ef78c080...343f7c4344)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 14:48:13 +01:00
dependabot[bot] d63deb6dcb chore(deps): Bump docker/setup-qemu-action from 2.1.0 to 3.0.0
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2.1.0 to 3.0.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](e81a89b173...68827325e0)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 14:47:13 +01:00
dependabot[bot] 606672e3a3 chore(deps): Bump docker/metadata-action from 4.3.0 to 5.5.0
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4.3.0 to 5.5.0.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](507c2f2dc5...dbef88086f)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 14:46:13 +01:00
dependabot[bot] c14e50cc46 chore(deps): Bump the actions group with 2 updates
Bumps the actions group with 2 updates: [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) and [slsa-framework/slsa-verifier](https://github.com/slsa-framework/slsa-verifier).


Updates `slsa-framework/slsa-github-generator` from 1.6.0 to 1.9.0
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v1.6.0...v1.9.0)

Updates `slsa-framework/slsa-verifier` from 2.3.0 to 2.4.1
- [Release notes](https://github.com/slsa-framework/slsa-verifier/releases)
- [Changelog](https://github.com/slsa-framework/slsa-verifier/blob/main/RELEASE.md)
- [Commits](https://github.com/slsa-framework/slsa-verifier/compare/v2.3.0...v2.4.1)

---
updated-dependencies:
- dependency-name: slsa-framework/slsa-github-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: slsa-framework/slsa-verifier
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 14:45:13 +01:00
cpanato c26ed79dd3 add dependabot config
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-01-24 14:37:14 +01:00
cpanato dce407905a update golangci-lint
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-01-24 14:37:14 +01:00
cpanato 72999a66dd cleanup
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-01-24 14:37:14 +01:00
Federico Di Pierro ca1be8ab1e chore(cmd,internal,pkg): improve ExtractTarGz algorithm making it more robust and safe.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-23 09:59:09 +01:00
Federico Di Pierro 01986a74cf new(internal): added some extractFromTarGz tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-23 09:59:09 +01:00
Federico Di Pierro 58b66f5ec7 fix(pkg,internal): multiple fixes related to cos and driver build.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2024-01-23 09:59:09 +01:00
dependabot[bot] c89a6a82eb chore(deps): Bump github.com/cloudflare/circl from 1.3.5 to 1.3.7
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.5...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 18:06:29 +01:00
Federico Di Pierro 13434184bd chore(internal): added engine version related tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2024-01-08 11:57:27 +01:00
Luca Guerra 5cb7f759ed update(ci): upgrade cosign-installer to v3.3.0
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-12-20 11:19:11 +01:00
Federico Di Pierro 2e95198423 fix(cmd/driver): fixed loadDriverVersion implementation for non-semver driver versions.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-20 09:19:12 +01:00
dependabot[bot] e6658f0e37 chore(deps): Bump golang.org/x/crypto from 0.14.0 to 0.17.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 08:43:06 +01:00
Federico Di Pierro d72536cb40 new(cmd/driver): added more driver commands tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-18 10:03:00 +01:00
Lorenzo Susini cda38ca875 update: make extract agnostic about artifact types again
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini 36aa56c0a2 test: compressing of files and dirs
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini ce7d0b231c fix: ensure files are places in their directories when creating tar.gz archives
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini 50654041ae update: satisfy new license and fix linting error
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini dc5eea97ae update: allow to extract directories for asset files
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini f9062a7665 update: allow to create tar.gz from directories, required for asset types
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini c8d7485b3c test: introduce test for asset artifact type
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini 5adab46b99 update: explicitly handle artifact types when pushing
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini bf63125778 update: properly handle assets dir when installing assets
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini 0bdbd1b19d update: adapt push tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini 2b21ae9f04 update: adapt flag description to include asset
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini 913bae3010 update: handle pushing and pulling of assets
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Lorenzo Susini af100a3da8 new: introduce asset as new artifact type
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-12-13 17:01:45 +01:00
Federico Di Pierro 256e8bf4b9 chore(cmd): print normal and fixedup version for kernel release/version in printenv command.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-12 16:36:44 +01:00
Federico Di Pierro 9783fd3690 fix(pkg/driver): do not call FixupKernel when building drivers.
It is indeed only useful to fixup the download url for given distro.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-12 16:36:44 +01:00
Federico Di Pierro a50b7b321d chore(pkg/driver): cleanup eBPF probe symlink in `Cleanup` method.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-12 15:29:44 +01:00
Federico Di Pierro 2b56ef422e fix(pkg,cmd): eBPF probe must be symlinked under /root/.falco/falco-bpf.o.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 17:51:26 +01:00
Federico Di Pierro 1a013c60ad fix(cmd/driver): fixed segfault in driver config command.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 14:47:26 +01:00
Federico Di Pierro 609a8a255d fix(pkg/options): do not enforce driver version to be semver, since it can also be a commit hash.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 13:37:26 +01:00
Federico Di Pierro d5893e1917 chore(cmd,pkg): use a constant for `auto` driver type.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 11:58:26 +01:00
Federico Di Pierro 7b8ef7abaa new(cmd,pkg/driver): properly use a spinner for long operations.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 11:58:26 +01:00
Federico Di Pierro c19ca32447 chore(cmd,pkg): properly preload driver version for all drivers commands.
Moreover, enforce that driver version is a semver and repos is a list of requestURI.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 10:59:27 +01:00
Federico Di Pierro 2b217999ec new(cmd,internal,pkg): move `driver config` options to be common to all `driver` commands.
This way all driver commands can customize their run with both CLI args or env variables,
without actually storing anything in the config file.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-06 10:59:27 +01:00
Federico Di Pierro 62d9da10bd chore(pkg/driver): address some review concerns.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-12-04 13:04:21 +01:00
Federico Di Pierro d594814c72 new(pkg/driver): fixed some kernel version related issues.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-04 13:04:21 +01:00
Federico Di Pierro 313f047209 chore(cmd/driver): add `preview` to all driver related commands.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-04 12:16:20 +01:00
Federico Di Pierro 15aa18090c new(cmd/driver,pkg/options,internal/config): added `driver config` command tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-12-01 10:40:13 +01:00
Federico Di Pierro a39b5ac7c9 chore(pkg/driver): do not fail if /sys/kernel/debug fails to be mounted.
Also check if `/sys/kernel/debug/tracing` exists.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-30 14:27:07 +01:00
Federico Di Pierro 610e851189 chore(pkg/driver): improved error message when err is nil.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-29 17:26:05 +01:00
Federico Di Pierro 077b671bc5 chore(cmd/driver,pkg/driver,internal/config): avoid string concatenation for hostroot.
Moreover, hostRoot will now default to `/`, and it will be stored as package local variable
in driverdistro package, to forwarding it where needed.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-29 14:34:05 +01:00
Luca Guerra 0ae01ef387 update(gha): upgrade slsa generator to v1.9.0
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-11-29 11:31:05 +01:00
Federico Di Pierro d762a9c6f7 chore(cmd/driver): updated driver config long description.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>

Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-27 11:32:59 +01:00
Federico Di Pierro f80f3fd180 chore(cmd/driver): do not exit with error when engine.kind is set to a non-driver driven kind.
Instead, print a warning.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-27 11:32:59 +01:00
Federico Di Pierro 0643ed3044 new(cmd,internal/utils,pkg/driver): use correct `engine.kind` config key.
Moreover, added a new ReplaceTextInFile utils, and added tests for it and ReplaceLineInFile.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-27 11:32:59 +01:00
Federico Di Pierro 42c069ef77 new(pkg/driver): added tests for driver distros implementations.
Moreover, fixed some discovered issues.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-24 12:26:49 +01:00
dependabot[bot] cb049cb890 chore(deps): Bump github.com/go-jose/go-jose/v3 from 3.0.0 to 3.0.1
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/v3/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-22 08:36:42 +01:00
Federico Di Pierro 4228e71a06 new(cmd,pkg,internal): implemented new driver command.
It exposes 4 subcmds:
* `install` to install (ie: either download or build) kmod or eBPF probe
* `cleanup` to cleanup a driver
* `printenv` to print environment variables about driver-loader
* `config` to configure the driver-loader feature

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-21 17:34:39 +01:00
Aldo Lacuku 1ad11dba9a fix(puller/tests): wait for registry to be up before running tests
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-16 18:15:22 +01:00
Aldo Lacuku 6d34d4045e new(artifact/manifest): add manifest command
It allows to fetch the manifest for a given artifact based on it's platform.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-16 18:15:22 +01:00
Aldo Lacuku 5cfe0575a3 tests(artifact/config): add new tests for the --platform flag
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-16 15:05:21 +01:00
Aldo Lacuku fbcb975f55 refactor(puller/config): rename methods handling artifact config layer
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-16 11:43:20 +01:00
Aldo Lacuku f656760e78 feat(artifact/config): fetch config layer for a specific platform
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-16 11:43:20 +01:00
cschp cdccbeb83e update to remove hardcoded versions from libssl and librcrypto3
Signed-off-by: cschp <cs.chpmn@gmail.com>

Signed-off-by: cschp <cs.chpmn@gmail.com>
2023-11-10 19:20:33 +01:00
cschp ce1f9a8968 patching issue 344 vulnerabilities including GHSA-m425-mq94-257g
Signed-off-by: cschp <cs.chpmn@gmail.com>
2023-11-10 19:20:33 +01:00
dependabot[bot] f547c49766 chore(deps): Bump github.com/sigstore/cosign/v2 from 2.1.1 to 2.2.1
Bumps [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign) from 2.1.1 to 2.2.1.
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.1.1...v2.2.1)

---
updated-dependencies:
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-10 14:15:32 +01:00
Federico Di Pierro 262029791e chore(Makefile): enforce SPDX license header in Makefile `fmt` target.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-11-08 16:19:25 +01:00
alacuku b5363f6908 update(Makefile): do not error if file does not exist when running clean target
It allows to run commands like: make clean && make falcoctl even
when falcoctl binary does not exist.

Signed-off-by: alacuku <aldo.lacu@live.it>
2023-11-03 09:32:07 +01:00
alacuku bea50efc21 fix(tests): wait for registry to accept connections before running tests
Signed-off-by: alacuku <aldo.lacu@live.it>
2023-11-03 09:23:07 +01:00
Aldo Lacuku ae7f565b03 new(cmd): add artifact config command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-02 10:10:06 +01:00
Aldo Lacuku 0490543b61 fix(oci/puller): do not omit previous errors when returning them
Furthemore, tests have been added for the oci/puller package.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-11-02 09:46:06 +01:00
dependabot[bot] 05eb3df8eb chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.5+incompatible to 24.0.7+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v24.0.5...v24.0.7)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-30 17:07:55 +01:00
Aldo Lacuku 49e73bbec7 update(cmd): remove redundant configuration for error handling
Furthemore, rewrite the tests for the root command using the ginkgo framework.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-10-27 11:08:47 +02:00
dependabot[bot] da90565512 chore(deps): Bump google.golang.org/grpc from 1.57.0 to 1.57.1
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.57.0 to 1.57.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.57.0...v1.57.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-26 10:28:45 +02:00
Aldo Lacuku b6678c2e18 update(output): complete rework of the output system
Old flags "--verbose" and "--disable-styling" have been deprecated.

Two new flags configure the output system:

* --log-level can be one of info, warn debug or trace.
* --log-format can be one of color, text, json.

The output is done using a logger that is used across all commands.
Having a unique logger guarantees a consistent format of the output.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-10-25 14:48:43 +02:00
Leonardo Grasso c8359f3348 update(.golangci.yml): add spdx id line to the linter
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-20 09:47:23 +02:00
Leonardo Grasso 22eda6a284 docs: add SPDX license identifier
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-10-20 09:47:23 +02:00
dependabot[bot] 7a66862212 chore(deps): Bump golang.org/x/net from 0.14.0 to 0.17.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-14 09:45:51 +02:00
Aldo Lacuku 9fa598a6bb fix(client): do not cache credentialFuncs for unconfigured repositories
When we create the http client for a given repository the code checks if it is somehow configured.
It caches a function called `credentialFunction`. This function knows how to retrieve the
credentials for a given repository. For unconfigured repositories, or repositories that fail to
get valid credentials using their `credentialFunction,` we cache an `emptyCredential function`.
This causes trouble in case of transient errors causing the client to not recover.
This commit avoids caching the `emptyCredential function` in such cases or for unconfigured repositories.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-09-21 14:46:47 +02:00
Aldo Lacuku 5507e3b6b2 fix(follower): do not cache authentication tokens
Avoid caching authentication tokens in the client since they can expire.
In those cases the client cannot invalidate the expired token,
hence it will not have permission to access the resources.

Each time the client will acquire a new token based on it's configuration.
Remember that this change does not affect the underlying credential helper's cache.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-09-21 14:46:47 +02:00
Luca Guerra 774927a48f update(docs): add FALCOCTL_ARTIFACT_NOVERIFY
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-09-18 09:49:47 +02:00
Mickaël Fontès 55ed9ef189 fix(style): add check to disable colored output
Signed-off-by: Mickaël Fontès <81414455+MickaelFontes@users.noreply.github.com>
2023-09-15 16:28:33 +02:00
Luca Guerra 7f0a8bf880 fix(follow): pass full repo+sha to the signature verification function during follow
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-09-13 12:03:39 +02:00
cpanato 1d66acc8ad disable depguard, this check if expensive to maintain
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-09-05 08:38:56 +02:00
cpanato 8f216097d8 add some log messages to inform user when generating the tls certificates
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-09-05 08:38:56 +02:00
Aldo Lacuku 7227ec4afd update(linter): bump golangci-lint action to v3.7.0
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-08-31 16:41:30 +02:00
Aldo Lacuku 0d24ae0aeb fix(cmd/info): handle "context canceled" errors
The command should exit when the context is canceled by a termination
signal. In such case the command prints the reason why it exited.
Furthermore, the table header is printed to stdout only when data
is found for the artifacts.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-08-31 16:41:30 +02:00
Aldo Lacuku 06cb770ec2 update(cmd/pull): remove outdated info from pull description
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-08-31 12:21:29 +02:00
Aldo Lacuku ada1c20278 fix(cmd): correctly propagate signal handler to sub-commands
The context used to handle the signals is not propagated to the sub-commands.
This makes `falcoctl` unresponsive to signals sent to it. This commit fixes this
behavior by correctly passing the context that handles the signals.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-08-31 11:18:30 +02:00
Roberto Scolaro 95fdff8cba refactor: rename options dropping suffix
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-08-30 14:05:25 +02:00
Roberto Scolaro 6c2db677ed new(tests): added new tests
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-08-30 14:05:25 +02:00
Federico Di Pierro 39fcf05216 fix(build): use golang 1.21 and up to date alpine image in dockerfile.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-08-29 17:51:21 +02:00
Federico Di Pierro b69f417163 chore: rebumped deps after go1.21 bump.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-08-29 14:48:22 +02:00
Federico Di Pierro 2f5494232a chore: bumped go to 1.21.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-08-29 14:48:22 +02:00
Federico Di Pierro 460e28849c chore: bumped deps through `go get -u`
Also, ran `go mod tidy`.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-08-29 14:48:22 +02:00
Lorenzo Susini 7f1e8825a6 refactor: rename options dropping suffix
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-08-03 17:07:18 +02:00
Lorenzo Susini 3c017edef8 test: ensure to assert config and layers mediatypes in pusher tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-08-02 10:23:14 +02:00
Aldo Lacuku 730b8265f5 fix(cmd/push): correctly push artifacts to ECR registry
It seems that ECR does not support annotations on the descriptor of the
OCI image configuration. This fix consists in clearing the annotations
map of the config descriptor when created. By default the filestore.Add
method adds the "org.opencontainers.image.title" annotation.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-08-01 15:01:12 +02:00
Luca Guerra 22af4dd140 update(readme): add links to the website and main falco repo
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-26 18:35:40 +02:00
Maximilian Frank 0302b3c20b doc(index) Update doc to list GCS index backend support
Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-07-14 09:24:12 +02:00
Maximilian Frank 3a3bdfbf4a chore(index) Update index HTTP fetch todo
Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-07-14 09:24:12 +02:00
Maximilian Frank b9b4987ee0 feat(fetch/gcs) Add support for fetching indices from GCS
Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-07-14 09:24:12 +02:00
Luca Guerra 5e6ce83ded update(sign): package name sign -> signature
Signed-off-by: Luca Guerra <luca@guerra.sh>
Co-authored-by: Carlos Panato <ctadeu@gmail.com>
2023-07-07 12:04:40 +02:00
Luca Guerra 8440ac99ae update(sign): pass context
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-07 12:04:40 +02:00
Luca Guerra 8a3cb3cb78 update(install): review comments
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-07 12:04:40 +02:00
Luca Guerra 316b27bd77 fix(install): consistent info log level
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-07 12:04:40 +02:00
Luca Guerra f2ec423544 fix(falcoctl): correct key
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-07 12:04:40 +02:00
Luca Guerra e1d594c2bd update(falcoctl): lint
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-07 12:04:40 +02:00
Luca Guerra 7b3e14a01b new(falcoctl): add transparent signature verification with cosign
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-07 12:04:40 +02:00
Luca Guerra c748f32913 new(falcoctl): import cosign
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-07-07 12:04:40 +02:00
Aldo Lacuku 80c6e4cf9f fix(cache): initialize the fetcher when creating the cache
Initialize the fetcher when the cache is created using the NewFromConfig func.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-07-06 16:18:36 +02:00
Maximilian Frank 472ef3bf0f cleanup(internal/utils) Remove unused Indixes util function
Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-07-06 11:19:36 +02:00
Maximilian Frank bccc34d211 feat(index/fetch) Add support to guess index backend based on URI scheme
Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-07-06 11:19:36 +02:00
Maximilian Frank 3686042ab8 feat(index/fetch) Refactor fetch to accept config entries
This makes it possible to pass complex backend configs to the fetch logic

Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-07-06 11:19:36 +02:00
Maximilian Frank c574b6c5ad feat(index/fetch) Add logic to support other index backends
Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-07-06 11:19:36 +02:00
Mickaël Fontès 363a4dca76 📝 Update examples and documentation
* Update README.md with examples
* Update gcp command help
* Set registry username as constant for GCP auth

Signed-off-by: Mickaël Fontès <81414455+MickaelFontes@users.noreply.github.com>
2023-07-06 09:11:35 +02:00
MickaelFontes 7de8713952 📝 Fix wrong command example
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: MickaelFontes <81414455+MickaelFontes@users.noreply.github.com>
2023-07-06 09:11:35 +02:00
Mickaël Fontès 5209a11004 🚨 Fix linting issues
Signed-off-by: Mickaël Fontès <81414455+MickaelFontes@users.noreply.github.com>
2023-07-06 09:11:35 +02:00
Mickaël Fontès dd318af558 🚚 Rename new auth command gcp
Rename from gke to gcp, since it supports out of gke authentication.

Signed-off-by: Mickaël Fontès <81414455+MickaelFontes@users.noreply.github.com>
2023-07-06 09:11:35 +02:00
Mickaël Fontès b67c0ee012 ♻️ Change GKE client auth logic
* confirm use of GCE and ApplicationDefault token sources
* change tokenSource cache logic

Signed-off-by: Mickaël Fontès <81414455+MickaelFontes@users.noreply.github.com>
2023-07-06 09:11:35 +02:00
Mickaël Fontès 07bcb837a4 🚧 First working version
* command logic similar to basicAuth
* follow client auth refactor
* mimicks oauth Credential for client credential management (not useful I think)
* gke use flag is saved in config file

Signed-off-by: Mickaël Fontès <81414455+MickaelFontes@users.noreply.github.com>
2023-07-06 09:11:35 +02:00
Mickaël Fontès 6a9fe36bf3 🚧 Command for GKE auth
Signed-off-by: Mickaël Fontès <81414455+MickaelFontes@users.noreply.github.com>
2023-07-06 09:11:35 +02:00
Maximilian Frank 4105621481 cleanup(registry/auth) refactor OCI registry authentication and credential storage
Consoldidate all authentication methods in a single client and only
use credential stores as source of truth. falcoctl config can still
be used for logging into registries.

Signed-off-by: Maximilian Frank <mfrank@mercari.com>
2023-06-21 12:29:53 +02:00
Jason Dellaluce cc49e6c6e3 fix(internal/utils): cap tar extraction size
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-06-12 15:48:11 +02:00
Jason Dellaluce fa667771c9 fix: update deps and fix hanging when style is disabled
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2023-06-12 15:48:11 +02:00
Leonardo Grasso 7a530956dc docs(README.md): add scope and status badges
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-06-06 19:11:40 +02:00
Aldo Lacuku 63b6bf3f4a cleanup(cmd): remove leftover code in install and follow commands
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-05-31 10:18:31 +02:00
Roberto Scolaro a397401cb4 fix(cmd/registry/auth/basic): removed default oci registry
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-05-31 10:02:31 +02:00
Aldo Lacuku 90ba8812bf fix(cmd): use arm64 instead of aarch64 in usage examples
Plugin artifacts use "arm64" as architecture in their OCI manifests.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-05-25 16:09:12 +02:00
Aldo Lacuku 59d2110df8 chore(falcoctl): bump oras-go to v2.2.0
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-05-25 12:37:11 +02:00
Luca Guerra afd6093764 update(docs): clarify version
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-05-23 16:05:34 +02:00
Luca Guerra 2eb13de0ac new(docs): how to verify falcoctl signature
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-05-23 16:05:34 +02:00
Luca Guerra 084870dcd2 fix(ci): remove docker image permission request
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-05-22 11:48:32 +02:00
Luca Guerra 97d94c9565 update(ci): update cosign
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-05-22 11:48:32 +02:00
Luca Guerra c2e37c097d Update .github/workflows/docker-image.yaml
Co-authored-by: Carlos Tadeu Panato Junior <ctadeu@gmail.com>
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-05-22 11:48:32 +02:00
Luca Guerra ff362b2560 fix(ci): remove cosign experimental
Signed-off-by: Luca Guerra <luca@guerra.sh>

Co-authored-by: Batuhan Apaydn <batuhan.apaydin@trendyol.com>
2023-05-22 11:48:32 +02:00
Luca Guerra 16bc22303c fix(ci): add permissions to the docker reusable workflow as well
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-05-22 11:48:32 +02:00
Luca Guerra 77d066d0a3 update(ci): only sign releases
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-05-22 11:48:32 +02:00
Batuhan Apaydın 013ba9772e add slsa provenance for binaries and sign container images
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>

registry username

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>

fix(ci): correct image name

Signed-off-by: Luca Guerra <luca@guerra.sh>

add new line

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2023-05-18 11:12:03 +02:00
Aldo Lacuku ad50f99f06 fix(cmd/artifact/search): do not print usage in case of error
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-05-16 12:01:26 +02:00
Aldo Lacuku 56e5f4dc41 fix(cmd/artifact): authenticate only for subcommands that require it
The artifact command registers a preRun function that authenticates the
configured registries in the configuration file. But not all the subcommands
need authentication.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-05-16 12:01:26 +02:00
Massimiliano Giovagnoli 791f5c5d7c chore(makefile): add clean target to cleanup local build
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-05-15 19:11:24 +02:00
Massimiliano Giovagnoli 54c4c2d28d chore(makefile): declare targets which are phony
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-05-15 19:11:24 +02:00
Roberto Scolaro 7553c7bb93 fix(cmd/registry/pull): updated help message
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-05-15 14:47:24 +02:00
Roberto Scolaro 46005b471c fix: check directory existance iff necessary
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>

fix: check directory existance iff necessary

Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-05-10 11:12:10 +02:00
Roberto Scolaro ffea6d493a chore(oci): more clear error on wrong type
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-05-03 15:59:27 +02:00
Aldo Lacuku ef4ed0ddec fix(compress.go): propagate error from defer functions
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
2023-04-26 14:58:13 +02:00
Aldo Lacuku 798aa4d2d1 update(tests/registry/push): add integration tests for registry push command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-04-26 14:58:13 +02:00
Aldo Lacuku 1c8f0bda16 fix(pkg/output): set writer for the "success" printer
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-04-26 14:58:13 +02:00
Aldo Lacuku b29de40410 fix(cli): rework error propagation in the commands
Error messages are handled in the root command. All subcommands propagate the fatal errors to the root command. This simplifies the error
handling:

  * commands do not exit in the middle of their business logic if a fatal error occurs, just return the error;
  * when an error occurs the application exits with error code != 0, allowing consumers to know that something went wrong without the need to check the output messages;
  * output is consistent among subcommands, in case of error the usage info is printed out(only not leaf subcommands) and the error message is formatted using the printer;
  * easies the testing of the application.

Furthermore, dependencies on some k8s packages are dropped.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-04-26 14:58:13 +02:00
Aldo Lacuku 58b684999b refactor(tests): move common logic tests to test package
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-04-26 14:58:13 +02:00
Aldo Lacuku bd54ed766f refactor(registry/push): unexport runPush command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-04-26 14:58:13 +02:00
Aldo Lacuku 534535cfb1 fix(registry/push): create tar.gz archive for raw input files
Checks the input file and if not in tar.gz format it compresses it and archives in tar
format. The mediaType for our artifcts is in the tar.gz format, so we we need to push
them in that format.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-04-26 14:58:13 +02:00
dependabot[bot] 46a189994d chore(deps): Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.17+incompatible to 20.10.24+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v20.10.17...v20.10.24)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-05 08:40:55 +02:00
Aldo Lacuku 0b87842102 feat(index/update): add output messages for index update command
Furthermore debug messages are printed when --verbose flag is set.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-04-04 10:51:50 +02:00
Aldo Lacuku b0205e33ef feat(index/add): add output messages for index add command
Furthermore debug messages are printed when --verbose flag is set.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-03-30 14:30:33 +02:00
Aldo Lacuku 2adfff69b2 fix(pkg/index/fetch): check http status code
Check http status code when fetching an index from a remote
http endpoint. Allows for better error messages for end users.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-03-30 14:30:33 +02:00
Aldo Lacuku b0f1f2705e feat(index/remove): add output messages for index remove command
Furthermore debug messages are printed when --verbose flag is set.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-03-30 14:09:32 +02:00
Aldo Lacuku 554c0dc55d update(Makefile): bump golangci-lint version to 1.52.2
Latest golangci-lint fixes some issues with go 1.20

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-03-30 10:24:31 +02:00
junya koyama 6cb916907c fix(falcoctl):fix oras-go breaking changes
Signed-off-by: junya koyama <arukiidou@yahoo.co.jp>
2023-03-30 10:02:32 +02:00
junya koyama a6e1e7f6ff chore(falcoctl): bump oras.land/oras-go/v2 to v2.0.2(GA)
Signed-off-by: junya koyama <arukiidou@yahoo.co.jp>
2023-03-30 10:02:32 +02:00
Aldo Lacuku 3b2e5c94f8 fix(cmd/registry): correctly login using ENV/config file params
Pull and push commands parse the ENV variables and config file to get
credentials and login to remote registry before running their business logic.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-03-30 09:21:32 +02:00
Aldo Lacuku 502b68d4d0 update(cmd/registry): load configs from ENV/config file in registry command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-03-30 09:21:32 +02:00
Aldo Lacuku b67213f424 chore(registry): do not reinitiliaze common options for pull and push commands
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-03-30 09:21:32 +02:00
cpanato 23588f1d01 fix/update lints
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-03-27 13:43:49 +02:00
cpanato e94e50ae32 cleanup ci, adjust indentation, fix version comments and update hashes
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-03-27 13:43:49 +02:00
cpanato e9cb299ec6 upgrade to use go1.20
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-03-27 13:43:49 +02:00
dependabot[bot] 5b6c55ab8c chore(deps): Bump golang.org/x/crypto
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20220214200702-86341886e292 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-22 13:55:07 +01:00
Massimiliano Giovagnoli ddffd44393 chore(cmd/artifact/install): fix description
The description of the command showed examples of the follow command,
instead of the install command.
The examples have been replaced with examples of the correct command.

Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-15 09:42:50 +01:00
Massimiliano Giovagnoli 7ae72abd54 chore(cmd/artficat/install): document flag names
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-15 09:37:50 +01:00
maxgio92 ba0ab2832d chore(cmd/artifact/install): safely escape output
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: maxgio92 <me@maxgio.it>
2023-03-15 09:37:50 +01:00
Massimiliano Giovagnoli 681ddd6f25 chore(cmd/artifact/install): remove duplicate flags default values on description
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-15 09:37:50 +01:00
Massimiliano Giovagnoli 0e0606f436 refactor(cmd/artifact): share flags between install and follow cmd
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-15 09:37:50 +01:00
Massimiliano Giovagnoli e314beb057 test(pkg/install/tls): test grpctls generator
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli 8e6cf0da0a chore(pkg/install/tls): fix unit test on ecdsa curve
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli 55e54ef8af chore(go.mod): reorder deps
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli 9aa559c974 chore(pkg/install/tls): document code
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli acfabc9b48 chore(pkg/install/tls): cleanup and add license header
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli 49aeb3d75f test(pkg/install/tls): add test for dsa keys generator
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli 41f7909e17 refactor(pkg/install/tls): add keypair setter
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli f539f7e9bb feat(pkg/install/tls): add support for ecdsa for key signing
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli f152dae87a feat(cmd/tls): allow to set dns and ip sans in the server cert
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Massimiliano Giovagnoli 1048fb5709 feat(cmd/tls): allow to set tls key size
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
2023-03-01 15:21:28 +01:00
Lorenzo Susini 78fe87443c docs: update readme title according to description of root cmd
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-23 15:49:37 +01:00
Aldo Lacuku b85748de7f fix(artifact/info): print tags in their original format
Do not parse tags to semver, and then order them in ascendant order. Just retrieve and print out them.
The order is from the most recent ones to the oldest.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-02-22 10:46:31 +01:00
Vicente J. Jiménez Miras de696a4723 fix(push.go): allow the push cmd to inform about the required flags
Signed-off-by: Vicente J. Jiménez Miras <vjjmiras@gmail.com>
2023-02-21 22:00:29 +01:00
dependabot[bot] 5b9befd7c4 chore(deps): Bump golang.org/x/net from 0.2.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.2.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.2.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-18 10:36:48 +01:00
dependabot[bot] accf7e3f6c chore(deps): Bump github.com/emicklei/go-restful
Bumps [github.com/emicklei/go-restful](https://github.com/emicklei/go-restful) from 2.9.5+incompatible to 2.16.0+incompatible.
- [Release notes](https://github.com/emicklei/go-restful/releases)
- [Changelog](https://github.com/emicklei/go-restful/blob/v3/CHANGES.md)
- [Commits](https://github.com/emicklei/go-restful/compare/v2.9.5...v2.16.0)

---
updated-dependencies:
- dependency-name: github.com/emicklei/go-restful
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 18:07:31 +01:00
Lorenzo Susini d685794f07 update: use mark flags as mutually exclusive for cron and every
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-09 09:55:30 +01:00
Lorenzo Susini bc12026e63 update: add a flag to disable resolving deps in artifact install
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-06 15:59:27 +01:00
Lorenzo Susini b079c00e9c chore: allow everything is nothing is passed as allowed types
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-06 15:59:27 +01:00
Lorenzo Susini 6b4a1a5944 update: use the check of allowed types in the logic for install and follow
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-06 15:59:27 +01:00
Lorenzo Susini 2ad9cd3fba new: add a way to retrieve allowed types from config, env and flags
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-06 15:59:27 +01:00
Lorenzo Susini d1bec56e62 new: introduce new function to check if we are downloading allowed type of artifacts
It does so by retrieving the manifest and checking the mediaType from layer[0]
(the one and only for our artifacts)

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-06 15:59:27 +01:00
Lorenzo Susini 5af39d3758 doc: add simple ascii art
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-02 18:53:16 +01:00
Roberto Scolaro ffdbfca3e9 docs(README.md): added documentation of cache mechanism
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-02-02 18:40:15 +01:00
Lorenzo Susini b79d988145 fix: use index cache in artifact commands
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-02 18:33:15 +01:00
Roberto Scolaro 80f0cf6336 fix: new logic
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-02-02 09:50:14 +01:00
Roberto Scolaro 7436ad229f fix: error if artifact destination directory is not present/writable at start
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-02-02 09:50:14 +01:00
Roberto Scolaro f0b8791de1 fix(README): typo
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-02-01 16:58:10 +01:00
Roberto Scolaro 229a607d86 docs(README.md): added artifact follow documentation
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-02-01 16:58:10 +01:00
Lorenzo Susini e11b6c9876 fix: strenghten env variables validation from user input
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-01 15:05:09 +01:00
Aldo Lacuku c83fa607fd new(index-caching): add in-memory cache mechanism for index files
Since index files can be overwritten using ENV variables we needed a
new solution to handle them on a per-command basis. Added an in-memory
caching system that handles the index files during the command execution.
Furthermore, it handles loading and saving the index cache from/to filesystem.
The files that tracks the indexes are saved to ~/.config/falcoctl.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-01 15:05:09 +01:00
Aldo Lacuku bb7f7198b2 update(index/update): remove validation logic from update command
The same validation is done by the index caching system, no need
to perform it twice.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-02-01 14:55:10 +01:00
Aldo Lacuku 5e0b8fad40 update(index/add): make the index add command idempotent
The command does not check anymore for the existence of the directories
needed by the command. The creation of such directories is delegated
to the "write" functions used to write files to disk.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-02-01 14:55:10 +01:00
Aldo Lacuku 3c60bf4940 new(index-caching): add in-memory cache mechanism for index files
Since index files can be overwritten using ENV variables we needed a
new solution to handle them on a per-command basis. Added an in-memory
caching system that handles the index files during the command execution.
Furthermore, it handles loading and saving the index cache from/to filesystem.
The files that tracks the indexes are saved to ~/.config/falcoctl.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-01 14:55:10 +01:00
Aldo Lacuku a5f62224aa refactor(index): change function signature
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-02-01 14:55:10 +01:00
Roberto Scolaro 38439929f1 fix(internal): wrong config file name used
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-31 18:05:05 +01:00
Roberto Scolaro 04827bd40f docs(README.md): added complete config file + typo
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-31 12:44:03 +01:00
Roberto Scolaro 1a1abaa2db docs(README.md): cleanup + environment vars section
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-31 12:44:03 +01:00
Roberto Scolaro e07f5209b3 chore(cmd/artifact): added help section relative to args/env/config priority
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-31 12:44:03 +01:00
Roberto Scolaro fc1e53bdc8 WIP: new documentation
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-31 12:44:03 +01:00
Aldo Lacuku 2a5aebea7e update(config): remove follower's default config values
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-30 15:31:18 +01:00
Leonardo Grasso 15a613490e fix: correct "rulesfile" spelling
Co-authored-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-01-27 17:33:46 +01:00
Leonardo Grasso 1b93b6710f chore(cmd): update tool main description
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-01-27 17:33:46 +01:00
Leonardo Grasso b3fb99b0d5 chore(cmd/artifact/follow): better command explanantion
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-01-27 17:33:46 +01:00
Leonardo Grasso 71eb83f74d chore(cmd/artifact): explain artifact reference
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-01-27 17:33:46 +01:00
Aldo Lacuku 630f9a3278 fix(date format): usedate format ISO 8601 for build date in the CI
When setting the build date in the version info, use the ISO 8601
format, same as the goreleaser. This fix affects only the docker image.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-26 18:19:44 +01:00
Roberto Scolaro 6e376a27ca refactor(cmd): added comments
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-26 16:25:44 +01:00
Roberto Scolaro 8e5986948d fix(cmd): correctly handle install args
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-26 16:25:44 +01:00
Roberto Scolaro 576ecd520e refactor: move checks from internal to cmd
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-26 16:25:44 +01:00
Roberto Scolaro f550f19fb3 fix(internal): error handling with no artifacts
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-26 16:25:44 +01:00
Aldo Lacuku 360faa0ae5 fix(version): correctly set falcoctl version at build time
Each time a falcoctl artifact (binary/OCI image) is created we make sure that the falcoctl binary
has the version fields set.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-26 15:42:43 +01:00
Roberto Scolaro 16b9ebad78 fix(cmd): arg missing in usage message of registry auth oauth
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-26 09:02:41 +01:00
Luca Guerra 05f06caab9 fix(pusher): automatically add latest only if no other tag was specified
Signed-off-by: Luca Guerra <luca@guerra.sh>
2023-01-25 10:00:35 +01:00
Aldo Lacuku a0d839a345 fix(follower): do not make assumptions on data retrieved from version endpoint
The follower retrievs the api versions from falco at start up. The api versions
are used to check if an artifact is compatible with the running instance of falco.
Here we expect falco to sent generic data, and we do not make assumptions on the
data type when unmarshalling the received data.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-24 18:43:34 +01:00
Roberto Scolaro 2c5cb2d5ee fix(cmd): added initialization to Printer
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
2023-01-24 16:03:34 +01:00
Lorenzo Susini 3d61babd31 fix: ensure extracted files are put inside dest dir
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-24 12:58:34 +01:00
Lorenzo Susini cc92d41c81 refactor: move commands from internal to cmd
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-24 12:14:35 +01:00
Federico Di Pierro 79b7a9a4f8 chore(internal): fixed a wrong log.
Moreover, avoid shadowing `equal` method.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-01-24 12:13:34 +01:00
Aldo Lacuku 811be9b700 fix(follower): correctly handle context cancelation in follower
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-23 17:07:33 +01:00
Federico Di Pierro e4dbe68aa7 new(internal/artifact): added support to pass cron-like strings to specify artifact follow intervals.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2023-01-20 11:37:06 +01:00
Lorenzo Susini 6628ba6caa refactor: rename login function to basic
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini 8370fb79de fix: use falcoctl as name of the config also when updating it
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini dbbd849708 refactor: move second level commands to their own packages
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini d3c8ac7ce9 refactor: restructure of auth commands
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini 8560532f7d upddate: remove logout command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini dd096bdffb update: rename working dir of the follower to tmp dir
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini d64e5024be refactor: match config file to registry auth commands
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini 933edfdcee refactor: match config file to artifact install and follow commands
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini 71daaaa505 fix: catch os.IsNotExists error when creating config
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-20 11:09:06 +01:00
Lorenzo Susini d90712119e update: stop retry logic earlier if you know you are going to sleep more than max delay
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-19 14:45:00 +01:00
Lorenzo Susini 5f72ed1867 update: add retry logic when retrieving falco versions
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-19 14:45:00 +01:00
Leonardo Grasso 49e5a2a37c chore(internal/config): explicitly set the config file to viper
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-01-19 12:22:47 +01:00
Leonardo Grasso e1104a6577 chore(cmd/testdata): new default config path
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-01-19 12:22:47 +01:00
Leonardo Grasso cc94eec9a3 update(config): find default config file in `/etc/falcoctl/falcoctl.yaml`
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2023-01-19 12:22:47 +01:00
Lorenzo Susini 35d74bf2f0 update: force viper values into flags if needed
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-18 17:03:23 +01:00
Lorenzo Susini df5dbd54f7 update: add all possible directories related flags to config file
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-18 17:03:23 +01:00
Lorenzo Susini 0da5193736 fix: use a move function that copies content of a file if rename fails
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-18 17:01:23 +01:00
Lorenzo Susini 8f10092f08 fix: update test data
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-18 16:12:24 +01:00
Lorenzo Susini 6e0d1db9c5 docs: rename purpose of the tool
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-18 11:42:27 +01:00
Lorenzo Susini 867d7ce3d2 fix: create config file directory if needed
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-18 10:43:26 +01:00
Lorenzo Susini 175f565500 fix: falco is returning a string for all versions
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-18 10:23:26 +01:00
Lorenzo Susini 6880e5ed29 fix: ensure options are always initialized
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-17 12:34:24 +01:00
Lorenzo Susini b8753321b4 fix: let client for registry use empty credentials if any credential was found
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-17 12:34:24 +01:00
Lorenzo Susini 59544866b6 fix: ensure all directories exists using MkdirAll
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-17 12:34:24 +01:00
Lorenzo Susini a3fa21dc7f update: update testdata to pass tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini 582a63849c update: add logic to handle config file with viper
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini 27145c33ff update: correct way to handle oauth credentials using registry name as key
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini 665aba5f64 update: bump linter version
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini 70f331d28a update: load config in index related commands
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini 71c678c52b update: remove unnecessary oauth flag
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini fa7b5e6f0c update: load config values in artifact related commands
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini bca2e11c21 update: make sure to load config file only on commands that need it
all related index commands may modify the config file, and also logi, logout and oauth ones.

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini 0a1e73f058 update: make artifact commands use a configuration file to enable feed feature
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-16 17:30:55 +01:00
Lorenzo Susini 8d8808cc15 update: get name directly from config layer.
use NameFromRef only when user do not supply the name for the config in push operations

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 17:58:53 +01:00
Lorenzo Susini 16b8745d70 chore: address minor comments
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 17:58:53 +01:00
Lorenzo Susini a0cfff1f43 chore: fix linter issues
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 17:58:53 +01:00
Lorenzo Susini 9ed9f66c2a upddate(internal/artifact/install): make use of resolve deps functionality in the artifact install command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 17:58:53 +01:00
Lorenzo Susini 01dcba1323 new(pkg/oci/puller): introduce a new function to retrieve config layer of an artifact
This is necessary since dependencies are stored in the config layer.

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 17:58:53 +01:00
Lorenzo Susini 65d6f5cf4e test(internal/artifact/install): test artifact dependencies resolution
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 17:58:53 +01:00
Lorenzo Susini 6046fd4840 new(internal/artifact/install): introduce a function to resolve dependencies between artifacts
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 17:58:53 +01:00
Lorenzo Susini a7e505857b update: add alias ls to artifact list command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-09 16:10:56 +01:00
Lorenzo Susini b57196b354 chore: use const when possible
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-04 14:45:16 +01:00
Lorenzo Susini f883f384f3 chore: don't use logrus as logger
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2023-01-04 14:42:15 +01:00
Aldo Lacuku 4c4cd3d0f0 chore(ci): bump codeql version to v2
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-03 16:53:11 +01:00
Aldo Lacuku e9b93d3ad8 fix(ci): use main branch instead of master in codeql workflow
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-03 16:53:11 +01:00
Aldo Lacuku a8cf20acc6 fix(pkg/ogi): allow the alternatives when setting a dependency in the artifact config
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-03 14:39:10 +01:00
Aldo Lacuku fa51ff0bfa fix(linting): remove hugeParam warning
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2023-01-03 10:33:10 +01:00
Aldo Lacuku 1f8a346842 chore(pkg/oci): fix typo in function name
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-27 18:28:07 +01:00
Leonardo Grasso aa4d4ca046 update: add artifact name in artifact config
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-12-22 16:17:02 +01:00
Leonardo Grasso 3cc43d91c7 update: add artifact name in artifact config
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-12-22 14:28:03 +01:00
Leonardo Grasso 116b194f10 refactor: artifact config with requirements
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-12-22 14:28:03 +01:00
Leonardo Grasso cfcf917a81 update(pkg/oci): add requirements concept to artifact config
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-12-22 14:28:03 +01:00
Aldo Lacuku fe5e90c806 fix(pkg/oci/repository): do not error when parsing semver tags that do not strictly adhere to semver
Examples: v0.1, v2 should be correctly parsed.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-21 10:33:01 +01:00
Lorenzo Susini 1f6a9ee7a2 fix: correctly remove temp files when pushing
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-21 10:32:01 +01:00
Aldo Lacuku 364102b64c refactor(oci/client): avoid yet another wrapper for the oci client
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-20 17:53:12 +01:00
Lorenzo Susini 0ebee0c3e8 chore: use default tag concurrency equal to 1
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 16:46:12 +01:00
Lorenzo Susini 57f13b124d refactor: bring check on v2 API in registry package
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 11:16:11 +01:00
Lorenzo Susini 484ec0cd37 chore: please the linter
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 11:16:11 +01:00
Lorenzo Susini d894fc72ab update: port oauth and plain-http flags to artifact commands
furthermore, ensure client gets created as we do in all other parts of the codebase,
and that repository takes it as argument along with plain http

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 11:16:11 +01:00
Lorenzo Susini c424401596 refactor: create client with correct method and use repository.Tags in artifact info
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 11:16:11 +01:00
Lorenzo Susini f5ebdcebec refactor: move responsability of listing tag to repository struct
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 11:16:11 +01:00
Lorenzo Susini 57bf41f91e refactor: make use of the new registry type
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 11:16:11 +01:00
Lorenzo Susini 4e6ea2aca5 update: introduce registry and repository package
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-20 11:16:11 +01:00
Lorenzo Susini 48ead1bc0f update: add options for oauth and plain http for pusher and puller
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Lorenzo Susini c94ca13e83 refactor: start using oauth in the *ForRegistry function
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Lorenzo Susini 04dd860ad4 update: add logic to store and retrieve client credentials
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Lorenzo Susini 983a593286 refactor: use functional options to create http client
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Lorenzo Susini 3616fc730e update: reworking client creation to accommodate oauth
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Lorenzo Susini 3c3a90ee4a update(internal/registry): add possibility store access token
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Lorenzo Susini 5c4e575fc8 new(cmd): implement oauth client credential flow
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Lorenzo Susini 49b4ed6ffe update: add oauth2 dependency
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-16 17:54:24 +01:00
Luca Guerra 2e8c023b34 fix(cmd): clarify artifact types
Signed-off-by: Luca Guerra <35580196+LucaGuerra@users.noreply.github.com>
2022-12-16 17:42:25 +01:00
Luca Guerra ed240e997a new(cmd): add falcoctl artifact list
Signed-off-by: Luca Guerra <luca@guerra.sh>
2022-12-16 17:42:25 +01:00
Luca Guerra 3acd4fc964 new(cmd): add artifact type to search
Signed-off-by: Luca Guerra <luca@guerra.sh>
2022-12-16 17:42:25 +01:00
Lorenzo Susini f1005d0a14 docs: switch ref and file in push short usage
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-15 12:41:19 +01:00
Lorenzo Susini f566ad6e40 chore: improve error messages in Login and ClientForRegistry
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-15 11:55:19 +01:00
Lorenzo Susini 1a41d3280a fix(pkg): create repo with functional options and fix main branch error
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-12 16:43:07 +01:00
Aldo Lacuku 4ad4a3ec23 chore(cmd/root): print log messagge when a termination signal is received
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-12 11:15:45 +01:00
Aldo Lacuku ca7e5d6140 new(cmd/artifact): add the follow subcommand to the artifact command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-12 11:15:45 +01:00
Aldo Lacuku 0eac03c9e7 feat(artifact/follow): add new command "artifact follow"
The new command accepts multiple artifact references. For each reference it starts a new go routine
which tracks the artifact and monitors it for changes such new versions. In case of new artifact version
it downloads and installs it in the local filesystem. The sync period can be customized using the "--every, -e"
flag. The default values is set to 24h. Keep in mind that the command does not exit, but runs in daemon mode
until it is stopped by a termination signal.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-12 11:15:45 +01:00
Aldo Lacuku 084ac34e1b new(internal/follower): add Follower type and related package
A Follower is used to track a specific artiact's version denoted by its tag.
Periodically it checks if a new version has been pushed and if so it pulls
and installs it in a given directory.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-12 11:15:45 +01:00
Aldo Lacuku 93d0fe8620 feat(internal/validate): add new helper to extract the TAG from an artifacts' reference
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-12 11:15:45 +01:00
Aldo Lacuku b33f6a8dc1 feat(oci/puller): add Descriptor method to retrieve artifacts' descriptor
In some cases, the descriptor of an artifact is checked before pulling it.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-12 11:15:45 +01:00
Lorenzo Susini 744ada51d3 update(pkg/oci): adapt creation of repositories with functional options
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-02 18:33:50 +01:00
Lorenzo Susini 47045d51bf new(pkg/oci): use functional options for creating repositories
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-12-02 18:33:50 +01:00
Aldo Lacuku c189eb015b update(CI): add floating tags to docker image based on major and minor version numbers of a release
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-01 17:46:52 +01:00
Aldo Lacuku a2efb4a93e update(output/tracker): return a nil tracker if the printer is nil
This allows to initialize a puller/pusher without a tracker by passing a nil printer
using the NewTracker functions without explicitly setting the Tracker to nil.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-01 11:22:51 +01:00
Aldo Lacuku aedee8f84e update(internal/utils): return full path of the extracted files in ExtractTarGz func
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-12-01 11:10:51 +01:00
Aldo Lacuku 19a4ab75c6 chore(artifact/install): move default paths for plugins and rulesfiles to internal/config package
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 16:10:47 +01:00
Aldo Lacuku 20ff37f26b cleanup(cmd/root) remove unused variables
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 15:05:47 +01:00
Aldo Lacuku 4fe0e84ec8 refactor(pkg/version): move version command from cmd to internal/version
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 15:05:47 +01:00
Aldo Lacuku b5eb8e5852 refactor(cmd/tls): move tls subcommands from cmd to internal/tls
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 15:05:47 +01:00
Aldo Lacuku 7a47783acd refactor(cmd/registry): move registry subcommands from cmd to internal/registry
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 15:05:47 +01:00
Aldo Lacuku a6c2655451 refactor(cmd/index): move index subcommands from cmd to internal/index
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 15:05:47 +01:00
Aldo Lacuku 4489ef0d46 refactor(cmd/artifact): move artifact subcommands from cmd to internal/artifact
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 15:05:47 +01:00
Aldo Lacuku b4e66d91f3 refactor(cmd/internal): move package utils from cmd/internal to internal
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 15:05:47 +01:00
Aldo Lacuku 309c5ef8cf update(output): add new methods to the printer
Add methods to the printer in order to set the scope, writer and disable or enable the styling
after the printer has been created.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-30 13:51:46 +01:00
Luca Guerra cf1e1adcf2 update(build): update GCI to 0.9.0
Signed-off-by: Luca Guerra <luca@guerra.sh>
2022-11-29 18:08:43 +01:00
Luca Guerra 916835818d fix(build): use new-style GCI CLI
Signed-off-by: Luca Guerra <luca@guerra.sh>
2022-11-29 18:08:43 +01:00
Aldo Lacuku 8752ed50a0 refactor(cmd): remove duplicated code when creating pullers and pushers
Add util functions that creates pullers, pushers, and clients for remote registries. Furthermore,
moves some code related to the progress tracker in the output package.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-22 09:23:44 +01:00
Aldo Lacuku 93d4a3d4ae new(CI): build and push docker images when releasing a new version
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-21 11:49:52 +01:00
Aldo Lacuku fc322ac0fb new(Dockerfile): introduce Dockerfile for falcoctl
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-21 11:49:52 +01:00
Aldo Lacuku ddae9b6c90 update(ci): use -ldflags="-s -w" when building falcoctl
It strips off information not needed during execution and reduces the size
of the resulting binary.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-21 11:47:52 +01:00
Aldo Lacuku 713be47c1f feature(cmd): add new global flag --disable-styling
The --disable-styling flag makes falcoctl tool output plain text by disabling spinners,
progress bars, and colors. falcoctl can determine if it is not attached to a TTY and disable the styling.
Furthermore, the user can forcibly disable the styling by using the --disable-styling flag.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-11-21 11:46:52 +01:00
Aldo Lacuku b572636efe new(docs): add docs for the falcoctl tool
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-10-27 20:51:26 +02:00
Aldo Lacuku 738e43f19a new(docs): add installation instructions
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-10-27 20:51:26 +02:00
Lorenzo Susini 1e22e2dbc7 chore: rename install tls command to tls install
This allow to be compliant with the naming we have chosen for this repo
and the other commands.

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-20 12:53:02 +02:00
Lorenzo Susini 56e96870e6 update(pkg/oci): sort tags using semver ordering when retrieving them
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-17 15:29:13 +02:00
Lorenzo Susini c088ec9d08 update: add semver library
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-17 15:29:13 +02:00
Lorenzo Susini 8614cde3e1 test: add new test for annotation source option
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-13 11:49:17 +02:00
Lorenzo Susini f837c554ab new(cmd): introduce annotation-source flag
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-13 11:49:17 +02:00
Lorenzo Susini e38a30cb60 new(pkg): add annotation source option in the pusher
Co-authored-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-13 11:49:17 +02:00
Lorenzo Susini 96a4ee5ad6 new(pkg): introduce a function to list available platforms for a given artifact
this will be used for example in CI, to mirror the state from our
S3 bucket to the new OCI registry we will be using.

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-11 09:30:45 +02:00
Aldo Lacuku ba7ae083c1 fix(oci/pusher): minor fixes in the pusher logic
* fix panic in pusher when the platform is not in the right format;
* always use "index image" when pushing plugin artifacts: fixes the
   missing platform info when only one plugin is pushed;
* only push one rulesfile artifact and error when multiple filepaths
   are passed: fixes the case where an image index is pushed referencing
   mutliple rulesfiles.
* error when dependencies are passed for plugin artifacts;
* add tests for the pusher logic: 100% file and 89.7% statements coverage
  for the pusher package.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-10-11 09:29:46 +02:00
Lorenzo Susini b6dc8a90b1 chore(ci): use -cover flag also in CI
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-10 09:38:43 +02:00
Lorenzo Susini b178496166 test(pkg/index): add tests for index config
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-10 09:38:43 +02:00
Lorenzo Susini a752268d68 refactor: rename FetchIndex to Fetch
Index is implicit since it's the name of the package

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-10 09:38:43 +02:00
Lorenzo Susini cf3ac81f76 test(pkg/index): introduce test for fetch index
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-10 09:38:43 +02:00
Lorenzo Susini c02ccc26c4 test(pkg/index): add tests on index related ops
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-10 09:38:43 +02:00
Lorenzo Susini 1331575e49 chore: add coverage when running make test
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-10 09:38:43 +02:00
Lorenzo Susini e93a348fd1 update(pkg): use map with empty structs to as set to automatically delete duplicates
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-06 17:13:05 +02:00
Lorenzo Susini b5f8114bd2 update: fix naming of defaultMinScore
Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Lorenzo Susini <49318629+loresuso@users.noreply.github.com>
2022-10-06 17:13:05 +02:00
Lorenzo Susini 4a88efa613 update(cmd): add --min-score flag to artifact search
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-06 17:13:05 +02:00
Lorenzo Susini 7eed276a17 update(cmd): introduce min score in artifact search
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-06 17:13:05 +02:00
Lorenzo Susini 6d71285ba3 update(pkg): reimplement search using levenshtein distance and partial match
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-06 17:13:05 +02:00
Lorenzo Susini 4c29b18e3c new(pkg): introduce functions to compute levenshtein distance and score
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-06 17:13:05 +02:00
Lorenzo Susini b0a0a9519c chore: fix linting issues
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-05 18:17:21 +02:00
Lorenzo Susini 0cf19b6c98 update(pkg): add way to print output of artifact info as a table
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-05 18:17:21 +02:00
Lorenzo Susini 0643f2fb9e update(cmd): add artifact info to its parent command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-05 18:17:21 +02:00
Lorenzo Susini e08fe557ed new(cmd): introduce artifact info command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-05 18:17:21 +02:00
Lorenzo Susini deaa0b94d6 new(pkg): introduce a function to get all tags from a ref
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-05 18:17:21 +02:00
Lorenzo Susini 4d7d422966 chore(cmd): fix comment about artifact install
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-05 13:44:20 +02:00
Lorenzo Susini e6e6f2673c chore: fix error messages, warnings and style for handling errors
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini 7c3580b34f update(cmd): add dedicated parsing logic for artifact install input
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini bb09378a9c update(cmd): use parsing functions from ORAS
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini 2ea0adfc55 update(cmd): add utility function to get and merge all configured indexes
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini 88eed63c40 update: add artifact install to its parent command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini ad4e5b29db new(cmd): implement artifact install command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini 00599f029d update(pkg/oci): add filename to RegistryResult
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini b021161ad7 update(cmd/internal): add a function to copy bytes in chunks
better memory footprint and solving gosec problem

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini c6585b145b update(pkg/oci): add utility function to get manifest from descriptor in pull operations
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini 38b3dec9dd update(pkg): let entryByName return a boolean value
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Lorenzo Susini 59a30228aa new(cmd/internal/utils): add utility function to decompress and extract a .tar.gz file
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-04 22:20:18 +02:00
Aldo Lacuku e7091571ac chore(pkg): remove dead code
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-10-04 18:08:17 +02:00
Lorenzo Susini f6a5c3caff fix(pkg/oci): avoid remote call to fetch descriptor
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>

Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Lorenzo Susini <49318629+loresuso@users.noreply.github.com>
2022-10-03 16:46:14 +02:00
Lorenzo Susini e50d8af620 fix(pkg/oci): add defer close to reader
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>

Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Lorenzo Susini <49318629+loresuso@users.noreply.github.com>
2022-10-03 16:46:14 +02:00
Lorenzo Susini 1f82e8d9cf update(cmd): update pull command according to new puller api
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 16:46:14 +02:00
Lorenzo Susini 15396e6146 update(pkg/oci): remove the need for artifact type in pull
also, allow to specify no tag when pulling.
the default one will be used in this case (latest), exactly the same as in the push command.

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 16:46:14 +02:00
Lorenzo Susini 3285362998 update(pkg/options)!: pull operations do not require type flag anymore
Also, tag flags are available only on push command

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 16:46:14 +02:00
Lorenzo Susini 8abd62090f update(pkg/oci): add type to RegistryResult
It will be used to understand which kind of artifact was pulled

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 16:46:14 +02:00
Lorenzo Susini 9f3efb2bea update: remove unused functions in the pusher
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 09:03:39 +02:00
Lorenzo Susini cc11db6c35 fix: fix linting
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 09:03:39 +02:00
Lorenzo Susini 4d84a05003 fix: use WithTargetPlatform only if there is a fat manifest stored
future works will also remove the artifact type

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 09:03:39 +02:00
Lorenzo Susini ab2bbfae4f update(cmd): add the 'tags' flag to push command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 09:03:39 +02:00
Lorenzo Susini 669b69365a update(pkg/oci/pusher): give the possibility to push with multiple tags
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 09:03:39 +02:00
Lorenzo Susini a389b41e27 chore: bump oras-go to v2.0.0-rc.3
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 09:03:39 +02:00
Lorenzo Susini 3adb56db84 update(pkg/oci/pusher): let the pusher push plugins untagged and tag the fat manifest at the end
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-10-03 09:03:39 +02:00
Leonardo Grasso b51ce5ab43 update(cmd): allow pushing multiple artifacts with different platforms
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-10-03 09:03:39 +02:00
Leonardo Grasso 684f5fd235 update(pkg/oci/pusher): allow pushing multiple artifacts with different platforms
At the same time.

Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-10-03 09:03:39 +02:00
Leonardo Grasso 716c464a6a chore(pkg/options): refactor artifact options
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-10-03 09:03:39 +02:00
Leonardo Grasso b87f1758b7 chore(cmd): use functional opts
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-10-03 09:03:39 +02:00
Leonardo Grasso 7a588bfd12 update(pkg/oci/pusher): use functional opts
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-10-03 09:03:39 +02:00
Aldo Lacuku 440525beb2 fix(cmd/utils): support connection checking for remote registries without authentication
Some commands such as pull does not need to be authenticated to the remote registry when interacting with them.
When no credentials has been found/provided we just check that the remote registry implements the right api i.e. Docker Registry API V2.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-22 15:47:38 +02:00
Lorenzo Susini cb319e1a3d fix: create an index with consistent state also when fetching it
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-22 15:09:37 +02:00
Aldo Lacuku 18def850e4 chore(pkg): fix a couple of typos
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-22 11:44:39 +02:00
Leonardo Grasso 2dc044763c update(cmd): redefine `--depends-on` flag
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-22 09:00:38 +02:00
Leonardo Grasso 0485fcf11e update(pkg/oci/pusher): generic deps with alternatives
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-22 09:00:38 +02:00
Leonardo Grasso 68ce61024b update(pkg/oci): switch to a generic depedency system with alternatives
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-22 09:00:38 +02:00
Leonardo Grasso 5141b75174 new(pkg/artifact): package to deal with abstract artifacts
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-22 09:00:38 +02:00
Leonardo Grasso 0e237b977d docs(README.md): update accordingly to the proposal
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 09:57:33 +02:00
Leonardo Grasso 9a26052109 docs(proposal/20220916-rules-and-plugin-distribution): clean up leftover
Co-authored-by: Luca Guerra <35580196+LucaGuerra@users.noreply.github.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 09:57:33 +02:00
Leonardo Grasso 61e8754dc1 docs(proposal): # Falco Rules and Plugin distribution
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Luca Guerra <luca@guerra.sh>

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 09:57:33 +02:00
Leonardo Grasso 2808564f05 refactor: index.New
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 09:56:33 +02:00
Leonardo Grasso 42dbc7e77c chore(pkg/index): Filename is not needed
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 09:56:33 +02:00
Leonardo Grasso 0861db8ed8 new(pkg/index): read an index from file
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 09:56:33 +02:00
Leonardo Grasso 4e32e59be2 new(pkg/index): index normalization func
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 07:19:33 +02:00
Leonardo Grasso 3f3ec29488 build(Makefile): correc default branch
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-21 07:15:33 +02:00
Aldo Lacuku 02b86a63f3 update(CI): change branch name from master to main in the integration workflow
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-20 19:13:30 +02:00
Aldo Lacuku 4f1e7a91e4 update(cmd): check if registry is reachable before interacting with it
Add a common check for login, push and pull commands that makes sure that
the remote registry is reachable and that we have the required permissions
to push and pull artifacts.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-20 15:31:30 +02:00
Aldo Lacuku 232920e03e update(cmd/pull): add support for progress bar while pulling artifacts
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-20 11:33:29 +02:00
Aldo Lacuku 7479ecbca3 update(cmd/push): add support for progress bar while pushing artifacts
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-20 10:58:29 +02:00
Aldo Lacuku 6d4a553f09 new(output): add support for progress tracker in pusher and puller interfaces
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-20 10:58:29 +02:00
Aldo Lacuku 73dd283585 update(CI/build): build falcoctl binaries without using goreleaser
Build the binaries using a matrix. Matrix jobs are run in parallel by default
this speeds up the build procces by 10x. The final outcome is the same.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-20 10:01:28 +02:00
Lorenzo Susini a020044ae2 chore: improve command description, naming
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Lorenzo Susini <49318629+loresuso@users.noreply.github.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini 5650b2e84d update(cmd): fix linting issue and avoid reading config twice
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini 9d681c119e update(testdata): update testdata to pass tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini c44bc0980a update(cmd): add all the new commands to the root command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini a1494013da new(cmd): implement artifact search command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini 67541081a2 new(cmd): implement index remove command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini 1192cdc43c new(cmd): implement index list command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini c50852df4f new(cmd): implement index update command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini ddb47ca837 new(cmd): implement index add command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini 7488a2fb7c update(pkg): add ability to print tables using pterm
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini 88e47bfea1 new(pkg): create a library to manage index configs
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini faf9353d3e new(pkg): create a library to manage indexes
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini 60f0e5fe26 new(pkg): introduce a function to download a remote index
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-20 09:58:28 +02:00
Lorenzo Susini cc37344870 chore: allow '_' in the --platform options. needed for pushing/pulling e.g 'x86_64'
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-16 14:40:39 +02:00
Lorenzo Susini b26e92907f refactor: rename subcommands of registry to more appropriate registry_*
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-16 14:40:39 +02:00
Lorenzo Susini e6ddd8190f refactor: rename rule to more appropriate rulesfile
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-16 14:40:39 +02:00
Jason Dellaluce 23a4bf3356 update(OWNERS): remove mfdii from reviewers
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>

Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
2022-09-15 18:40:31 +02:00
Jason Dellaluce 7986eaa641 update(OWNERS): add new maintainers and reviewers
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2022-09-15 18:40:31 +02:00
Aldo Lacuku abfead8549 fix(pusher): retrieve only the index and not all the layers
Fetch only the index data instead of the full graph pointed by the index
which is what the copy function in ORAS does. Using the FetchReference function
instead.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-13 18:40:21 +02:00
Aldo Lacuku f08acf9f13 cleanup: remove unused packages and dead code
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-13 15:34:21 +02:00
Aldo Lacuku c2f12a5151 chore(tests): update tests based on the latest changes
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Aldo Lacuku 2501d18fcd chore(go.mod): update go.mod
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Aldo Lacuku 0b3343b789 update(cmd): update register and root command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Aldo Lacuku b9859f50e7 update(login/logout): correctly handle context
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Aldo Lacuku 1ed27ea206 update(registry commands): support image index in pull and push cmds
Furthermore, better handling of flags and options. The context is now
correctly passed down to the commands starting from the root one.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Aldo Lacuku 731ba23f01 update(pkg/oci/puller): handle special case for plugins when image index is present
Based on the OS/ARCH desired, the puller gets the right version of the artifact.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Aldo Lacuku 982c661f2f update(pkg/oci/pusher): add support for image index manifest
Furthermore, the pusher handles the update of plugin artifacts based
on their archetecture and operating system.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Aldo Lacuku 690bc97e22 cleanup(cmd): remove unused code and outdated commands
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-12 10:50:14 +02:00
Lorenzo Susini 67071344ba fix: golangci/goheader, exclude goheader for multi authors files
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 907c773ef5 fix: go mod tidyness
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-06 16:26:36 +02:00
Lorenzo Susini cbf2125447 fix: fix build on windows using os package to get stdin
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 6860a91324 update: rename config options to common options
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 144e5048ee update: update go.mod, go.su and .gitignore
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 9ec7c3baec update: introduce the doc.go file on each new create package
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 756cf3e882 update: update test data to pass tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini e9c86e5c8a new: add constants to the oci pkg
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini f041fc5998 new: implement the pull command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini c092e6ff56 new: implement the push command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 8bca6f5bb3 new: define useful types for the oci pkg
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 3ab496ec9f new: create a library to push Falco artifacts to a remote OCI compliant registry
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini dc5c9f1736 new: create a library to push Falco artifacts to a remote OCI compliant registry
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 446048d8f8 new: implement the registry umbrella command and add it to root command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 7702933c11 new: implement the logout command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 4cf51be11e new: implement the login command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini 1cf5af18cd new: create a library to store and retrieve credentials on files.
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini b22e24438c new: create new client library.
The client will be used to interact with remote registries

Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Aldo Lacuku <aldo@lacuku.eu>
2022-09-06 16:26:36 +02:00
Lorenzo Susini df332a8d5c fix: update testdata to pass tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-02 17:18:42 +02:00
Lorenzo Susini e04be6dce3 cleanup: remove repo related commands
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-09-02 17:18:42 +02:00
Lorenzo Susini d451243258 fix(docs): use correct link for slack
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-08-29 16:03:33 +02:00
Aldo Lacuku 28f447006a new(CI): add the release CI workflow
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-24 17:10:10 +02:00
Aldo Lacuku f973774a5b update(CI): use goreleaser in integration pipeline when building falcoctl
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-24 12:57:10 +02:00
Aldo Lacuku 38e77891b5 update(build): update goreleaser configuration file
Build the falcoctl binary using goreleaser.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-24 12:57:10 +02:00
Aldo Lacuku 08498855e5 fix(tests): fix output tests
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-23 15:53:05 +02:00
Aldo Lacuku 97ab63da5a cleanup(cli): remove unused commands and interfaces.
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-19 16:54:47 +02:00
Aldo Lacuku 68cd2c5264 refactor(cmd/root): drop custom signal handling for the root cmd
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-19 16:54:47 +02:00
Aldo Lacuku c3023d2245 refactor(cli): drop cmd/config_options.go in favor of pkg/options
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-19 16:54:47 +02:00
Aldo Lacuku 2b95e0bc4b chore(go.mod/sum): update go.mod and go.sum
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-18 17:03:41 +02:00
Aldo Lacuku 34f7d5de8d update(Makefile): update the build target to set the version info
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-18 17:03:41 +02:00
Aldo Lacuku af03b475fa new(tests): add unit tests for the version command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-18 17:03:41 +02:00
Aldo Lacuku 7e0773405f new(cli): add version command
Version prints the version of the falcoctl binary

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-18 17:03:41 +02:00
Aldo Lacuku f8eb69455d new(pkg/options): add the options packages
The options packags handles all the commons flags and configuration.
Having the common options managed in one place we avoid duplicated
logics in each command that uses the same flags.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-18 17:03:41 +02:00
Aldo Lacuku e037a42fcc new(tests): add unit tests for the output package.
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-18 17:03:41 +02:00
Aldo Lacuku dd68f133e7 new(cli): add generic output handler for the commands
The output is handled by a printer based on the pterm library.
The output package should provide all the output objects such as:
printers, spinners, progress bars and so on. It helps to have a
consistent output style for all the commands.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-18 17:03:41 +02:00
Aldo Lacuku 3890ca2632 update(Makefile): lint all files changed from the master branch
Using "--new-from-rev master" shows the new issues created after git
revision "master".

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-12 11:54:26 +02:00
Aldo Lacuku d5023136d6 chore(cli): add doc.go file to the tls package
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 21:53:18 +02:00
Aldo Lacuku 989da561a1 update(cli): simplify and make the 'install tls' OS agnostic
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 21:53:18 +02:00
Aldo Lacuku 280f0ccd7b refacto(cli): remove linux OS specific 'install tls' command
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 21:53:18 +02:00
Aldo Lacuku 40077a5d9f refactor(cli): remove pkg/tls/generator.go
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 21:53:18 +02:00
Aldo Lacuku d207a18bd1 refacto(cli): move 'install tls' business logic in 'install/tls'
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 21:53:18 +02:00
Aldo Lacuku 00fc4b4152 chore(falcoctl): format and add license header to go files.
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 17:26:18 +02:00
Aldo Lacuku 3d9e31ff2a new(Makefile): add new targets to the Makefile
* fmt target: make sure that all files are formatted, have the license
  header (if not adds it), checks that the package imports are in order
  and that go mod and sum are tidied.

* lint target: runs golangci-lint against the modified files. Handy
  to check the modified code before pushing it.

Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 17:26:18 +02:00
Aldo Lacuku 5d200783b9 new(CI): support building falcoctl for different OSs and archs
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 15:00:17 +02:00
Aldo Lacuku fba071ecb1 feat(CI): add linting
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-10 10:12:16 +02:00
Aldo Lacuku 12643ebef5 chore(docs): remove release notes section from PR template
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-09 15:00:12 +02:00
Aldo Lacuku 20b3f52779 update(tests): fix broken tests
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-09 14:49:12 +02:00
atharva29 12d759fef7 removed country shorthand
Signed-off-by: atharva29 <atharvaajgaonkar29@gmail.com>
2022-08-08 10:29:41 +02:00
atharva29 46618f69fe removed shorthand
Signed-off-by: atharva29 <atharvaajgaonkar29@gmail.com>
2022-08-08 10:29:41 +02:00
Aldo Lacuku 7c4d21cf0a chore(falcoctl): bump dependecies
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-08 10:28:42 +02:00
Aldo Lacuku 661970730a chore(falcoctl): bump go version to 1.19
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
2022-08-08 10:28:42 +02:00
Jason Dellaluce cdb01faa38 update(OWNERS): move inactive approvers to emeritus_approvers
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2022-07-19 17:45:06 +02:00
Lorenzo Susini 30f73dd1b3 update(cmd/testdata): update testdata to pass tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-06-01 17:31:39 +02:00
Lorenzo Susini 3a237694cc chore(cmd): better output formatting of list repo command
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-06-01 17:31:39 +02:00
Andrea Bonanno b59757bb20 new: adds list repo command
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-06-01 17:31:39 +02:00
Leonardo Grasso 2a38d47184 test(cmd): update test data
Co-Authored-by: Andrea Bonanno <andrea@bonanno.cloud>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-05-26 18:14:27 +02:00
Leonardo Grasso 7dd77c7474 fix(cmd): missing dot
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-05-26 18:14:27 +02:00
Andrea Bonanno 38f80a0798 new: adds repo remove command
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-05-26 18:14:27 +02:00
Andrea Bonanno d3c366374c update: fix write permissions and typos
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
2022-05-26 17:56:27 +02:00
Andrea Bonanno 753375fb7d new: adds "repo add" command and internal representation of repo sources
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-05-26 17:56:27 +02:00
Andrea Bonanno 229855c168 chore: fix typos
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-05-26 17:56:27 +02:00
Lorenzo Susini 99c2a2cb28 update: update testdata to pass tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-03-23 17:55:44 +01:00
Lorenzo Susini 002cf4de93 cleanup: remove circleci
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-03-23 17:55:44 +01:00
Lorenzo Susini 8dceffa950 new: introduce github actions for building, testing and code quality
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-03-23 17:55:44 +01:00
Andrea Bonanno 2421e00028 update: config file in dedicated directory
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-03-22 11:30:41 +01:00
Andrea Bonanno fd06b640f5 new: adds search registry command and its option/config
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-03-18 18:19:27 +01:00
Andrea Bonanno 183d9d0dd7 new: adds registry types and functions
Signed-off-by: Andrea Bonanno <andrea@bonanno.cloud>
Co-authored-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-03-18 18:19:27 +01:00
Lorenzo Susini c971d56085 doc(README): state that falcoclt is currently under development
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
2022-03-18 18:17:27 +01:00
Lorenzo Susini c5227adbaa fix(tests): fixing testdata to pass tests
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-03-17 19:02:01 +01:00
Lorenzo Susini 5e7e427769 cleanup: update go.mod and go.sum
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-03-17 14:44:27 +01:00
Lorenzo Susini 48568a3ca4 cleanup(pkg/converter): removing PSP convertion logic
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-03-17 14:44:27 +01:00
Lorenzo Susini 89f9d1b068 cleanup(cmd): removing commands about PSP convertion
Signed-off-by: Lorenzo Susini <susinilorenzo1@gmail.com>
Co-authored-by: Andrea Bonanno <andrea@bonanno.cloud>
2022-03-17 14:44:27 +01:00
Leonardo Grasso 45508c14f8 build: upgrade deps
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-03-17 14:44:27 +01:00
Leonardo Grasso 144a7e26c8 test(cmd): update CLI test to reflect new impl
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-03-17 14:44:27 +01:00
Leonardo Grasso 29486312da refactor: general refactor and cleanup
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-03-17 14:44:27 +01:00
Leonardo Grasso e65bed632c chore(cmd): internalize validation package
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-03-17 14:44:27 +01:00
Leonardo Grasso f6311ba559 chore: clean up old kubernetes stuff
Since we don't want to install Falco in Kubernetes (we want Falco to be installed on the at Linux level), the old deployment system is not needed anymore.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-03-17 14:44:27 +01:00
Leonardo Grasso 3e3fc65041 chore: remove install module command
We don't want anymore another driver installation method.
The `falcosecurity/probeloader` docker image has been removed too.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-03-17 14:44:27 +01:00
Lorenzo Fontana 80ee501d3b update: remove rajibmitra from OWNERS
After changing the github username from rajibmitra to rmitr - Rajib expressed that is very busy to donate time to this project in the near future. We are going to keep Rajib in the org of course but removing from maintainer duty. Rajib, you'll be welcome once you are ready to come back!

Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2020-05-19 16:34:58 +02:00
Leonardo Grasso 854ef9a9a4 refactor(cmd): cleanup rootCmd wrapper
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-04-06 11:30:24 +02:00
Leonardo Grasso 16428bbb10 chore: temporarily disable test race
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-04-06 11:30:24 +02:00
Leonardo Di Donato 9ce591efd0 update(cmd/testdata): test help command and flag
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-04-06 11:30:24 +02:00
Leonardo Di Donato 05c786bb63 new(cmd): CLI tests
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-04-06 11:30:24 +02:00
Leonardo Di Donato 83ddbd4ff4 new(cmd/testdata): CLI fixtures
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-04-06 11:30:24 +02:00
Leonardo Di Donato 6a4915e404 update(cmd): wrap root command
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-04-06 11:30:24 +02:00
Leonardo Di Donato e21c17fec8 deps: go modules
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-04-06 11:30:24 +02:00
Leonardo Grasso 0fe2a2bf63 fix(.circleci): correct typo in config path
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-04-03 11:50:26 +02:00
Leonardo Grasso f90860cbad fix(Makefile): correct target name
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-04-03 11:50:26 +02:00
Leonardo Grasso 7dc1415c99 chore: initial circleci configuration just for testing
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-04-02 15:04:23 +02:00
Leonardo Grasso 0bb8d91e5d new: add makefile
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-04-02 15:04:23 +02:00
Leonardo Grasso 0b7ff211cd fix(pkg/kubernetes): add missing formatting directive
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-04-02 15:04:23 +02:00
Leonardo Grasso 6f9607416d refactor(cmd): improve PersistentPreRun
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-30 12:21:33 +02:00
Leonardo Grasso 34c4afda20 chore: update deps
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-30 12:21:33 +02:00
Leonardo Grasso 73e1479765 fix(cmd): automatically fallback flags to ENV and config file
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-30 12:21:33 +02:00
Leonardo Grasso 3fefd44801 chore(cmd): cleanup IOStreams from options
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-30 12:21:33 +02:00
Leonardo Grasso 311b70414b chore(cmd): init kube flags only when needed
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-30 12:21:33 +02:00
Leonardo Grasso f9b9f8d4a5 chore(cmd): basic config options with validation
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-30 12:21:33 +02:00
Leonardo Grasso 4e5c20d874 refactor(pkg/tls): simplified TLS implementation
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-26 12:48:20 +01:00
Leonardo Grasso 38e19ac332 fix(cmd): correct error handling in PSP conversion func
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-22 09:26:28 +01:00
Leonardo Grasso ec60f498da fix(cmd): correct misspelled words
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-22 09:26:28 +01:00
Leonardo Grasso 58e262b0ad fix: apply gofmt
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-22 09:26:28 +01:00
Leonardo Grasso 4b5ec61363 refactor(pkg/rules): remove unused package
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-22 09:26:28 +01:00
Leonardo Grasso d4ff33c2cb refactor(pkg/cli): remove unused package
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-22 09:26:28 +01:00
Leonardo Grasso 25187c41c9 fix(pkg/tls): correct dir permission bits
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-13 16:11:51 +01:00
Leonardo Grasso d14b2a6d89 fix(cmd): correct undefined func calls
Fixes #76

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-03-02 17:26:06 +01:00
Leonardo Di Donato 577d22a8c6 docs: logo from community repo + refinements to README
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-02-18 14:28:21 +01:00
Kris Nova 1ee329ebfa docs: adding logo to README.md
Co-authored-by: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Kris Nova <kris@nivenly.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-02-18 14:28:21 +01:00
Anish Shah 885d6d5399 chore(cmd): rename probeloader to kernelmoduleloader
Issue #53

Co-authored-by: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Anish Shah <shah.anish07@gmail.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-02-18 14:17:42 +01:00
Nitya Dhanushkodi b0d030c15c refactor: Use apierrors package
This can match errors even if the error message changes.

Signed-off-by: Nitya Dhanushkodi <nityadhanushkodi@gmail.com>
2020-02-06 06:57:46 +00:00
Nitya Dhanushkodi 3a3f5bebde Create auditsink resource idempotently
[issue falcosecurity#47]

Signed-off-by: Nitya Dhanushkodi <nityadhanushkodi@gmail.com>
2020-02-06 06:57:46 +00:00
Suresh Palemoni 3834c07735 refactored pkg directory inline with go idiomatic practices
Signed-off-by: Suresh Palemoni <suresh.palemoni@gmail.com>
2020-01-26 19:36:05 +01:00
Suresh Palemoni 104f6a05bc refactored pkg directory inline with go idiomatic practices
Signed-off-by: Suresh Palemoni <suresh.palemoni@gmail.com>
2020-01-26 19:36:05 +01:00
Suresh Palemoni 0b592a64d8 refactored cmd package inline with go idiomatic practices
Signed-off-by: Suresh Palemoni <suresh.palemoni@gmail.com>
2020-01-24 19:30:32 +01:00
Kris Nova 389b00ca5f Removing ds.yaml
Signed-off-by: Kris Nova <kris@nivenly.com>
2020-01-23 19:50:06 +01:00
Kris Nova d2363a24c4 Adding basic README.md content
Signed-off-by: Kris Nova <kris@nivenly.com>
2020-01-23 00:32:47 +01:00
Leonardo Di Donato 5969b1d25f fix(cmd): typo in install tls command
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-01-07 20:02:06 +01:00
Leo Di Donato ab01b4eb43 update: add leogr to OWNERS file
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-01-07 18:58:12 +01:00
Leonardo Grasso 820f637b6d new(pkg/tls): generate client key/cert
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2019-12-20 18:26:42 +01:00
Leonardo Grasso 69e20d62f1 fix(pkg/tls): set default expiration to 356 days
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2019-12-20 18:26:42 +01:00
Leonardo Grasso be0bd2b676 fix(pkg/tls): correct CN default, subject name and add missing CA extensions
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2019-12-20 18:26:42 +01:00
Leonardo Grasso 037c951074 fix(pkg/tls): correct server cert signing
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2019-12-20 18:26:42 +01:00
Leonardo Di Donato a45142df41 fix(pkg/tls): do not get basedir of the certs path
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-12-20 18:26:42 +01:00
Leonardo Di Donato 7d450edf98 fix(cmd): search for env var, if missing fallback to default value correctly
`falcoctl install tls` command

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-12-20 18:26:42 +01:00
Tyler Auerbeck cd4ba67c5b Add cleanup for cr, crb and auditsink
Signed-off-by: Tyler Auerbeck <tauerbec@redhat.com>
2019-11-27 19:05:15 +01:00
Tyler Auerbeck a5e1b4a651 Update appsv1beta2 -> appsv1
Signed-off-by: Tyler Auerbeck <tauerbec@redhat.com>
2019-11-26 00:35:14 +01:00
Kris Nova a52449dcda Interface for processes
Adding an interface.go for the new structure in proposal #44

Signed-off-by: Kris Nova <kris@nivenly.com>
2019-11-20 01:18:12 +01:00
Leonardo Di Donato 27269666d5 update(cmd): install rule skeleton
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-11-19 23:19:13 +01:00
Leonardo Di Donato 80265043f0 docs(pkg/rules): license header
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-11-19 23:19:13 +01:00
Leo Di Donato dedf40e5a1 fix(cmd): stop exec when TLS errors out
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-11-19 23:19:13 +01:00
Leo Di Donato 5df43d6599 fix(cmd): help messages for TLS commands
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-11-19 23:19:13 +01:00
Kris Nova d1e20ac5e9 adding changes
Signed-off-by: Kris Nova <kris@nivenly.com>
2019-11-19 23:19:13 +01:00
Kris Nova b4457a4abd More work on the Kubernetes package
Fixing installer, we were missing some variables

Signed-off-by: Kris Nova <kris@nivenly.com>
2019-11-19 23:19:13 +01:00
Kris Nova 4159403926 Commit at the airport, working on fixing install and stubbing out Falco object
Signed-off-by: Kris Nova <kris@nivenly.com>
2019-11-19 23:19:13 +01:00
Kris Nova 941c569bd2 Few cleanup items
- Adding linux build for TLS
 - Adding naming convention for /cmd
 - Ensuring licenses in every file

Signed-off-by: Kris Nova <kris@nivenly.com>
2019-11-19 23:19:13 +01:00
Kris Nova 475807cff6 Adding TLS generation for Falcoctl
Signed-off-by: Kris Nova <kris@nivenly.com>
2019-11-19 23:19:13 +01:00
Mark Stemm c4493b3e17 Add ability to limit generated rules to namespaces
Add the ability to limit generated rules to specific namespaces (for k8s
audit events). If an annotation falco-rules-psp-namespaces is present on
the PSP, those namespaces are populated into a list _psp_namespaces and
used by a macro _psp_match_namespace.

You can also provide a slice of namespaces to the converter
GenerateRules method. This will be used if the psp has no annotation.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-11-07 08:28:09 +01:00
282 changed files with 28883 additions and 6140 deletions

View File

@ -1,6 +1,6 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines in the [CONTRIBUTING.md](https://github.com/falcosecurity/falco/blob/dev/CONTRIBUTING.md) file in the Falco repository.
1. If this is your first time, please read our contributor guidelines in the [CONTRIBUTING.md](https://github.com/falcosecurity/.github/blob/main/CONTRIBUTING.md) file in the Falco `.github` repository.
2. Please label this pull request according to what type of issue you are addressing.
3. Please add a release note!
4. If the PR is unfinished while opening it specify a wip in the title before the actual title, for example, "wip: my awesome feature"
@ -49,16 +49,3 @@ If PR is `kind/failing-tests` or `kind/flaky-test`, please post the related issu
Fixes #
**Special notes for your reviewer**:
**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, prepend the string "action required:".
For example, `action required: change the API interface of the rule engine`.
-->
```release-note
```

22
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
gomod:
update-types:
- "patch"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
actions:
update-types:
- "minor"
- "patch"

37
.github/workflows/codeql-analysis.yaml vendored Normal file
View File

@ -0,0 +1,37 @@
name: "CodeQL"
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '28 11 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language:
- go
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@d23060145bc9131d50558d5d4185494a20208101 # v2.2.8
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@d23060145bc9131d50558d5d4185494a20208101 # v2.2.8
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@d23060145bc9131d50558d5d4185494a20208101 # v2.2.8

103
.github/workflows/docker-image.yaml vendored Normal file
View File

@ -0,0 +1,103 @@
name: docker-image
on:
workflow_call:
inputs:
release:
required: true
type: string
commit:
required: true
type: string
build_date:
required: true
type: string
sign:
required: false
default: false
type: boolean
outputs:
digest:
description: The digest of the pushed image.
value: ${{ jobs.docker-image.outputs.digest }}
permissions:
contents: read
id-token: write
jobs:
docker-image:
runs-on: ubuntu-22.04
outputs:
image: ${{ steps.build-and-push.outputs.image }}
digest: ${{ steps.build-and-push.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
id: Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Login to Docker Hub
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_SECRET }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
role-to-assume: arn:aws:iam::292999226676:role/github_actions-falcoctl-ecr
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public
- name: Docker Meta
id: meta_falcoctl
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
with:
# list of Docker images to use as base name for tags
images: |
docker.io/falcosecurity/falcoctl
public.ecr.aws/falcosecurity/falcoctl
tags: |
type=ref,event=branch
type=semver,pattern={{ version }}
type=semver,pattern={{ major }}
type=semver,pattern={{ major }}.{{ minor }}
- name: Build and push
id: build-and-push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta_falcoctl.outputs.tags }}
file: ./build/Dockerfile
build-args: |
RELEASE=${{ inputs.release }}
COMMIT=${{ inputs.commit }}
BUILD_DATE=${{ inputs.build_date }}
- name: Install Cosign
if: ${{ inputs.sign }}
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
- name: Sign the images with GitHub OIDC Token
if: ${{ inputs.sign }}
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
TAGS: ${{ steps.meta_falcoctl.outputs.tags }}
COSIGN_YES: "true"
run: echo "${TAGS}" | xargs -I {} cosign sign {}@${DIGEST}

166
.github/workflows/integration.yaml vendored Normal file
View File

@ -0,0 +1,166 @@
name: Integration Pipeline
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
goos:
- linux
- darwin
- windows
goarch:
- arm64
- amd64
exclude:
- goarch: arm64
goos: windows
steps:
- name: Checkout commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
check-latest: true
- name: Build Falcoctl
run: >
go build -ldflags="-s -w" -o falcoctl-${{ matrix.goos }}-${{ matrix.goarch }} .
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- name: Create Archives
run: |
cp falcoctl-${{ matrix.goos }}-${{ matrix.goarch }} falcoctl
tar -czvf falcoctl-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz falcoctl LICENSE
- name: Upload falcoctl artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: falcoctl-${{ matrix.goos }}-${{ matrix.goarch }}
path: ./falcoctl-${{ matrix.goos }}-${{ matrix.goarch }}
retention-days: 1
- name: Upload falcoctl archives
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: falcoctl-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
path: ./falcoctl-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
retention-days: 1
docker-configure:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-22.04
outputs:
release: ${{ steps.vars.outputs.release }}
commit: ${{ steps.vars.outputs.commit }}
build_date: ${{ steps.vars.outputs.build_date }}
steps:
- name: Set version fields
id: vars
run: |
echo "release=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "commit=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
docker-image:
if: ${{ github.event_name == 'push' }}
needs: docker-configure
uses: ./.github/workflows/docker-image.yaml
secrets: inherit
permissions:
contents: read
id-token: write
with:
release: ${{ needs.docker-configure.outputs.release }}
commit: ${{ needs.docker-configure.outputs.commit }}
build_date: ${{ needs.docker-configure.outputs.build_date }}
sign: true
provenance-for-images-docker:
if: ${{ github.event_name == 'push' }}
needs: [docker-configure, docker-image]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: docker.io/falcosecurity/falcoctl
# The image digest is used to prevent TOCTOU issues.
# This is an output of the docker/build-push-action
# See: https://github.com/slsa-framework/slsa-verifier#toctou-attacks
digest: ${{ needs.docker-image.outputs.digest }}
secrets:
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_SECRET }}
login-to-amazon-ecr:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
role-to-assume: arn:aws:iam::292999226676:role/github_actions-falcoctl-ecr
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public
mask-password: 'false'
outputs:
registry: ${{ steps.login-ecr-public.outputs.registry }}
docker_username: ${{ steps.login-ecr-public.outputs.docker_username_public_ecr_aws }}
docker_password: ${{ steps.login-ecr-public.outputs.docker_password_public_ecr_aws }}
provenance-for-images-aws-ecr:
if: ${{ github.event_name == 'push' }}
needs: [docker-configure, docker-image, login-to-amazon-ecr]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: public.ecr.aws/falcosecurity/falcoctl
# The image digest is used to prevent TOCTOU issues.
# This is an output of the docker/build-push-action
# See: https://github.com/slsa-framework/slsa-verifier#toctou-attacks
digest: ${{ needs.docker-image.outputs.digest }}
secrets:
registry-username: ${{ needs.login-to-amazon-ecr.outputs.docker_username }}
registry-password: ${{ needs.login-to-amazon-ecr.outputs.docker_password }}
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
check-latest: true
- name: Run tests
run: go test -cover ./...

64
.github/workflows/lint.yaml vendored Normal file
View File

@ -0,0 +1,64 @@
name: Linting
on:
pull_request:
jobs:
golangci:
name: Lint golang files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: "^1.24.3"
go-version-file: "go.mod"
check-latest: true
cache: "false"
- name: golangci-lint
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
with:
only-new-issues: true
version: v1.64.7
args: --timeout=900s
gomodtidy:
name: Enforce go.mod tidiness
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: "${{ github.event.pull_request.head.sha }}"
repository: ${{github.event.pull_request.head.repo.full_name}}
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: "go.mod"
check-latest: true
- name: Execute go mod tidy and check the outcome
working-directory: ./
run: |
go mod tidy
exit_code=$(git diff --exit-code)
exit ${exit_code}
- name: Print a comment in case of failure
run: |
echo "The go.mod and/or go.sum files appear not to be correctly tidied.
Please, rerun go mod tidy to fix the issues."
exit 1
if: |
failure() && github.event.pull_request.head.repo.full_name == github.repository

178
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,178 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-22.04
permissions:
contents: write # To add assets to a release.
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
check-latest: true
- name: Run GoReleaser
id: run-goreleaser
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate subject
id: hash
env:
ARTIFACTS: "${{ steps.run-goreleaser.outputs.artifacts }}"
run: |
set -euo pipefail
checksum_file=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Checksum") | .path')
echo "hashes=$(cat $checksum_file | base64 -w0)" >> "$GITHUB_OUTPUT"
provenance-for-binaries:
needs: [goreleaser]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
with:
base64-subjects: "${{ needs.goreleaser.outputs.hashes }}"
upload-assets: true # upload to a new release
verification:
needs: [goreleaser, provenance-for-binaries]
runs-on: ubuntu-latest
permissions: read-all
steps:
- name: Install the verifier
uses: slsa-framework/slsa-verifier/actions/installer@v2.7.1
- name: Download assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROVENANCE: "${{ needs.provenance-for-binaries.outputs.provenance-name }}"
run: |
set -euo pipefail
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "*.tar.gz"
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "*.zip"
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "$PROVENANCE"
- name: Verify assets
env:
CHECKSUMS: ${{ needs.goreleaser.outputs.hashes }}
PROVENANCE: "${{ needs.provenance-for-binaries.outputs.provenance-name }}"
run: |
set -euo pipefail
checksums=$(echo "$CHECKSUMS" | base64 -d)
while read -r line; do
fn=$(echo $line | cut -d ' ' -f2)
echo "Verifying $fn"
slsa-verifier verify-artifact --provenance-path "$PROVENANCE" \
--source-uri "github.com/$GITHUB_REPOSITORY" \
--source-tag "$GITHUB_REF_NAME" \
"$fn"
done <<<"$checksums"
docker-configure:
runs-on: ubuntu-22.04
outputs:
release: ${{ steps.vars.outputs.release }}
commit: ${{ steps.vars.outputs.commit }}
build_date: ${{ steps.vars.outputs.build_date }}
steps:
- name: Set version fields
id: vars
run: |
echo "release=$(echo $GITHUB_REF | cut -d / -f 3 | sed 's/^v//')" >> $GITHUB_OUTPUT
echo "commit=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
docker-image:
needs: docker-configure
uses: ./.github/workflows/docker-image.yaml
secrets: inherit
permissions:
contents: read
packages: write
id-token: write # needed for signing the images with GitHub OIDC Token
with:
release: ${{ needs.docker-configure.outputs.release }}
commit: ${{ needs.docker-configure.outputs.commit }}
build_date: ${{ needs.docker-configure.outputs.build_date }}
sign: true
provenance-for-images-docker:
needs: [docker-configure, docker-image]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: docker.io/falcosecurity/falcoctl
# The image digest is used to prevent TOCTOU issues.
# This is an output of the docker/build-push-action
# See: https://github.com/slsa-framework/slsa-verifier#toctou-attacks
digest: ${{ needs.docker-image.outputs.digest }}
secrets:
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_SECRET }}
login-to-amazon-ecr:
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
role-to-assume: arn:aws:iam::292999226676:role/github_actions-falcoctl-ecr
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public
mask-password: 'false'
outputs:
registry: ${{ steps.login-ecr-public.outputs.registry }}
docker_username: ${{ steps.login-ecr-public.outputs.docker_username_public_ecr_aws }}
docker_password: ${{ steps.login-ecr-public.outputs.docker_password_public_ecr_aws }}
provenance-for-images-aws-ecr:
needs: [docker-configure, docker-image, login-to-amazon-ecr]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: public.ecr.aws/falcosecurity/falcoctl
# The image digest is used to prevent TOCTOU issues.
# This is an output of the docker/build-push-action
# See: https://github.com/slsa-framework/slsa-verifier#toctou-attacks
digest: ${{ needs.docker-image.outputs.digest }}
secrets:
registry-username: ${{ needs.login-to-amazon-ecr.outputs.docker_username }}
registry-password: ${{ needs.login-to-amazon-ecr.outputs.docker_password }}

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
*.idea
*.idea*
.idea/*
.vscode/*
falcoctl
dist/

139
.golangci.yml Normal file
View File

@ -0,0 +1,139 @@
run:
timeout: 10m
linters-settings:
exhaustive:
check-generated: false
default-signifies-exhaustive: true
goheader:
values:
const:
AUTHORS: The Falco Authors
template: |-
SPDX-License-Identifier: Apache-2.0
Copyright (C) {{ YEAR }} {{ AUTHORS }}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
lll:
line-length: 150
gci:
sections:
- standard # Captures all standard packages if they do not match another section.
- default # Contains all imports that could not be matched to another section type.
- prefix(github.com/falcosecurity/falcoctl) # Groups all imports with the specified Prefix.
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
goimports:
local-prefixes: github.com/falcosecurity/falcoctl
misspell:
locale: US
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
dupl:
threshold: 300
linters:
disable-all: true
enable:
- asciicheck
- bodyclose
- dogsled
- dupl
- errcheck
- errorlint
- exhaustive
- copyloopvar
# - funlen
# - gochecknoglobals
# - gochecknoinits
# - gocognit
- gci
- goconst
- gocritic
- gocyclo
- godot
# - godox
# - goerr113
- gofmt
- goheader
- goimports
- gomodguard
# - gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
# - maligned
- misspell
- nakedret
# - nestif
- noctx
- nolintlint
# - prealloc
- revive
- rowserrcheck
- staticcheck
- stylecheck
# - testpackage
- typecheck
- unconvert
- unparam
- unused
- whitespace
# - wsl
issues:
#fix: true
max-issues-per-linter: 0
max-same-issues: 0
# Disable the default exclude patterns (as they disable the mandatory comments)
exclude-use-default: false
exclude:
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
exclude-rules:
- linters:
- govet
text: 'declaration of "(err|ctx)" shadows declaration at'
- linters:
- errorlint
# Disable the check to test errors type assertion on switches.
text: type switch on error will fail on wrapped errors. Use errors.As to check for specific errors
# Disable goheader for multi authors files
- linters:
- goheader
path: pkg/oci/authn/credentialstore.go
# Exclude the following linters from running on tests files.
- path: _test\.go
linters:
- gosec

View File

@ -1,21 +1,37 @@
version: 2
project_name: falcoctl
before:
hooks:
- go mod tidy
builds:
- id: "falcoctl"
goos:
- linux
- darwin
- windows
- linux
- darwin
- windows
goarch:
- amd64
- 386
- amd64
- 386
- arm64
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: 386
ldflags: |
-X github.com/falcosecurity/falcoctl/cmd/version.buildDate={{ .Date }}
-X github.com/falcosecurity/falcoctl/cmd/version.gitCommit={{ .Commit }}
-X github.com/falcosecurity/falcoctl/cmd/version.semVersion={{ if .IsSnapshot }}{{ .Commit }}{{ else }}{{ .Version }}{{ end }}
-s
-w
main: .
env:
- GO111MODULE=on
- CGO_ENABLED=0
binary: falcoctl
archives:
- id: windows
format_overrides:
@ -23,8 +39,14 @@ archives:
format: zip
snapshot:
name_template: 'master'
name_template: "{{ .ShortCommit }}"
release:
github:
prerelease: auto
mode: replace
changelog:
use: github-native
git:
tag_sort: -version:creatordate

84
Makefile Normal file
View File

@ -0,0 +1,84 @@
SHELL=/bin/bash -o pipefail
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
GO ?= go
DOCKER ?= docker
# version settings
RELEASE?=$(shell git rev-parse HEAD)
COMMIT?=$(shell git rev-parse HEAD)
BUILD_DATE?=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
PROJECT?=github.com/falcosecurity/falcoctl
# todo(leogr): re-enable race when CLI tests can run with race enabled
TEST_FLAGS ?= -v -cover# -race
.PHONY: falcoctl
falcoctl:
$(GO) build -ldflags \
"-X '${PROJECT}/cmd/version.semVersion=${RELEASE}' \
-X '${PROJECT}/cmd/version.gitCommit=${COMMIT}' \
-X '${PROJECT}/cmd/version.buildDate=${BUILD_DATE}'" \
-o falcoctl .
.PHONY: test
test:
$(GO) vet ./...
$(GO) test ${TEST_FLAGS} ./...
# Install gci if not available
.PHONY: gci
gci:
ifeq (, $(shell which gci))
@go install github.com/daixiang0/gci@v0.11.1
GCI=$(GOBIN)/gci
else
GCI=$(shell which gci)
endif
# Install addlicense if not available
.PHONY: addlicense
addlicense:
ifeq (, $(shell which addlicense))
@go install github.com/google/addlicense@v1.0.0
ADDLICENSE=$(GOBIN)/addlicense
else
ADDLICENSE=$(shell which addlicense)
endif
# Run go fmt against code and add the licence header
.PHONY: fmt
fmt: gci addlicense
go mod tidy
go fmt ./...
find . -type f -name '*.go' -a -exec $(GCI) write -s standard -s default -s "prefix(github.com/falcosecurity/falcoctl)" {} \;
find . -type f -name '*.go' -exec $(ADDLICENSE) -l apache -s -c "The Falco Authors" -y "$(shell date +%Y)" {} \;
# Install golangci-lint if not available
.PHONY: golangci-lint
golangci-lint:
ifeq (, $(shell which golangci-lint))
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
GOLANGCILINT=$(GOBIN)/golangci-lint
else
GOLANGCILINT=$(shell which golangci-lint)
endif
# It works when called in a branch different than main.
# "--new-from-rev REV Show only new issues created after git revision REV"
.PHONY: lint
lint: golangci-lint
$(GOLANGCILINT) run --new-from-rev main
.PHONY: docker
docker:
$(DOCKER) build -f ./build/Dockerfile . --build-arg RELEASE=${RELEASE} --build-arg COMMIT=${COMMIT} --build-arg BUILD_DATE=${BUILD_DATE}
.PHONY: clean
clean:
@rm falcoctl || true

17
OWNERS
View File

@ -1,15 +1,14 @@
approvers:
- leogr
- zuc
- maxgio92
- fededp
- cpanato
- alacuku
- loresuso
emeritus_approvers:
- kris-nova
- rajibmitra
- markyjackson-taulia
- leodido
- fntlnz
- mstemm
reviewers:
- kris-nova
- fntlnz
- leodido
- mfdii
- rajibmitra
- markyjackson-taulia
- mstemm

404
README.md
View File

@ -0,0 +1,404 @@
# 🧰 falcoctl
[![Falco Core Repository](https://github.com/falcosecurity/evolution/blob/main/repos/badges/falco-core-blue.svg)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#core-scope) [![Stable](https://img.shields.io/badge/status-stable-brightgreen?style=for-the-badge)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#stable) [![License](https://img.shields.io/github/license/falcosecurity/falcoctl?style=for-the-badge)](./LICENSE)
The official CLI tool for working with [Falco](https://github.com/falcosecurity/falco) and its [ecosystem components](https://falco.org/docs/#what-are-the-ecosystem-projects-that-can-interact-with-falco).
## Installation
### Install falcoctl manually
You can download and install *falcoctl* manually following the appropriate instructions based on your operating system architecture.
#### Linux
##### AMD64
```bash
LATEST=$(curl -sI https://github.com/falcosecurity/falcoctl/releases/latest | awk '/location: /{gsub("\r","",$2);split($2,v,"/");print substr(v[8],2)}')
curl --fail -LS "https://github.com/falcosecurity/falcoctl/releases/download/v${LATEST}/falcoctl_${LATEST}_linux_amd64.tar.gz" | tar -xz
sudo install -o root -g root -m 0755 falcoctl /usr/local/bin/falcoctl
```
##### ARM64
```bash
LATEST=$(curl -sI https://github.com/falcosecurity/falcoctl/releases/latest | awk '/location: /{gsub("\r","",$2);split($2,v,"/");print substr(v[8],2)}')
curl --fail -LS "https://github.com/falcosecurity/falcoctl/releases/download/v${LATEST}/falcoctl_${LATEST}_linux_arm64.tar.gz" | tar -xz
sudo install -o root -g root -m 0755 falcoctl /usr/local/bin/falcoctl
```
> NOTE: Make sure */usr/local/bin* is in your PATH environment variable.
#### MacOS
The easiest way to install on MacOS is via `Homebrew`:
```bash
brew install falcoctl
```
Alternatively, you can download directly from the source:
##### Intel
```bash
LATEST=$(curl -sI https://github.com/falcosecurity/falcoctl/releases/latest | awk '/location: /{gsub("\r","",$2);split($2,v,"/");print substr(v[8],2)}')
curl --fail -LS "https://github.com/falcosecurity/falcoctl/releases/download/v${LATEST}/falcoctl_${LATEST}_darwin_amd64.tar.gz" | tar -xz
chmod +x falcoctl
sudo mv falcoctl /usr/local/bin/falcoctl
```
##### Apple Silicon
```bash
LATEST=$(curl -sI https://github.com/falcosecurity/falcoctl/releases/latest | awk '/location: /{gsub("\r","",$2);split($2,v,"/");print substr(v[8],2)}')
curl --fail -LS "https://github.com/falcosecurity/falcoctl/releases/download/v${LATEST}/falcoctl_${LATEST}_darwin_arm64.tar.gz" | tar -xz
chmod +x falcoctl
sudo mv falcoctl /usr/local/bin/falcoctl
```
Alternatively, you can manually download *falcoctl* from the [falcoctl releases](https://github.com/falcosecurity/falcoctl/releases) page on GitHub.
### Install falcoctl from source
You can install *falcoctl* from source. First thing clone the *falcoctl* repository, build the *falcoctl* binary, and move it to a file location in your system **PATH**.
```bash
git clone https://github.com/falcosecurity/falcoctl.git
cd falcoctl
make falcoctl
sudo mv falcoctl /usr/local/bin/falcoctl
```
# Getting Started
## Installing an artifact
This tutorial aims at presenting how to install a Falco artifact. The next few steps will present us with the fundamental commands of *falcoctl* and how to use them.
First thing, we need to add a new `index` to *falcoctl*:
```bash
$ falcoctl index add falcosecurity https://falcosecurity.github.io/falcoctl/index.yaml
```
We just downloaded the metadata of the **artifacts** hosted and distributed by the **falcosecurity** organization and made them available to the *falcoctl* tool.
Now let's check that the `index` file is in place by running:
```
$ falcoctl index list
```
We should get an output similar to this one:
```
NAME URL ADDED UPDATED
falcosecurity https://falcosecurity.github.io/falcoctl/index.yaml 2022-10-25 15:01:25 2022-10-25 15:01:25
```
Now let's search all the artifacts related to *cloudtrail*:
```
$ falcoctl artifact search cloudtrail
INDEX ARTIFACT TYPE REGISTRY REPOSITORY
falcosecurity cloudtrail plugin ghcr.io falcosecurity/plugins/plugin/cloudtrail
falcosecurity cloudtrail-rules rulesfile ghcr.io falcosecurity/plugins/ruleset/cloudtrail
```
Lets install the *cloudtrail plugin*:
```
$ falcoctl artifact install cloudtrail --plugins-dir=./
INFO Reading all configured index files from "/home/aldo/.config/falcoctl/indexes.yaml"
INFO Preparing to pull "ghcr.io/falcosecurity/plugins/plugin/cloudtrail:latest"
INFO Remote registry "ghcr.io" implements docker registry API V2
INFO Pulling 44136fa355b3: ############################################# 100%
INFO Pulling 80e0c33f30c0: ############################################# 100%
INFO Pulling b024dd7a2a63: ############################################# 100%
INFO Artifact successfully installed in "./"
```
Install the *cloudtrail-rules* rulesfile:
```
$ ./falcoctl artifact install cloudtrail-rules --rulesfiles-dir=./
INFO Reading all configured index files from "/home/aldo/.config/falcoctl/indexes.yaml"
INFO Preparing to pull "ghcr.io/falcosecurity/plugins/ruleset/cloudtrail:latest"
INFO Remote registry "ghcr.io" implements docker registry API V2
INFO Pulling 44136fa355b3: ############################################# 100%
INFO Pulling e0dccb7b0f1d: ############################################# 100%
INFO Pulling 575bced78731: ############################################# 100%
INFO Artifact successfully installed in "./"
```
We should have now two new files in the current directory: `aws_cloudtrail_rules.yaml` and `libcloudtrail.so`.
# Falcoctl Configuration Files
## `/etc/falcoctl/falcoctl.yaml`
The `falco configuration file` is a yaml file that contains some metadata about the `falcoctl` behaviour.
It contains the list of the indexes where the artifacts are listed, how often and which artifacts needed to be updated periodically.
The default configuration is stored in `/etc/falcoctl/falcoctl.yaml`.
This is an example of a falcoctl configuration file:
``` yaml
artifact:
follow:
every: 6h0m0s
falcoVersions: http://localhost:8765/versions
refs:
- falco-rules:0
- my-rules:1
install:
refs:
- cloudtrail-rules:latest
- cloudtrail:latest
rulesfilesdir: /tmp/rules
pluginsdir: /tmp/plugins
indexes:
- name: falcosecurity
url: https://falcosecurity.github.io/falcoctl/index.yaml
- name: my-index
url: https://example.com/falcoctl/index.yaml
registry:
auth:
basic:
- password: password
registry: myregistry.example.com:5000
user: user
oauth:
- registry: myregistry.example.com:5001
clientsecret: "999999"
clientid: "000000"
tokenurl: http://myregistry.example.com:9096/token
gcp:
- registry: europe-docker.pkg.dev
```
## `~/.config/falcoctl/`
The `~/.config/falcoctl/` directory contains:
- *cache objects*
- *OAuth2 client credentials*
### `~/.config/falcoctl/indexes.yaml`
This file is used for cache purposes and contains the *index refs* added by the command `falcoctl index add [name] [ref]`. The *index ref* is enriched with two timestamps to track when it was added and the last time is was updated. Once the *index ref* is added, `falcoctl` will download the real index in the `~/.config/falcoctl/indexes/` directory. Moreover, every time the index is fetched, the `updated_timestamp` is updated.
### `~/.config/falcoctl/clientcredentials.json`
The command `falcoctl registry auth oauth` will add the `clientcredentials.json` file to the `~/.config/falcoctl/` directory. That file will contain all the needed information for the OAuth2 authetication.
# Falcoctl Commands
## Falcoctl index
The `index` file is a yaml file that contains some metadata about the Falco **artifacts**. Each entry carries information such as the name, type, registry, repository and other info for the given **artifact**. Different *falcoctl* commands rely on the metadata contained in the `index` file for their operation.
This is an example of an index file:
```yaml
- name: okta
type: plugin
registry: ghcr.io
repository: falcosecurity/plugins/plugin/okta
description: Okta Log Events
home: https://github.com/falcosecurity/plugins/tree/master/plugins/okta
keywords:
- audit
- log-events
- okta
license: Apache-2.0
maintainers:
- email: cncf-falco-dev@lists.cncf.io
name: The Falco Authors
sources:
- https://github.com/falcosecurity/plugins/tree/master/plugins/okta
- name: okta-rules
type: rulesfile
registry: ghcr.io
repository: falcosecurity/plugins/ruleset/okta
description: Okta Log Events
home: https://github.com/falcosecurity/plugins/tree/master/plugins/okta
keywords:
- audit
- log-events
- okta
- okta-rules
license: Apache-2.0
maintainers:
- email: cncf-falco-dev@lists.cncf.io
name: The Falco Authors
sources:
- https://github.com/falcosecurity/plugins/tree/master/plugins/okta/rules
```
### Index Storage Backends
Indices for *falcoctl* can be retrieved from various storage backends. The supported index storage backends are listed in the table below. Note if you do not specify a backend type when adding a new index *falcoctl* will try to guess based on the `URI Scheme`:
| Name | URI Scheme | Description |
| ----- | ---------- | --------------------------------------------------------------------------------------------- |
| http | http:// | Can be used to retrieve indices via simple HTTP GET requests. |
| https | https:// | Convenience alias for the HTTP backend. |
| gcs | gs:// | For indices stored as Google Cloud Storage objects. Supports application default credentials. |
| file | file:// | For indices stored on the local file system. |
| s3 | s3:// | For indices stored as AWS S3 objects. Supports default credentials, IRSA. |
#### falcoctl index add
New indexes are configured to be used by the *falcoctl* tool by adding them through the `index add` command. There are no limits to the number of indexes that can be added to the *falcoctl* tool. When adding a new index the tool adds a new entry in a file called **indexes.yaml** and downloads the *index* file in `~/.config/falcoctl`. The same folder is used to store the **indexes.yaml** file, too.
The following command adds a new index named *falcosecurity*:
```bash
$ falcoctl index add falcosecurity https://falcosecurity.github.io/falcoctl/index.yaml
```
The following command adds the same index *falcosecurity*, but explicitly sets the storage backend to `https`:
```bash
$ falcoctl index add falcosecurity https://falcosecurity.github.io/falcoctl/index.yaml https
```
#### falcoctl index list
Using the `index list` command you can check the configured `indexes` in your local system:
```bash
$ falcoctl index list
NAME URL ADDED UPDATED
$ falcosecurity https://falcosecurity.github.io/falcoctl/index.yaml 2022-10-25 15:01:25 2022-10-25 15:01:25
```
#### falcoctl index update
The `index update` allows to update a previously configured `index` file by syncing the local one with the remote one:
```bash
$ falcoctl index update falcosecurity
```
#### falcoctl index remove
When we want to remove an `index` file that we configured previously, the `index remove` command is the one we need:
```bash
$ falcoctl index remove falcosecurity
```
The above command will remove the **falcosecurity** index from the local system.
## Falcoctl artifact
The *falcoctl* tool provides different commands to interact with Falco **artifacts**. It makes easy to *seach*, *install* and get *info* for the **artifacts** provided by a given `index` file. For these commands to properly work we need to configure at least an `index` file in our system as shown in the previus section.
#### Falcoctl artifact search
The `artifact search` command allows to search for **artifacts** provided by the `index` files configured in *falcoctl*. The command supports searches by name or by keywords and displays all the **artifacts** that match the search. Assuming that we have already configured the `index` provided by the `falcosecurity` organization, the following command shows all the **artifacts** that work with **Kubernetes**:
```bash
$ falcoctl artifact search kubernetes
INDEX ARTIFACT TYPE REGISTRY REPOSITORY
falcosecurity k8saudit plugin ghcr.io falcosecurity/plugins/plugin/k8saudit
falcosecurity k8saudit-rules rulesfile ghcr.io falcosecurity/plugins/ruleset/k8saudit
```
#### Falcoctl artifact info
As per the name, `artifact info` prints some info for a given **artifact**:
```bash
$ falcoctl artifact info k8saudit
REF TAGS
ghcr.io/falcosecurity/plugins/plugin/k8saudit 0.1.0 0.2.0 0.2.1 0.3.0 0.4.0-rc1 0.4.0 latest
```
It shows the OCI **reference** and **tags** for the **artifact** of interest. Thot info is usually used with other commands.
#### Falcoctl artifact install
The above commands help us to find all the necessary info for a given **artifact**. The `artifact install` command installs an **artifact**. It pulls the **artifact** from remote repository, and saves it in a given directory. The following command installs the *k8saudit* plugin in the default path:
```bash
$ falcoctl artifact install k8saudit
INFO Reading all configured index files from "/home/aldo/.config/falcoctl/indexes.yaml"
INFO Preparing to pull "ghcr.io/falcosecurity/plugins/plugin/k8saudit:latest"
INFO Remote registry "ghcr.io" implements docker registry API V2
INFO Pulling 44136fa355b3: ############################################# 100%
INFO Pulling ded0b5419f40: ############################################# 100%
INFO Pulling 107d1230f3f0: ############################################# 100%
INFO Artifact successfully installed in "/usr/share/falco/plugins"
```
By default, if we give the name of an **artifact** it will search for the **artifact** in the configured `index` files and downlaod the `latest` version. The commands accepts also the OCI **reference** of an **artifact**. In this case, it will ignore the local `index` files.
The command has two flags:
* `--plugins-dir`: directory where to install plugins. Defaults to `/usr/share/falco/plugins`;
* `--rulesfiles-dir`: directory where to install rules. Defaults to `/etc/falco`.
> If the repositories of the **artifacts** your are trying to install are not public then you need to authenticate to the remote registry.
#### Falcoctl artifact follow
The above commands allow us to keep up-to-date one or more given **artifacts**. The `artifact follow` command checks for updates on a periodic basis and then downloads and installs the latest version, as specified by the passed tags.
It pulls the **artifact** from remote repository, and saves it in a given directory. The following command installs the *github-rules* rulesfile in the default path:
```bash
$ falcoctl artifact follow github-rules
WARN falcosecurity already exists with the same configuration, skipping
INFO Reading all configured index files from "/root/.config/falcoctl/indexes.yaml"
INFO: Creating follower for "github-rules", with check every 6h0m0s
INFO Starting follower for "ghcr.io/falcosecurity/plugins/ruleset/github:latest"
INFO (ghcr.io/falcosecurity/plugins/ruleset/github:latest) found new version under tag "latest"
INFO (ghcr.io/falcosecurity/plugins/ruleset/github:latest) artifact with tag "latest" correctly installed
```
By default, if we give the name of an **artifact** it will search for the **artifact** in the configured `index` files and downlaod the `latest` version. The commands accepts also the OCI **reference** of an **artifact**. In this case, it will ignore the local `index` files.
The command can specify the directory where to install the *rulesfile* artifacts through the `--rulesfiles-dir` flag (defaults to `/etc/falco`).
> If the repositories of the **artifacts** your are trying to install are not public then you need to authenticate to the remote registry.
> Please note that only **rulesfile** artifact can be followed.
## Falcoctl registry
The `registry` commands interact with OCI registries allowing the user to authenticate, pull and push artifacts. We have tested the *falcoctl* tool with the **ghcr.io** registry, but it should work with all the registries that support the OCI artifacts.
### Falcoctl registry auth
The `registry auth` command authenticates a user to a given OCI registry.
#### Falcoctl registry auth basic
The `registry auth basic` command authenticates a user to a given OCI registry using HTTP Basic Authentication. Run the command in advance for any private registries.
#### Falcoctl registry auth oauth
The `registry auth oauth` command retrieves access and refresh tokens for OAuth2.0 client credentials flow authentication. Run the command in advance for any private registries.
#### Falcoctl registry auth gcp
The `registry auth gcp` command retrieves access tokens using [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials). In particular, it supports access token retrieval using Google Compute Engine metadata server and Workload Identity, useful to authenticate your deployed Falco workloads. Run the command in advance for Artifact Registry authentication.
Two typical use cases:
1. You are manipulating some rules or plugins and use `falcoctl` to pull or push to an Artifact Registry:
1. run `gcloud auth application-default login` to generate a JSON credential file that will be used by applications.
2. run `falcoctl registry auth gcp europe-docker.pkg.dev` for instance to use Application Default Credentials to connect to any repository hosted at `europe-docker.pkg.dev`.
2. You have a Falco instance with Falcoctl as a side car, running in a GKE cluster with Workload Identity enabled:
1. Workload Identity is correctly set up for the Falco instance (see the [documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)).
2. Add an environment variable like `FALCOCTL_REGISTRY_AUTH_GCP=europe-docker.pkg.dev` to enable GCP authentication for the `europe-docker.pkg.dev` registry.
3. The Falcoctl instance will get access tokens from the metadata server and use them to authenticate to the registry and download your rules.
### Falcoctl registry push
It pushes local files and references the artifact uniquely. The following command shows how to push a local file to a remote registry:
```bash
$ falcoctl registry push --type=plugin ghcr.io/falcosecurity/plugins/plugin/cloudtrail:0.3.0 clouddrail-0.3.0-linux-x86_64.tar.gz --platform linux/amd64
```
The type denotes the **artifact** type in this case *plugins*. The `ghcr.io/falcosecurity/plugins/plugin/cloudtrail:0.3.0` is the unique reference that points to the **artifact**.
Currently, *falcoctl* supports only two types of artifacts: **plugin** and **rulesfile**. Based on **artifact type** the commands accepts different flags:
* `--add-floating-tags`: add the floating tags for the major and minor versions
* `--annotation-source`: set annotation source for the artifact;
* `--depends-on`: set an artifact dependency (can be specified multiple times). Example: `--depends-on my-plugin:1.2.3`
* `--tag`: additional artifact tag. Can be repeated multiple time
* `--type`: type of artifact to be pushed. Allowed values: `rulesfile`, `plugin`, `asset`
### Falcoctl registry pull
Pulling **artifacts** involves specifying the reference. The type of **artifact** is not required since the tool will implicitly extract it from the OCI **artifact**:
```
$ falcoctl registry pull ghcr.io/falcosecurity/plugins/plugin/cloudtrail:0.3.0
```
# Falcoctl Environment Variables
The arguments of `falcoctl` can passed as arguments through:
- command line options
- environment variables
- configuration file
The `falcoctl` arguments can be passed through these different modalities are prioritized in the following order: command line options, environment variables, and finally the configuration file. This means that if an argument is passed through multiple modalities, the value set in the command line options will take precedence over the value set in environment variables, which will in turn take precedence over the value set in the configuration file.
This is the list of the environment variable that `falcoctl` will use:
| Name | Content |
| ----------------------------------------- | ---------------------------------------------------------------- |
| `FALCOCTL_REGISTRY_AUTH_BASIC` | `registry,username,password;registry1,username1,password1` |
| `FALCOCTL_REGISTRY_AUTH_OAUTH` | `registry,client-id,client-secret,token-url;registry1` |
| `FALCOCTL_REGISTRY_AUTH_GCP` | `registry;registry1` |
| `FALCOCTL_INDEXES` | `index-name,https://falcosecurity.github.io/falcoctl/index.yaml` |
| `FALCOCTL_ARTIFACT_FOLLOW_EVERY` | `6h0m0s` |
| `FALCOCTL_ARTIFACT_FOLLOW_CRON` | `cron-formatted-string` |
| `FALCOCTL_ARTIFACT_FOLLOW_REFS` | `ref1;ref2` |
| `FALCOCTL_ARTIFACT_FOLLOW_FALCOVERSIONS` | `falco-version-url` |
| `FALCOCTL_ARTIFACT_FOLLOW_RULESFILEDIR` | `rules-directory-path` |
| `FALCOCTL_ARTIFACT_FOLLOW_PLUGINSDIR` | `plugins-directory-path` |
| `FALCOCTL_ARTIFACT_FOLLOW_TMPDIR` | `tmp-directory-path` |
| `FALCOCTL_ARTIFACT_INSTALL_REFS` | `ref1;ref2` |
| `FALCOCTL_ARTIFACT_INSTALL_RULESFILESDIR` | `rules-directory-path` |
| `FALCOCTL_ARTIFACT_INSTALL_PLUGINSDIR` | `plugins-directory-path` |
| `FALCOCTL_ARTIFACT_NOVERIFY` | |
Please note that when passing multiple arguments via an environment variable, they must be separated by a semicolon. Moreover, multiple fields of the same argument must be separated by a comma.
Here is an example of `falcoctl` usage with environment variables:
```bash
$ export FALCOCTL_REGISTRY_AUTH_OAUTH="localhost:6000,000000,999999,http://localhost:9096/token"
$ falcoctl registry oauth
```
# Container image signature verification
Official container images for Falcoctl, starting from version 0.5.0, are signed with [cosign](https://github.com/sigstore/cosign) v2. To verify the signature run:
```bash
$ FALCOCTL_VERSION=x.y.z # e.g. 0.5.0
$ cosign verify docker.io/falcosecurity/falcoctl:$FALCOCTL_VERSION --certificate-oidc-issuer=https://token.actions.githubusercontent.com --certificate-identity-regexp=https://github.com/falcosecurity/falcoctl/ --certificate-github-workflow-ref=refs/tags/v$FALCOCTL_VERSION
```

36
build/Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM cgr.dev/chainguard/go AS builder
WORKDIR /tmp/builder
ARG RELEASE
ARG COMMIT
ARG BUILD_DATE
ARG PROJECT=github.com/falcosecurity/falcoctl
RUN test -n "$RELEASE" || ( echo "The RELEASE argument is unset. Aborting" && false )
RUN test -n "$COMMIT" || ( echo "The COMMIT argument is unset. Aborting" && false )
RUN test -n "$BUILD_DATE" || ( echo "The BUILD_DATE argument is unset. Aborting" && false )
COPY go.mod ./go.mod
COPY go.sum ./go.sum
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
go build -ldflags \
"-s \
-w \
-X '${PROJECT}/cmd/version.semVersion=${RELEASE}' \
-X '${PROJECT}/cmd/version.gitCommit=${COMMIT}' \
-X '${PROJECT}/cmd/version.buildDate=${BUILD_DATE}'" \
./
RUN echo ${RELEASE}
FROM cgr.dev/chainguard/static:latest
COPY --from=builder /tmp/builder/falcoctl /usr/bin/falcoctl
ENTRYPOINT [ "/usr/bin/falcoctl" ]

78
cmd/artifact/artifact.go Normal file
View File

@ -0,0 +1,78 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package artifact
import (
"context"
"github.com/spf13/cobra"
artifactconfig "github.com/falcosecurity/falcoctl/cmd/artifact/config"
"github.com/falcosecurity/falcoctl/cmd/artifact/follow"
"github.com/falcosecurity/falcoctl/cmd/artifact/info"
"github.com/falcosecurity/falcoctl/cmd/artifact/install"
"github.com/falcosecurity/falcoctl/cmd/artifact/list"
"github.com/falcosecurity/falcoctl/cmd/artifact/manifest"
"github.com/falcosecurity/falcoctl/cmd/artifact/search"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/pkg/index/cache"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
)
// NewArtifactCmd return the artifact command.
func NewArtifactCmd(ctx context.Context, opt *commonoptions.Common) *cobra.Command {
cmd := &cobra.Command{
Use: "artifact",
DisableFlagsInUseLine: true,
Short: "Interact with Falco artifacts",
Long: "Interact with Falco artifacts",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
var indexes []config.Index
var indexCache *cache.Cache
var err error
opt.Initialize()
if err = config.Load(opt.ConfigFile); err != nil {
return err
}
// add indexes if needed
// Set up basic authentication
if indexes, err = config.Indexes(); err != nil {
return err
}
// Create the index cache.
if indexCache, err = cache.NewFromConfig(ctx, config.IndexesFile, config.IndexesDir, indexes); err != nil {
return err
}
// Save the index cache for later use by the sub commands.
opt.Initialize(commonoptions.WithIndexCache(indexCache))
return nil
},
}
cmd.AddCommand(search.NewArtifactSearchCmd(ctx, opt))
cmd.AddCommand(install.NewArtifactInstallCmd(ctx, opt))
cmd.AddCommand(list.NewArtifactListCmd(ctx, opt))
cmd.AddCommand(info.NewArtifactInfoCmd(ctx, opt))
cmd.AddCommand(follow.NewArtifactFollowCmd(ctx, opt))
cmd.AddCommand(artifactconfig.NewArtifactConfigCmd(ctx, opt))
cmd.AddCommand(manifest.NewArtifactManifestCmd(ctx, opt))
return cmd
}

View File

@ -0,0 +1,93 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"context"
"fmt"
"runtime"
"strings"
"github.com/spf13/cobra"
ocipuller "github.com/falcosecurity/falcoctl/pkg/oci/puller"
ociutils "github.com/falcosecurity/falcoctl/pkg/oci/utils"
"github.com/falcosecurity/falcoctl/pkg/options"
)
type artifactConfigOptions struct {
*options.Common
*options.Registry
platform string
}
// NewArtifactConfigCmd returns the artifact config command.
func NewArtifactConfigCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := artifactConfigOptions{
Common: opt,
Registry: &options.Registry{},
}
cmd := &cobra.Command{
Use: "config [ref] [flags]",
Short: "Get the config layer of an artifact",
Long: "Get the config layer of an artifact",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunArtifactConfig(ctx, args)
},
}
o.Registry.AddFlags(cmd)
cmd.Flags().StringVar(&o.platform, "platform", fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
"os and architecture of the artifact in OS/ARCH format")
return cmd
}
func (o *artifactConfigOptions) RunArtifactConfig(ctx context.Context, args []string) error {
var (
puller *ocipuller.Puller
ref string
config []byte
err error
)
// Create puller with auto login enabled.
if puller, err = ociutils.Puller(o.PlainHTTP, o.Printer); err != nil {
return err
}
// Resolve the artifact reference.
if ref, err = o.IndexCache.ResolveReference(args[0]); err != nil {
return err
}
// TODO: implement two new flags (platforms, platform) based on the oci platform struct.
// Split the platform.
tokens := strings.Split(o.platform, "/")
if len(tokens) != 2 {
return fmt.Errorf("invalid platform format: %s", o.platform)
}
if config, err = puller.RawConfigLayer(ctx, ref, tokens[0], tokens[1]); err != nil {
return err
}
o.Printer.DefaultText.Println(string(config))
return nil
}

View File

@ -0,0 +1,142 @@
//SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config_test
import (
"context"
"fmt"
"net/http"
"testing"
"time"
"github.com/distribution/distribution/v3/configuration"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"oras.land/oras-go/v2/registry/remote"
"oras.land/oras-go/v2/registry/remote/auth"
"github.com/falcosecurity/falcoctl/cmd"
"github.com/falcosecurity/falcoctl/pkg/oci"
"github.com/falcosecurity/falcoctl/pkg/oci/authn"
ocipusher "github.com/falcosecurity/falcoctl/pkg/oci/pusher"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
var (
localRegistryHost string
localRegistry *remote.Registry
testRuleTarball = "../../../pkg/test/data/rules.tar.gz"
testPluginTarball = "../../../pkg/test/data/plugin.tar.gz"
testPluginPlatform1 = "linux/amd64"
testPluginPlatform2 = "windows/amd64"
testPluginPlatform3 = "linux/arm64"
ctx = context.Background()
pluginMultiPlatformRef string
rulesRef string
artifactWithoutConfigRef string
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
)
func TestConfig(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Config Suite")
}
var _ = BeforeSuite(func() {
var err error
config := &configuration.Configuration{}
// Get a free port to be used by the registry.
port, err := testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
// Create the registry address to which will bind.
config.HTTP.Addr = fmt.Sprintf("localhost:%d", port)
localRegistryHost = config.HTTP.Addr
// Create the oras registry.
localRegistry, err = testutils.NewOrasRegistry(localRegistryHost, true)
Expect(err).ToNot(HaveOccurred())
// Start the local registry.
go func() {
err := testutils.StartRegistry(context.Background(), config)
Expect(err).ToNot(BeNil())
}()
// Check that the registry is up and accepting connections.
Eventually(func(g Gomega) error {
res, err := http.Get(fmt.Sprintf("http://%s", config.HTTP.Addr))
g.Expect(err).ShouldNot(HaveOccurred())
g.Expect(res.StatusCode).Should(Equal(http.StatusOK))
return err
}).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred())
// Initialize options for command.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Push the artifacts to the registry.
// Same artifacts will be used to test the puller code.
pusher := ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), true, nil)
// Push plugin artifact with multiple architectures.
filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball},
[]string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3})
pluginMultiPlatformRef = localRegistryHost + "/plugins:multiplatform"
artConfig := oci.ArtifactConfig{}
Expect(artConfig.ParseDependencies("my-dep:1.2.3|my-alt-dep:1.4.5")).ToNot(HaveOccurred())
Expect(artConfig.ParseRequirements("my-req:7.8.9")).ToNot(HaveOccurred())
artifactConfig := ocipusher.WithArtifactConfig(artConfig)
// Build options slice.
options := []ocipusher.Option{filePathsAndPlatforms, artifactConfig}
// Push the plugin artifact.
_, err = pusher.Push(ctx, oci.Plugin, pluginMultiPlatformRef, options...)
Expect(err).ShouldNot(HaveOccurred())
// Prepare and push artifact without config layer.
filePaths := ocipusher.WithFilepaths([]string{testRuleTarball})
artConfig = oci.ArtifactConfig{}
Expect(artConfig.ParseDependencies("dep1:1.2.3", "dep2:2.3.1")).ToNot(HaveOccurred())
options = []ocipusher.Option{
filePaths,
ocipusher.WithTags("latest"),
}
// Push artifact without config layer.
// Push artifact without config layer.
artifactWithoutConfigRef = localRegistryHost + "/artifact:noconfig"
_, err = pusher.Push(ctx, oci.Rulesfile, artifactWithoutConfigRef, options...)
Expect(err).ShouldNot(HaveOccurred())
// Push a rulesfile artifact
options = append(options, ocipusher.WithArtifactConfig(artConfig))
rulesRef = localRegistryHost + "/rulesfiles:regular"
_, err = pusher.Push(ctx, oci.Rulesfile, rulesRef, options...)
Expect(err).ShouldNot(HaveOccurred())
})
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,213 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config_test
import (
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
var usage = `Usage:
falcoctl artifact config [ref] [flags]
Flags:
-h, --help help for config
--plain-http allows interacting with remote registry via plain http requests
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
var help = `Get the config layer of an artifact
Usage:
falcoctl artifact config [ref] [flags]
Flags:
-h, --help help for config
--plain-http allows interacting with remote registry via plain http requests
--platform string os and architecture of the artifact in OS/ARCH format (default "linux/amd64")
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
var _ = Describe("Config", func() {
const (
artifactCmd = "artifact"
configCmd = "config"
plaingHTTP = "--plain-http"
configFlag = "--config"
platformFlag = "--platform"
)
var (
err error
args []string
configDir string
)
var assertFailedBehavior = func(usage, specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(usage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
JustBeforeEach(func() {
configDir = GinkgoT().TempDir()
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
err = nil
Expect(output.Clear()).ShouldNot(HaveOccurred())
args = nil
})
Context("help message", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, "--help"}
})
It("should match the saved one", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(string(output.Contents())).Should(Equal(help))
})
})
Context("wrong number of arguments", func() {
When("number of arguments equal to 0", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd}
})
assertFailedBehavior(usage, "ERROR accepts 1 arg(s), received 0 ")
})
When("number of arguments equal to 2", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, "arg1", "arg2", configFlag, configDir}
})
assertFailedBehavior(usage, "ERROR accepts 1 arg(s), received 2 ")
})
})
Context("failure", func() {
When("unreachable/non existing registry", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, "noregistry/noartifact", plaingHTTP, configFlag, configDir}
})
assertFailedBehavior(usage, "ERROR unable to get manifest: unable to fetch reference")
})
When("non existing repository", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, localRegistryHost + "/noartifact", plaingHTTP, configFlag, configDir}
})
assertFailedBehavior(usage, "noartifact:latest: not found")
})
When("non parsable reference", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, " ", plaingHTTP, configFlag, configDir}
})
assertFailedBehavior(usage, "ERROR cannot find among the configured indexes, skipping ")
})
When("no manifest for given platform", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, pluginMultiPlatformRef, plaingHTTP, configFlag, configDir, platformFlag, "linux/wrong"}
})
assertFailedBehavior(usage, "ERROR unable to get manifest: unable to find a manifest matching the given platform: linux/wrong")
})
})
Context("success", func() {
When("empty config layer", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, artifactWithoutConfigRef, plaingHTTP, configFlag, configDir}
})
It("should success", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta("{}")))
})
})
When("with valid config layer", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, rulesRef, plaingHTTP, configFlag, configDir}
})
It("should success", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(`{"dependencies":[{"name":"dep1","version":"1.2.3"},{"name":"dep2","version":"2.3.1"}]}`)))
})
})
When("no platform flag", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, pluginMultiPlatformRef, plaingHTTP, configFlag, configDir}
})
It("should success getting the platform where tests are running", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(
`{"dependencies":[{"name":"my-dep","version":"1.2.3","alternatives":[{"name":"my-alt-dep","version":"`)))
})
})
When("with valid platform", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, pluginMultiPlatformRef, plaingHTTP, configFlag, configDir, platformFlag, testPluginPlatform3}
})
It("should success", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(
`{"dependencies":[{"name":"my-dep","version":"1.2.3","alternatives":[{"name":"my-alt-dep","version":"`)))
})
})
When("with non existing platform for artifacts without platforms", func() {
BeforeEach(func() {
args = []string{artifactCmd, configCmd, rulesRef, plaingHTTP, configFlag, configDir, platformFlag, testPluginPlatform3}
})
It("should success", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(`{"dependencies":[{"name":"dep1","version":"1.2.3"},{"name":"dep2","version":"2.3.1"}]}`)))
})
})
})
})

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package config defines the business logic to fetch config layer for artifacts.
package config

17
cmd/artifact/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package artifact implements the artifact commands.
package artifact

View File

@ -0,0 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package follow defines the business logic to follow artifacts. Periodically checks if there are updates
// and downlods them if any.
package follow

View File

@ -0,0 +1,500 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package follow
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"sync"
"time"
"github.com/robfig/cron/v3"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/falcosecurity/falcoctl/cmd/artifact/install"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/internal/follower"
"github.com/falcosecurity/falcoctl/pkg/index/index"
"github.com/falcosecurity/falcoctl/pkg/oci"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
const (
timeout = time.Second * 5
longFollow = `This command allows you to keep up-to-date one or more given artifacts.
It checks for updates on a periodic basis and then downloads and installs the latest version,
as specified by the passed tags.
Artifact references and flags are passed as arguments through:
- command line options
- environment variables
- configuration file
The arguments passed through these different modalities are prioritized in the following order:
command line options, environment variables, and finally the configuration file. This means that
if an argument is passed through multiple modalities, the value set in the command line options
will take precedence over the value set in environment variables, which will in turn take precedence
over the value set in the configuration file.
Please note that when passing multiple artifact references via an environment variable, they must be
separated by a semicolon ';' and the environment variable used for references is called
FALCOCT_ARTIFACT_FOLLOW_REFS. Other arguments, if passed through environment variables, should start
with "FALCOCTL_" and be followed by the hierarchical keys used in the configuration file separated by
an underscore "_".
A reference is either a simple name or a fully qualified reference ("<registry>/<repository>"),
optionally followed by ":<tag>" (":latest" is assumed by default when no tag is given).
When providing just the name of the artifact, the command will search for the artifacts in
the configured index files, and if found, it will use the registry and repository specified
in the indexes.
Example - Install and follow "latest" tag of "k8saudit-rules" artifact by relying on index metadata:
falcoctl artifact follow k8saudit-rules
Example - Install and follow all updates from "k8saudit-rules" 0.5.x release series:
falcoctl artifact follow k8saudit-rules:0.5
Example - Install and follow "cloudtrail" plugins using a fully qualified reference:
falcoctl artifact follow ghcr.io/falcosecurity/plugins/ruleset/k8saudit:latest
`
)
type artifactFollowOptions struct {
*options.Common
*options.Registry
*options.Directory
tmpDir string
every time.Duration
cron string
falcoVersions string
versions config.FalcoVersions
timeout time.Duration
closeChan chan bool
allowedTypes oci.ArtifactTypeSlice
noVerify bool
}
// NewArtifactFollowCmd returns the artifact follow command.
//
//nolint:gocyclo // unknown reason for cyclomatic complexity
func NewArtifactFollowCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := artifactFollowOptions{
Common: opt,
Registry: &options.Registry{},
Directory: &options.Directory{},
closeChan: make(chan bool),
versions: config.FalcoVersions{},
}
cmd := &cobra.Command{
Use: "follow [ref1 [ref2 ...]] [flags]",
Short: "Install a list of artifacts and continuously checks if there are updates",
Long: longFollow,
PreRunE: func(cmd *cobra.Command, args []string) error {
// Override "every" flag with viper config if not set by user.
f := cmd.Flags().Lookup("every")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag every")
} else if !f.Changed && viper.IsSet(config.ArtifactFollowEveryKey) {
val := viper.Get(config.ArtifactFollowEveryKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite \"every\" flag: %w", err)
}
}
// Override "cron" flag with viper config if not set by user.
f = cmd.Flags().Lookup("cron")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag cron")
} else if !f.Changed && viper.IsSet(config.ArtifactFollowCronKey) {
val := viper.Get(config.ArtifactFollowCronKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite \"cron\" flag: %w", err)
}
}
// Override "falco-versions" flag with viper config if not set by user.
f = cmd.Flags().Lookup("falco-versions")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag falco-versions")
} else if !f.Changed && viper.IsSet(config.ArtifactFollowFalcoVersionsKey) {
val := viper.Get(config.ArtifactFollowFalcoVersionsKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite \"falco-versions\" flag: %w", err)
}
}
// Override "rulesfiles-dir" flag with viper config if not set by user.
f = cmd.Flags().Lookup(options.FlagRulesFilesDir)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", options.FlagRulesFilesDir)
} else if !f.Changed && viper.IsSet(config.ArtifactFollowRulesfilesDirKey) {
val := viper.Get(config.ArtifactFollowRulesfilesDirKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", options.FlagRulesFilesDir, err)
}
}
// Override "plugins-dir" flag with viper config if not set by user.
f = cmd.Flags().Lookup(options.FlagPluginsFilesDir)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", options.FlagPluginsFilesDir)
} else if !f.Changed && viper.IsSet(config.ArtifactFollowPluginsDirKey) {
val := viper.Get(config.ArtifactFollowPluginsDirKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", options.FlagPluginsFilesDir, err)
}
}
// Override "assets-dir" flag with viper config if not set by user.
f = cmd.Flags().Lookup(options.FlagAssetsFilesDir)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", options.FlagAssetsFilesDir)
} else if !f.Changed && viper.IsSet(config.ArtifactFollowAssetsDirKey) {
val := viper.Get(config.ArtifactFollowAssetsDirKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", options.FlagAssetsFilesDir, err)
}
}
// Override "tmp-dir" flag with viper config if not set by user.
f = cmd.Flags().Lookup("tmp-dir")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag tmp-dir")
} else if !f.Changed && viper.IsSet(config.ArtifactFollowTmpDirKey) {
val := viper.Get(config.ArtifactFollowTmpDirKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite \"tmp-dir\" flag: %w", err)
}
}
// Override "allowed-types" flag with viper config if not set by user.
f = cmd.Flags().Lookup(install.FlagAllowedTypes)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %s", install.FlagAllowedTypes)
} else if !f.Changed && viper.IsSet(config.ArtifactAllowedTypesKey) {
val, err := config.ArtifactAllowedTypes()
if err != nil {
return err
}
if err := cmd.Flags().Set(f.Name, val.String()); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", install.FlagAllowedTypes, err)
}
}
// Override "no-verify" flag with viper config if not set by user.
f = cmd.Flags().Lookup(install.FlagNoVerify)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %s", install.FlagNoVerify)
} else if !f.Changed && viper.IsSet(config.ArtifactNoVerifyKey) {
val := viper.Get(config.ArtifactNoVerifyKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", install.FlagNoVerify, err)
}
}
// Get Falco versions via HTTP endpoint
if err := o.retrieveFalcoVersions(ctx); err != nil {
return fmt.Errorf("unable to retrieve Falco versions, please check if it is running "+
"and correctly exposing the version endpoint: %w", err)
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunArtifactFollow(ctx, args)
},
}
o.Registry.AddFlags(cmd)
o.Directory.AddFlags(cmd)
cmd.Flags().DurationVarP(&o.every, "every", "e", config.FollowResync, "Time interval how often it checks for a new version of the "+
"artifact. Cannot be used together with 'cron' option.")
cmd.Flags().StringVar(&o.cron, "cron", "", "Cron-like string to specify interval how often it checks for a new version of the artifact."+
" Cannot be used together with 'every' option.")
cmd.Flags().StringVar(&o.tmpDir, "tmp-dir", "", "Directory where to save temporary files")
cmd.Flags().StringVar(&o.falcoVersions, "falco-versions", "http://localhost:8765/versions",
"Where to retrieve versions, it can be either an URL or a path to a file")
cmd.Flags().DurationVar(&o.timeout, "timeout", defaultBackoffConfig.MaxDelay,
"Timeout for initial connection to the Falco versions endpoint")
cmd.Flags().Var(&o.allowedTypes, install.FlagAllowedTypes,
fmt.Sprintf(`list of artifact types that can be followed. If not specified or configured, all types are allowed.
It accepts comma separated values or it can be repeated multiple times.
Examples:
--%s="rulesfile,plugin"
--%s=rulesfile --%s=plugin`, install.FlagAllowedTypes, install.FlagAllowedTypes, install.FlagAllowedTypes))
cmd.Flags().BoolVar(&o.noVerify, install.FlagNoVerify, false,
"whether this command should skip signature verification")
cmd.MarkFlagsMutuallyExclusive("cron", "every")
return cmd
}
// RunArtifactFollow executes the business logic for the artifact follow command.
func (o *artifactFollowOptions) RunArtifactFollow(ctx context.Context, args []string) error {
logger := o.Printer.Logger
// Retrieve configuration for follower
configuredFollower, err := config.Follower()
if err != nil {
o.Printer.CheckErr(fmt.Errorf("unable to retrieved the configured follower: %w", err))
}
// Set args as configured if no arg was passed
if len(args) == 0 {
if len(configuredFollower.Artifacts) == 0 {
return fmt.Errorf("no artifacts to follow, please configure artifacts or pass them as arguments to this command")
}
args = configuredFollower.Artifacts
}
var sched cron.Schedule
if o.cron != "" {
sched, err = cron.ParseStandard(o.cron)
if err != nil {
return fmt.Errorf("unable to parse cron '%s': %w", o.cron, err)
}
} else {
sched = scheduledDuration{o.every}
}
var wg sync.WaitGroup
// For each artifact create a follower.
var followers = make(map[string]*follower.Follower, 0)
for _, a := range args {
if o.cron != "" {
logger.Info("Creating follower", logger.Args("artifact", a, "cron", o.cron))
} else {
logger.Info("Creating follower", logger.Args("artifact", a, "check every", o.every.String()))
}
ref, err := o.IndexCache.ResolveReference(a)
if err != nil {
return fmt.Errorf("unable to parse artifact reference for %q: %w", a, err)
}
var sig *index.Signature
if !o.noVerify {
sig = o.IndexCache.SignatureForIndexRef(a)
}
cfg := &follower.Config{
WaitGroup: &wg,
Resync: sched,
RulesfilesDir: o.RulesfilesDir,
PluginsDir: o.PluginsDir,
AssetsDir: o.AssetsDir,
ArtifactReference: ref,
PlainHTTP: o.PlainHTTP,
CloseChan: o.closeChan,
TmpDir: o.tmpDir,
FalcoVersions: o.versions,
AllowedTypes: o.allowedTypes,
Signature: sig,
}
fol, err := follower.New(ref, o.Printer, cfg)
if err != nil {
return fmt.Errorf("unable to create the follower for ref %q: %w", ref, err)
}
wg.Add(1)
followers[ref] = fol
}
for k, f := range followers {
logger.Info("Starting follower", logger.Args("artifact", k))
go f.Follow(ctx)
}
// Wait until we receive a signal to be terminated
<-ctx.Done()
// We are done, shutdown the followers.
logger.Info("Closing followers...")
close(o.closeChan)
// Wait for the followers to shutdown or that the timer expires.
doneChan := make(chan bool)
go func() {
wg.Wait()
close(doneChan)
}()
select {
case <-doneChan:
logger.Info("Followers correctly stopped.")
case <-time.After(timeout):
logger.Info("Timed out waiting for followers to exit")
}
return nil
}
func (o *artifactFollowOptions) retrieveFalcoVersions(ctx context.Context) error {
_, err := url.ParseRequestURI(o.falcoVersions)
if err != nil {
return fmt.Errorf("unable to parse URI: %w", err)
}
req, err := http.NewRequestWithContext(ctx, http.MethodGet, o.falcoVersions, http.NoBody)
if err != nil {
return fmt.Errorf("cannot fetch Falco version: %w", err)
}
backoffConfig := defaultBackoffConfig
backoffConfig.MaxDelay = o.timeout
client := &http.Client{
Transport: &backoffTransport{
Base: http.DefaultTransport,
Printer: o.Printer,
Config: backoffConfig,
},
}
resp, err := client.Do(req)
if err != nil {
return fmt.Errorf("unable to get versions from URL %q: %w", o.falcoVersions, err)
}
defer resp.Body.Close()
data, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("unable to read response body: %w", err)
}
var dataUnmarshalled map[string]interface{}
err = json.Unmarshal(data, &dataUnmarshalled)
if err != nil {
return fmt.Errorf("error unmarshalling: %w", err)
}
for key, value := range dataUnmarshalled {
// todo(alacuku): how to handle types other than strings? Silently ignoring for now...
if strValue, ok := value.(string); ok {
o.versions[key] = strValue
}
}
return nil
}
// Config defines the configuration options for backoff.
type backoffConfig struct {
// BaseDelay is the amount of time to backoff after the first failure.
BaseDelay time.Duration
// Multiplier is the factor with which to multiply backoffs after a
// failed retry. Should ideally be greater than 1.
Multiplier float64
// Jitter is the factor with which backoffs are randomized.
// todo: not yet implemented
// Jitter float64
// MaxDelay is the upper bound of backoff delay.
MaxDelay time.Duration
}
var defaultBackoffConfig = backoffConfig{
BaseDelay: 1.0 * time.Second,
Multiplier: 1.6,
// Jitter: 0.2, todo: not yet implemented
MaxDelay: 120 * time.Second,
}
type backoffTransport struct {
Base http.RoundTripper
Printer *output.Printer
Config backoffConfig
attempts int
startTime time.Time
}
func (bt *backoffTransport) RoundTrip(req *http.Request) (*http.Response, error) {
var err error
var resp *http.Response
logger := bt.Printer.Logger
bt.startTime = time.Now()
bt.attempts = 0
logger.Debug(fmt.Sprintf("Retrieving versions from Falco (timeout %s) ...", bt.Config.MaxDelay))
for {
resp, err = bt.Base.RoundTrip(req)
if err != nil {
if req.Context().Err() != nil {
return nil, req.Context().Err()
}
sleep := bt.Config.backoff(bt.attempts)
wakeTime := time.Now().Add(sleep)
if wakeTime.Sub(bt.startTime) > bt.Config.MaxDelay {
return resp, fmt.Errorf("timeout occurred while retrieving versions from Falco")
}
logger.Debug(fmt.Sprintf("error: %s. Trying again in %s", err.Error(), sleep.String()))
time.Sleep(sleep)
} else {
logger.Debug("Successfully retrieved versions from Falco")
return resp, err
}
bt.attempts++
}
}
// Backoff returns the amount of time to wait before the next retry given the
// number of retries.
func (bc backoffConfig) backoff(retries int) time.Duration {
if retries == 0 {
return bc.BaseDelay
}
backoff, max := float64(bc.BaseDelay), float64(bc.MaxDelay)
for backoff < max && retries > 0 {
backoff *= bc.Multiplier
retries--
}
if backoff > max {
backoff = max
}
// Randomize backoff delays so that if a cluster of requests start at
// the same time, they won't operate in lockstep.
// todo: implement jitter
// backoff *= 1 + bc.Jitter*(math.Float64()*2-1)
if backoff < 0 {
return 0
}
return time.Duration(backoff)
}
type scheduledDuration struct {
time.Duration
}
func (sd scheduledDuration) Next(tm time.Time) time.Time {
return tm.Add(sd.Duration)
}

17
cmd/artifact/info/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package info defines the business logic to get information for a given artifact.
package info

123
cmd/artifact/info/info.go Normal file
View File

@ -0,0 +1,123 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package info
import (
"context"
"errors"
"fmt"
"strings"
"github.com/spf13/cobra"
"oras.land/oras-go/v2/registry"
"github.com/falcosecurity/falcoctl/pkg/oci/repository"
ociutils "github.com/falcosecurity/falcoctl/pkg/oci/utils"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
type artifactInfoOptions struct {
*options.Common
*options.Registry
}
// NewArtifactInfoCmd returns the artifact info command.
func NewArtifactInfoCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := artifactInfoOptions{
Common: opt,
Registry: &options.Registry{},
}
cmd := &cobra.Command{
Use: "info [ref1 [ref2 ...]] [flags]",
DisableFlagsInUseLine: true,
Short: "Retrieve all available versions of a given artifact",
Long: "Retrieve all available versions of a given artifact",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunArtifactInfo(ctx, args)
},
}
o.Registry.AddFlags(cmd)
return cmd
}
func (o *artifactInfoOptions) RunArtifactInfo(ctx context.Context, args []string) error {
var data [][]string
logger := o.Printer.Logger
client, err := ociutils.Client(true)
if err != nil {
return err
}
// resolve references
for _, name := range args {
var ref string
parsedRef, err := registry.ParseReference(name)
if err != nil {
entry, ok := o.IndexCache.MergedIndexes.EntryByName(name)
if !ok {
logger.Warn("Cannot find artifact, skipping", logger.Args("name", name))
continue
}
ref = fmt.Sprintf("%s/%s", entry.Registry, entry.Repository)
} else {
parsedRef.Reference = ""
ref = parsedRef.String()
}
repo, err := repository.NewRepository(ref,
repository.WithClient(client),
repository.WithPlainHTTP(o.PlainHTTP))
if err != nil {
return err
}
tags, err := repo.Tags(ctx)
if err != nil && !errors.Is(err, context.Canceled) {
logger.Warn("Cannot retrieve tags from", logger.Args("ref", ref, "reason", err.Error()))
continue
} else if errors.Is(err, context.Canceled) {
// When the context is canceled we exit, since we receive a termination signal.
return err
}
joinedTags := strings.Join(filterOutSigTags(tags), ", ")
data = append(data, []string{ref, joinedTags})
}
// Print the table header + data only if there is data.
if len(data) > 0 {
return o.Printer.PrintTable(output.ArtifactInfo, data)
}
return nil
}
func filterOutSigTags(tags []string) []string {
// Iterate the slice in reverse to avoid index shifting when deleting
for i := len(tags) - 1; i >= 0; i-- {
if strings.HasSuffix(tags[i], ".sig") {
// Remove the element at index i by slicing the slice
tags = append(tags[:i], tags[i+1:]...)
}
}
return tags
}

View File

@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package install
const (
// FlagAllowedTypes is the name of the flag to specify allowed artifact types.
FlagAllowedTypes = "allowed-types"
// FlagPlatform is the name of the flag to override the platform.
FlagPlatform = "platform"
// FlagResolveDeps is the name of the flag to enable artifact dependencies resolution.
FlagResolveDeps = "resolve-deps"
// FlagNoVerify is the name of the flag to disable signature verification.
FlagNoVerify = "no-verify"
)

View File

@ -0,0 +1,201 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package install
import (
"errors"
"fmt"
"github.com/blang/semver"
"github.com/falcosecurity/falcoctl/pkg/oci"
)
type artifactConfigResolver func(ref string) (*oci.RegistryResult, error)
type depsMapType map[string]*depInfo
var (
// ErrCannotSatisfyDependencies is the error returned when we cannot correctly resolve dependencies.
ErrCannotSatisfyDependencies = errors.New("cannot satisfy dependencies")
)
type depInfo struct {
// ref is the remote reference to this artifact
ref string
// config contains the config layer for this artifact
config *oci.ArtifactConfig
// ver represents the semver version of this artifact
ver *semver.Version
// ok is used to mark this dependency as fully processed, with its own
// dependencies and alternatives
ok bool
}
func copyDepsMap(in depsMapType) (out depsMapType) {
out = make(depsMapType, len(in))
for k, v := range in {
out[k] = v
}
return
}
// ResolveDeps resolves dependencies to a list of references.
func ResolveDeps(resolver artifactConfigResolver, inRefs ...string) (outRefs []string, err error) {
depMap := make(depsMapType)
// configMap is used to avoid getting a remote config layer more than once
configMap := make(map[string]*oci.ArtifactConfig)
retrieveConfig := func(ref string) (*oci.ArtifactConfig, error) {
config, ok := configMap[ref]
if !ok {
res, err := resolver(ref)
if err != nil {
return nil, err
}
configMap[ref] = &res.Config
return &res.Config, nil
}
return config, nil
}
upsertMap := func(ref string) error {
// fetch artifact config layer metadata
config, err := retrieveConfig(ref)
if err != nil {
return err
}
if config.Version == "" {
return fmt.Errorf("empty version for ref %q: config may be corrupted", ref)
}
ver, err := semver.Parse(config.Version)
if err != nil {
return fmt.Errorf("unable to parse version %q for ref %q, %w", config.Version, ref, err)
}
depMap[config.Name] = &depInfo{
ref: ref,
config: config,
ver: &ver,
}
return nil
}
// Prepare initial map from user inputs
for _, ref := range inRefs {
config, err := retrieveConfig(ref)
if err != nil {
return nil, err
}
name := config.Name
// todo: shall we shadow?
if info, ok := depMap[name]; ok {
return nil, fmt.Errorf(`cannot provide multiple references for %q: %q, %q`, name, info.ref, ref)
}
if err := upsertMap(ref); err != nil {
return nil, err
}
}
for {
allOk := true
// Since we are updating depMap in this for loop, let's copy the map for iterating it
// while we continue inserting new values in the real depMap map.
for name, info := range copyDepsMap(depMap) {
if info.ok {
continue
}
for _, required := range info.config.Dependencies {
// Does already exist in the map?
if existing, ok := depMap[required.Name]; ok {
requiredVer, err := semver.Parse(required.Version)
if err != nil {
return nil, fmt.Errorf(`invalid artifact config: version %q is not semver compatible`, required.Version)
}
// Is the existing dep compatible?
if existing.ver.Major != requiredVer.Major {
return nil, fmt.Errorf(
`%w: %s depends on %s:%s but an incompatible version %s:%s is required by other artifacts`,
ErrCannotSatisfyDependencies, name, required.Name, required.Version, required.Name, existing.ver.String(),
)
}
// Is required version greater than existing one?
if requiredVer.Compare(*existing.ver) <= 0 {
continue
}
}
// Are alternatives already in the map?
var foundAlternative = false
for _, alternative := range required.Alternatives {
existing, ok := depMap[alternative.Name]
if !ok {
continue
}
foundAlternative = true
alternativeVer, err := semver.Parse(alternative.Version)
if err != nil {
return nil, fmt.Errorf(`invalid artifact config: version %q is not semver compatible`, required.Version)
}
// Is the alternative specified by the user compatible?
if existing.ver.Major != alternativeVer.Major {
return nil, fmt.Errorf(
`%w: %s depends on %s:%s but an incompatible version %s:%s is required by other artifacts`,
ErrCannotSatisfyDependencies, name, required.Name, required.Version, required.Name, existing.ver.String(),
)
}
if alternativeVer.Compare(*existing.ver) > 0 {
if err := upsertMap(alternative.Name + ":" + alternativeVer.String()); err != nil {
return nil, err
}
}
break
}
if foundAlternative {
continue
}
// dep to be added or bumped
if err := upsertMap(required.Name + ":" + required.Version); err != nil {
return nil, err
}
allOk = false
}
// dep processed
info.ok = true
}
if allOk {
for _, info := range depMap {
outRefs = append(outRefs, info.ref)
}
return
}
}
}

View File

@ -0,0 +1,240 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package install
import (
"errors"
"sort"
"strings"
"testing"
"github.com/falcosecurity/falcoctl/pkg/oci"
)
type testCase struct {
scenario string
description string
inRef []string
resolver artifactConfigResolver
expectedOutRef []string
expectedErr error
}
func (t *testCase) checkOutRef(outRef []string) bool {
if len(t.expectedOutRef) != len(outRef) {
return false
}
sort.Strings(outRef)
sort.Strings(t.expectedOutRef)
for i, val := range t.expectedOutRef {
if val != outRef[i] {
return false
}
}
return true
}
func TestResolveDeps(t *testing.T) {
const (
ref1 = "ref1:0.1.2"
ref2 = "ref2:4.5.6"
dep1 = "dep1:1.2.3"
dep1Compatible = "dep1:1.3.0"
alt1 = "alt1:2.5.0"
)
testCases := []testCase{
{
scenario: "resolve one dependency",
description: "ref:0.1.2 --> dep1:1.2.3",
inRef: []string{ref1},
resolver: artifactConfigResolver(func(ref string) (*oci.RegistryResult, error) {
if ref == ref1 {
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: "ref1",
Version: "0.1.2",
Dependencies: []oci.ArtifactDependency{{Name: "dep1", Version: "1.2.3"}},
},
}, nil
}
splittedRef := strings.Split(ref, ":")
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: splittedRef[0],
Version: splittedRef[1],
// no dependencies here
},
}, nil
}),
expectedOutRef: []string{ref1, dep1},
expectedErr: nil,
},
{
scenario: "resolve common compatible dependency",
description: "ref1:0.1.2 --> dep1:1.2.3, ref2:4.5.6 --> dep1:1.3.0",
inRef: []string{ref1, ref2},
resolver: artifactConfigResolver(func(ref string) (*oci.RegistryResult, error) {
switch ref {
case ref1:
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: "ref1",
Version: "0.1.2",
Dependencies: []oci.ArtifactDependency{{Name: "dep1", Version: "1.2.3"}},
},
}, nil
case ref2:
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: "ref2",
Version: "4.5.6",
Dependencies: []oci.ArtifactDependency{{Name: "dep1", Version: "1.3.0"}},
},
}, nil
default:
splittedRef := strings.Split(ref, ":")
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: splittedRef[0],
Version: splittedRef[1],
// no dependencies here
},
}, nil
}
}),
expectedOutRef: []string{ref1, ref2, dep1Compatible},
expectedErr: nil,
},
{
scenario: "resolve common but not compatible dependency",
description: "ref1:0.1.2 --> dep1:1.2.3, ref2:4.5.6 --> dep1:2.3.0",
inRef: []string{ref1, ref2},
resolver: artifactConfigResolver(func(ref string) (*oci.RegistryResult, error) {
switch ref {
case ref1:
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: "ref1",
Version: "0.1.2",
Dependencies: []oci.ArtifactDependency{{Name: "dep1", Version: "1.2.3"}},
},
}, nil
case ref2:
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: "ref2",
Version: "4.5.6",
Dependencies: []oci.ArtifactDependency{{Name: "dep1", Version: "2.3.0"}},
},
}, nil
default:
splittedRef := strings.Split(ref, ":")
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: splittedRef[0],
Version: splittedRef[1],
// no dependencies here
},
}, nil
}
}),
expectedOutRef: nil,
expectedErr: ErrCannotSatisfyDependencies,
},
{
scenario: "resolve compatible alternative",
description: "ref1:0.1.2 --> dep1:1.2.3 | alt1:2.5.0",
inRef: []string{ref1, alt1},
resolver: artifactConfigResolver(func(ref string) (*oci.RegistryResult, error) {
if ref == ref1 {
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: "ref1",
Version: "0.1.2",
Dependencies: []oci.ArtifactDependency{
{
Name: "dep1",
Version: "1.2.3",
Alternatives: []oci.Dependency{{Name: "alt1", Version: "2.3.0"}},
}},
},
}, nil
}
splittedRef := strings.Split(ref, ":")
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: splittedRef[0],
Version: splittedRef[1],
// no dependencies here
},
}, nil
}),
expectedOutRef: []string{ref1, alt1},
expectedErr: ErrCannotSatisfyDependencies,
},
{
scenario: "resolve not compatible alternative",
description: "ref1:0.1.2 --> dep1:1.2.3 | alt1:3.0.0",
inRef: []string{ref1, "alt1:3.0.0"},
resolver: artifactConfigResolver(func(ref string) (*oci.RegistryResult, error) {
if ref == ref1 {
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: "ref1",
Version: "0.1.2",
Dependencies: []oci.ArtifactDependency{
{
Name: "dep1",
Version: "1.2.3",
Alternatives: []oci.Dependency{{Name: "alt1", Version: "2.3.0"}},
}},
},
}, nil
}
splittedRef := strings.Split(ref, ":")
return &oci.RegistryResult{
Config: oci.ArtifactConfig{
Name: splittedRef[0],
Version: splittedRef[1],
// no dependencies here
},
}, nil
}),
expectedOutRef: nil,
expectedErr: ErrCannotSatisfyDependencies,
},
}
for _, testCase := range testCases {
outRef, err := ResolveDeps(testCase.resolver, testCase.inRef...)
if err != nil && !errors.Is(err, testCase.expectedErr) {
t.Fatalf("unexpected error in scenario %q, %q: %v",
testCase.scenario, testCase.description, err)
}
if !testCase.checkOutRef(outRef) {
t.Fatalf("dependencies not correctly resolved in scenario %q, %q:\n got %v, expected %v",
testCase.scenario, testCase.description, outRef, testCase.expectedOutRef)
}
}
}

View File

@ -0,0 +1,18 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package install defines options, and logic used to pull an artifact from a remote repository
// and install it in the local system.
package install

View File

@ -0,0 +1,374 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package install
import (
"context"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/internal/signature"
"github.com/falcosecurity/falcoctl/internal/utils"
"github.com/falcosecurity/falcoctl/pkg/index/index"
"github.com/falcosecurity/falcoctl/pkg/oci"
ociutils "github.com/falcosecurity/falcoctl/pkg/oci/utils"
"github.com/falcosecurity/falcoctl/pkg/options"
)
const (
longInstall = `This command allows you to install one or more given artifacts.
Artifact references and flags are passed as arguments through:
- command line options
- environment variables
- configuration file
The arguments passed through these different modalities are prioritized in the following order:
command line options, environment variables, and finally the configuration file. This means that
if an argument is passed through multiple modalities, the value set in the command line options
will take precedence over the value set in environment variables, which will in turn take precedence
over the value set in the configuration file.
Please note that when passing multiple artifact references via an environment variable, they must be
separated by a semicolon ';'. Other arguments, if passed through environment variables, should start
with "FALCOCTL_" and be followed by the hierarchical keys used in the configuration file separated by
an underscore "_".
A reference is either a simple name or a fully qualified reference ("<registry>/<repository>"),
optionally followed by ":<tag>" (":latest" is assumed by default when no tag is given).
When providing just the name of the artifact, the command will search for the artifacts in
the configured index files, and if found, it will use the registry and repository specified
in the indexes.
Example - Install "latest" tag of "k8saudit-rules" artifact by relying on index metadata:
falcoctl artifact install k8saudit-rules
Example - Install all updates from "k8saudit-rules" 0.5.x release series:
falcoctl artifact install k8saudit-rules:0.5
Example - Install "cloudtrail" plugins using a fully qualified reference:
falcoctl artifact install ghcr.io/falcosecurity/plugins/ruleset/k8saudit:latest
`
)
type artifactInstallOptions struct {
*options.Common
*options.Registry
*options.Directory
allowedTypes oci.ArtifactTypeSlice
platform string // Raw string from command line
platformArch string // Architecture portion of parsed platform string
platformOS string // OS portion of parsed platform string
resolveDeps bool
noVerify bool
}
// NewArtifactInstallCmd returns the artifact install command.
func NewArtifactInstallCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := artifactInstallOptions{
Common: opt,
Registry: &options.Registry{},
Directory: &options.Directory{},
}
cmd := &cobra.Command{
Use: "install [ref1 [ref2 ...]] [flags]",
DisableFlagsInUseLine: true,
Short: "Install a list of artifacts",
Long: longInstall,
PreRunE: func(cmd *cobra.Command, args []string) error {
// Override "rulesfiles-dir" flag with viper config if not set by user.
f := cmd.Flags().Lookup(options.FlagRulesFilesDir)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", options.FlagRulesFilesDir)
} else if !f.Changed && viper.IsSet(config.ArtifactInstallRulesfilesDirKey) {
val := viper.Get(config.ArtifactInstallRulesfilesDirKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", options.FlagRulesFilesDir, err)
}
}
// Override "plugins-dir" flag with viper config if not set by user.
f = cmd.Flags().Lookup(options.FlagPluginsFilesDir)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", options.FlagPluginsFilesDir)
} else if !f.Changed && viper.IsSet(config.ArtifactInstallPluginsDirKey) {
val := viper.Get(config.ArtifactInstallPluginsDirKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", options.FlagPluginsFilesDir, err)
}
}
// Override "assets-dir" flag with viper config if not set by user.
f = cmd.Flags().Lookup(options.FlagAssetsFilesDir)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", options.FlagAssetsFilesDir)
} else if !f.Changed && viper.IsSet(config.ArtifactFollowAssetsDirKey) {
val := viper.Get(config.ArtifactFollowAssetsDirKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", options.FlagAssetsFilesDir, err)
}
}
// Override "allowed-types" flag with viper config if not set by user.
f = cmd.Flags().Lookup(FlagAllowedTypes)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", FlagAllowedTypes)
} else if !f.Changed && viper.IsSet(config.ArtifactAllowedTypesKey) {
val, err := config.ArtifactAllowedTypes()
if err != nil {
return err
}
if err := cmd.Flags().Set(f.Name, val.String()); err != nil {
return fmt.Errorf("unable to overwrite %s flag: %w", FlagAllowedTypes, err)
}
}
f = cmd.Flags().Lookup(FlagResolveDeps)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", FlagResolveDeps)
} else if !f.Changed && viper.IsSet(config.ArtifactInstallResolveDepsKey) {
val := viper.Get(config.ArtifactInstallResolveDepsKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", FlagResolveDeps, err)
}
}
f = cmd.Flags().Lookup(FlagNoVerify)
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag %q", FlagNoVerify)
} else if !f.Changed && viper.IsSet(config.ArtifactNoVerifyKey) {
val := viper.Get(config.ArtifactNoVerifyKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite %q flag: %w", FlagNoVerify, err)
}
}
// Parse "platform" into OS and Arch
if len(o.platform) > 0 {
parts := strings.Split(o.platform, "/")
if len(parts) != 2 {
return fmt.Errorf("invalid %q: must be in the format OS/Arch", FlagPlatform)
}
o.platformOS, o.platformArch = parts[0], parts[1]
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunArtifactInstall(ctx, args)
},
}
o.Registry.AddFlags(cmd)
o.Directory.AddFlags(cmd)
cmd.Flags().Var(&o.allowedTypes, FlagAllowedTypes,
fmt.Sprintf(`list of artifact types that can be installed. If not specified or configured, all types are allowed.
It accepts comma separated values or it can be repeated multiple times.
Examples:
--%s="rulesfile,plugin"
--%s=rulesfile --%s=plugin`, FlagAllowedTypes, FlagAllowedTypes, FlagAllowedTypes))
cmd.Flags().StringVar(&o.platform, "platform", fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
"os and architecture of the artifact in OS/ARCH format")
cmd.Flags().BoolVar(&o.resolveDeps, FlagResolveDeps, true,
"whether this command should resolve dependencies or not")
cmd.Flags().BoolVar(&o.noVerify, FlagNoVerify, false,
"whether this command should skip signature verification")
return cmd
}
// RunArtifactInstall executes the business logic for the artifact install command.
func (o *artifactInstallOptions) RunArtifactInstall(ctx context.Context, args []string) error {
logger := o.Printer.Logger
// Retrieve configuration for installer
configuredInstaller, err := config.Installer()
if err != nil {
return fmt.Errorf("unable to retrieve the configured installer: %w", err)
}
// Set args as configured if no arg was passed
if len(args) == 0 {
if len(configuredInstaller.Artifacts) == 0 {
return fmt.Errorf("no artifacts to install, please configure artifacts or pass them as arguments to this command")
}
args = configuredInstaller.Artifacts
}
// Create temp dir where to put pulled artifacts
tmpDir, err := os.MkdirTemp("", "falcoctl")
if err != nil {
return fmt.Errorf("cannot create temporary directory: %w", err)
}
defer os.RemoveAll(tmpDir)
// Create registry puller with auto login enabled
puller, err := ociutils.Puller(o.PlainHTTP, o.Printer)
if err != nil {
return err
}
// Specify how to pull config layer for each artifact requested by user.
resolver := artifactConfigResolver(func(ref string) (*oci.RegistryResult, error) {
ref, err := o.IndexCache.ResolveReference(ref)
if err != nil {
return nil, err
}
artifactConfig, err := puller.ArtifactConfig(ctx, ref, o.platformOS, o.platformArch)
if err != nil {
return nil, err
}
return &oci.RegistryResult{
Config: *artifactConfig,
}, nil
})
signatures := make(map[string]*index.Signature)
// Compute input to install dependencies
for i, arg := range args {
ref, err := o.IndexCache.ResolveReference(arg)
if err != nil {
return err
}
if sig := o.IndexCache.SignatureForIndexRef(arg); sig != nil {
signatures[ref] = sig
}
args[i] = ref
}
var refs []string
if o.resolveDeps {
// Solve dependencies
logger.Info("Resolving dependencies ...")
refs, err = ResolveDeps(resolver, args...)
if err != nil {
return err
}
} else {
refs = args
}
logger.Info("Installing artifacts", logger.Args("refs", refs))
for _, ref := range refs {
resolvedRef, err := o.IndexCache.ResolveReference(ref)
if err != nil {
return err
}
if signatures[resolvedRef] == nil {
if sig := o.IndexCache.SignatureForIndexRef(ref); sig != nil {
signatures[resolvedRef] = sig
}
}
logger.Info("Preparing to pull artifact", logger.Args("ref", resolvedRef))
if err := puller.CheckAllowedType(ctx, resolvedRef, o.platformOS, o.platformArch, o.allowedTypes.Types); err != nil {
return err
}
// Install will always install artifact for the current OS and architecture
result, err := puller.Pull(ctx, resolvedRef, tmpDir, o.platformOS, o.platformArch)
if err != nil {
return err
}
sig := signatures[resolvedRef]
if sig != nil && !o.noVerify {
repo, err := utils.RepositoryFromRef(resolvedRef)
if err != nil {
return err
}
// In order to prevent TOCTOU issues we'll perform signature verification after we complete a pull
// and obtained a digest but before files are written to disk. This way we ensure that we're verifying
// the exact digest that we just pulled, even if the tag gets overwritten in the meantime.
digestRef := fmt.Sprintf("%s@%s", repo, result.RootDigest)
logger.Info("Verifying signature for artifact", logger.Args("digest", digestRef))
err = signature.Verify(ctx, digestRef, sig)
if err != nil {
return fmt.Errorf("error while verifying signature for %s: %w", digestRef, err)
}
logger.Info("Signature successfully verified!")
}
var destDir string
switch result.Type {
case oci.Plugin:
destDir = o.PluginsDir
case oci.Rulesfile:
destDir = o.RulesfilesDir
case oci.Asset:
destDir = o.AssetsDir
default:
return fmt.Errorf("unrecognized result type %q while pulling artifact", result.Type)
}
// Check if directory exists and is writable.
err = utils.ExistsAndIsWritable(destDir)
if err != nil {
return fmt.Errorf("cannot use directory %q as install destination: %w", destDir, err)
}
logger.Info("Extracting and installing artifact", logger.Args("type", result.Type, "file", result.Filename))
if !o.Printer.DisableStyling {
o.Printer.Spinner, _ = o.Printer.Spinner.Start("Extracting and installing")
}
result.Filename = filepath.Join(tmpDir, result.Filename)
f, err := os.Open(result.Filename)
if err != nil {
return err
}
// Extract artifact and move it to its destination directory
_, err = utils.ExtractTarGz(ctx, f, destDir, 0)
if err != nil {
return fmt.Errorf("cannot extract %q to %q: %w", result.Filename, destDir, err)
}
err = os.Remove(result.Filename)
if err != nil {
return err
}
if o.Printer.Spinner != nil {
_ = o.Printer.Spinner.Stop()
}
logger.Info("Artifact successfully installed", logger.Args("name", resolvedRef, "type", result.Type, "digest", result.Digest, "directory", destDir))
}
return nil
}

View File

@ -0,0 +1,111 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package install_test
import (
"context"
"fmt"
"net/http"
"os"
"path/filepath"
"testing"
"time"
"github.com/distribution/distribution/v3/configuration"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"oras.land/oras-go/v2/registry/remote"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
//nolint:unused // false positive
const (
rulesfiletgz = "../../../pkg/test/data/rules.tar.gz"
rulesfileyaml = "../../../pkg/test/data/rules.yaml"
plugintgz = "../../../pkg/test/data/plugin.tar.gz"
)
//nolint:unused // false positive
var (
registry string
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
port int
orasRegistry *remote.Registry
configFile string
err error
args []string
)
func TestInstall(t *testing.T) {
var err error
RegisterFailHandler(Fail)
port, err = testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
registry = fmt.Sprintf("localhost:%d", port)
RunSpecs(t, "root suite")
}
var _ = BeforeSuite(func() {
config := &configuration.Configuration{}
config.HTTP.Addr = fmt.Sprintf("localhost:%d", port)
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create the oras registry.
orasRegistry, err = testutils.NewOrasRegistry(registry, true)
Expect(err).ToNot(HaveOccurred())
// Start the local registry.
go func() {
err := testutils.StartRegistry(context.Background(), config)
Expect(err).ToNot(BeNil())
}()
// Check that the registry is up and accepting connections.
Eventually(func(g Gomega) error {
res, err := http.Get(fmt.Sprintf("http://%s", config.HTTP.Addr))
g.Expect(err).ShouldNot(HaveOccurred())
g.Expect(res.StatusCode).Should(Equal(http.StatusOK))
return err
}).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred())
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
//nolint:unused // false positive
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,465 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package install_test
import (
"fmt"
"os"
"path/filepath"
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"oras.land/oras-go/v2/registry/remote/auth"
"github.com/falcosecurity/falcoctl/cmd"
"github.com/falcosecurity/falcoctl/pkg/oci"
"github.com/falcosecurity/falcoctl/pkg/oci/authn"
ocipusher "github.com/falcosecurity/falcoctl/pkg/oci/pusher"
out "github.com/falcosecurity/falcoctl/pkg/output"
)
//nolint:lll,unused // no need to check for line length.
var artifactInstallUsage = `Usage:
falcoctl artifact install [ref1 [ref2 ...]] [flags]
Flags:
--allowed-types ArtifactTypeSlice list of artifact types that can be installed. If not specified or configured, all types are allowed.
It accepts comma separated values or it can be repeated multiple times.
Examples:
--allowed-types="rulesfile,plugin"
--allowed-types=rulesfile --allowed-types=plugin
-h, --help help for install
--plain-http allows interacting with remote registry via plain http requests
--platform string os and architecture of the artifact in OS/ARCH format (default "linux/amd64")
--plugins-dir string directory where to install plugins. (default "/usr/share/falco/plugins")
--resolve-deps whether this command should resolve dependencies or not (default true)
--rulesfiles-dir string directory where to install rules. (default "/etc/falco")
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
//nolint:unused // false positive
var artifactInstallHelp = `This command allows you to install one or more given artifacts.
Artifact references and flags are passed as arguments through:
- command line options
- environment variables
- configuration file
The arguments passed through these different modalities are prioritized in the following order:
command line options, environment variables, and finally the configuration file. This means that
if an argument is passed through multiple modalities, the value set in the command line options
will take precedence over the value set in environment variables, which will in turn take precedence
over the value set in the configuration file.
Please note that when passing multiple artifact references via an environment variable, they must be
separated by a semicolon ';'. Other arguments, if passed through environment variables, should start
with "FALCOCTL_" and be followed by the hierarchical keys used in the configuration file separated by
an underscore "_".
A reference is either a simple name or a fully qualified reference ("<registry>/<repository>"),
optionally followed by ":<tag>" (":latest" is assumed by default when no tag is given).
When providing just the name of the artifact, the command will search for the artifacts in
the configured index files, and if found, it will use the registry and repository specified
in the indexes.
Example - Install "latest" tag of "k8saudit-rules" artifact by relying on index metadata:
falcoctl artifact install k8saudit-rules
Example - Install all updates from "k8saudit-rules" 0.5.x release series:
falcoctl artifact install k8saudit-rules:0.5
Example - Install "cloudtrail" plugins using a fully qualified reference:
falcoctl artifact install ghcr.io/falcosecurity/plugins/ruleset/k8saudit:latest
`
//nolint:unused // false positive
var correctIndexConfig = `indexes:
- name: falcosecurity
url: https://falcosecurity.github.io/falcoctl/index.yaml
`
//nolint:unused // false positive
var installAssertFailedBehavior = func(usage, specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(usage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
//nolint:unused // false positive
var artifactInstallTests = Describe("install", func() {
var (
pusher *ocipusher.Pusher
ref string
config ocipusher.Option
)
const (
// Used as flags for all the test cases.
artifactCmd = "artifact"
installCmd = "install"
dep1 = "myplugin:1.2.3"
dep2 = "myplugin1:1.2.3|otherplugin:3.2.1"
req = "engine_version:15"
anSource = "myrepo.com/rules.git"
artifact = "generic-repo"
repo = "/" + artifact
tag = "tag"
repoAndTag = repo + ":" + tag
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{artifactCmd, installCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(artifactInstallHelp)))
})
})
Context("failure", func() {
var (
tracker out.Tracker
options []ocipusher.Option
filePathsAndPlatforms ocipusher.Option
filePaths ocipusher.Option
destDir string
)
const (
plainHTTP = true
testPluginPlatform1 = "linux/amd64"
)
When("without artifact", func() {
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, "--config", configFile}
})
installAssertFailedBehavior(artifactInstallUsage,
"ERROR no artifacts to install, please configure artifacts or pass them as arguments to this command")
})
When("unreachable registry", func() {
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, "noregistry/testrules", "--plain-http", "--config", configFile}
})
installAssertFailedBehavior(artifactInstallUsage, `ERROR unable to get manifest: unable to fetch reference`)
})
When("invalid repository", func() {
newReg := registry + "/wrong:latest"
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, newReg, "--plain-http", "--config", configFile}
})
installAssertFailedBehavior(artifactInstallUsage, fmt.Sprintf("ERROR unable to get manifest: unable to fetch reference %q", newReg))
})
When("with disallowed types (rulesfile)", func() {
BeforeEach(func() {
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
// push plugin
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{
Name: "plugin1",
Version: "0.0.1",
})
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{plugintgz}, []string{testPluginPlatform1})
options = []ocipusher.Option{filePathsAndPlatforms, config}
result, err := pusher.Push(ctx, oci.Plugin, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, ref, "--plain-http", "--platform", testPluginPlatform1,
"--config", configFilePath, "--allowed-types", "rulesfile"}
})
installAssertFailedBehavior(artifactInstallUsage, "ERROR cannot download artifact of type \"plugin\": type not permitted")
})
When("with disallowed types (plugin)", func() {
BeforeEach(func() {
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
// push rulesfile
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{
Name: "rules1",
Version: "0.0.1",
})
filePaths = ocipusher.WithFilepaths([]string{rulesfiletgz})
options = []ocipusher.Option{filePaths, config}
result, err := pusher.Push(ctx, oci.Rulesfile, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, ref, "--plain-http",
"--config", configFilePath, "--allowed-types", "plugin"}
})
installAssertFailedBehavior(artifactInstallUsage, "ERROR cannot download artifact of type \"rulesfile\": type not permitted")
})
When("an unknown type is used", func() {
wrongType := "mywrongtype"
BeforeEach(func() {
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
// push rulesfile
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{
Name: "rules1",
Version: "0.0.1",
})
filePaths = ocipusher.WithFilepaths([]string{rulesfiletgz})
options = []ocipusher.Option{filePaths, config}
result, err := pusher.Push(ctx, oci.Rulesfile, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, ref, "--plain-http",
"--config", configFilePath, "--allowed-types", "plugin," + wrongType}
})
installAssertFailedBehavior(artifactInstallUsage, fmt.Sprintf("ERROR invalid argument \"plugin,%s\" for \"--allowed-types\" flag: "+
"not valid token %q: must be one of \"rulesfile\", \"plugin\"", wrongType, wrongType))
})
When("--plugins-dir is not writable", func() {
BeforeEach(func() {
destDir = GinkgoT().TempDir()
err = os.Chmod(destDir, 0o555)
Expect(err).To(BeNil())
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
// push plugin
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{
Name: "plugin1",
Version: "0.0.1",
})
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{plugintgz}, []string{testPluginPlatform1})
options = []ocipusher.Option{filePathsAndPlatforms, config}
result, err := pusher.Push(ctx, oci.Plugin, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, ref, "--plain-http", "--platform", testPluginPlatform1,
"--config", configFilePath, "--plugins-dir", destDir}
})
It("check that fails and the usage is not printed", func() {
expectedError := fmt.Sprintf("ERROR cannot use directory %q "+
"as install destination: %s is not writable", destDir, destDir)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(artifactInstallUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("--plugins-dir is not present", func() {
BeforeEach(func() {
destDir = GinkgoT().TempDir()
err = os.Remove(destDir)
Expect(err).To(BeNil())
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
// push plugin
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{
Name: "plugin1",
Version: "0.0.1",
})
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{plugintgz}, []string{testPluginPlatform1})
options = []ocipusher.Option{filePathsAndPlatforms, config}
result, err := pusher.Push(ctx, oci.Plugin, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, ref, "--plain-http", "--platform", testPluginPlatform1,
"--config", configFilePath, "--plugins-dir", destDir}
})
It("check that fails and the usage is not printed", func() {
expectedError := fmt.Sprintf("ERROR cannot use directory %q "+
"as install destination: %s doesn't exists", destDir, destDir)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(artifactInstallUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("--rulesfile-dir is not writable", func() {
BeforeEach(func() {
destDir = GinkgoT().TempDir()
err = os.Chmod(destDir, 0o555)
Expect(err).To(BeNil())
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
// push plugin
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{
Name: "rules1",
Version: "0.0.1",
})
filePaths = ocipusher.WithFilepaths([]string{rulesfiletgz})
options = []ocipusher.Option{filePaths, config}
result, err := pusher.Push(ctx, oci.Rulesfile, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, ref, "--plain-http",
"--config", configFilePath, "--rulesfiles-dir", destDir}
})
It("check that fails and the usage is not printed", func() {
expectedError := fmt.Sprintf("ERROR cannot use directory %q "+
"as install destination: %s is not writable", destDir, destDir)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(artifactInstallUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("not existing --plugins-dir", func() {
BeforeEach(func() {
destDir = GinkgoT().TempDir()
err = os.Remove(destDir)
Expect(err).To(BeNil())
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
// push plugin
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{
Name: "rules1",
Version: "0.0.1",
})
filePathsAndPlatforms = ocipusher.WithFilepaths([]string{rulesfiletgz})
options = []ocipusher.Option{filePaths, config}
result, err := pusher.Push(ctx, oci.Rulesfile, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
Expect(err).To(BeNil())
args = []string{artifactCmd, installCmd, ref, "--plain-http",
"--config", configFilePath, "--rulesfiles-dir", destDir}
})
It("check that fails and the usage is not printed", func() {
expectedError := fmt.Sprintf("ERROR cannot use directory %q "+
"as install destination: %s doesn't exists", destDir, destDir)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(artifactInstallUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("not --platform is not of the correct format", func() {
BeforeEach(func() {
destDir = GinkgoT().TempDir()
err = os.Remove(destDir)
Expect(err).To(BeNil())
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
ref = registry + repoAndTag
args = []string{artifactCmd, installCmd, ref, "--config", configFile, "--platform", "this/is/invalid"}
})
It("check that fails and the usage is not printed", func() {
expectedError := `ERROR invalid "platform": must be in the format OS/Arch`
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(artifactInstallUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
})
})

View File

@ -0,0 +1,78 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package list
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/pkg/oci"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
// CommandName name of the command. It has to be the first word in the use line.
const CommandName = "list"
type artifactListOptions struct {
*options.Common
artifactType oci.ArtifactType
index string
}
// NewArtifactListCmd returns the artifact search command.
func NewArtifactListCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := artifactListOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: fmt.Sprintf("%s [flags]", CommandName),
DisableFlagsInUseLine: true,
Short: "List all artifacts",
Long: "List all artifacts",
Aliases: []string{"ls"},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunArtifactList(ctx, args)
},
}
cmd.Flags().Var(&o.artifactType, "type", `Only list artifacts with a specific type. Allowed values: "rulesfile", "plugin", "asset"`)
cmd.Flags().StringVar(&o.index, "index", "", "Only display artifacts from a configured index")
return cmd
}
func (o *artifactListOptions) RunArtifactList(_ context.Context, _ []string) error {
var data [][]string
for _, entry := range o.IndexCache.MergedIndexes.Entries {
if o.artifactType != "" && o.artifactType != oci.ArtifactType(entry.Type) {
continue
}
indexName := o.IndexCache.MergedIndexes.IndexByEntry(entry).Name
if o.index != "" && o.index != indexName {
continue
}
row := []string{indexName, entry.Name, entry.Type, entry.Registry, entry.Repository}
data = append(data, row)
}
return o.Printer.PrintTable(output.ArtifactSearch, data)
}

17
cmd/artifact/list/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package list defines the logic to list artifacts in the configured index files.
package list

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package manifest defines the business logic to fetch manifest layer for artifacts.
package manifest

View File

@ -0,0 +1,93 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package manifest
import (
"context"
"fmt"
"runtime"
"strings"
"github.com/spf13/cobra"
ocipuller "github.com/falcosecurity/falcoctl/pkg/oci/puller"
ociutils "github.com/falcosecurity/falcoctl/pkg/oci/utils"
"github.com/falcosecurity/falcoctl/pkg/options"
)
type artifactManifestOptions struct {
*options.Common
*options.Registry
platform string
}
// NewArtifactManifestCmd returns the artifact manifest command.
func NewArtifactManifestCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := artifactManifestOptions{
Common: opt,
Registry: &options.Registry{},
}
cmd := &cobra.Command{
Use: "manifest [ref] [flags]",
Short: "Get the manifest layer of an artifact",
Long: "Get the manifest layer of an artifact",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunArtifactManifest(ctx, args)
},
}
o.Registry.AddFlags(cmd)
cmd.Flags().StringVar(&o.platform, "platform", fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
"os and architecture of the artifact in OS/ARCH format")
return cmd
}
func (o *artifactManifestOptions) RunArtifactManifest(ctx context.Context, args []string) error {
var (
puller *ocipuller.Puller
ref string
manifest []byte
err error
)
// Create puller with auto login enabled.
if puller, err = ociutils.Puller(o.PlainHTTP, o.Printer); err != nil {
return err
}
// Resolve the artifact reference.
if ref, err = o.IndexCache.ResolveReference(args[0]); err != nil {
return err
}
// TODO: implement two new flags (platforms, platform) based on the oci platform struct.
// Split the platform.
tokens := strings.Split(o.platform, "/")
if len(tokens) != 2 {
return fmt.Errorf("invalid platform format: %s", o.platform)
}
if manifest, err = puller.RawManifest(ctx, ref, tokens[0], tokens[1]); err != nil {
return err
}
o.Printer.DefaultText.Println(string(manifest))
return nil
}

View File

@ -0,0 +1,135 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package manifest_test
import (
"context"
"fmt"
"net/http"
"testing"
"time"
"github.com/distribution/distribution/v3/configuration"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"oras.land/oras-go/v2/registry/remote"
"oras.land/oras-go/v2/registry/remote/auth"
"github.com/falcosecurity/falcoctl/cmd"
"github.com/falcosecurity/falcoctl/pkg/oci"
"github.com/falcosecurity/falcoctl/pkg/oci/authn"
ocipusher "github.com/falcosecurity/falcoctl/pkg/oci/pusher"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
var (
localRegistryHost string
localRegistry *remote.Registry
testRuleTarball = "../../../pkg/test/data/rules.tar.gz"
testPluginTarball = "../../../pkg/test/data/plugin.tar.gz"
testPluginPlatform1 = "linux/amd64"
testPluginPlatform2 = "windows/amd64"
testPluginPlatform3 = "linux/arm64"
ctx = context.Background()
pluginMultiPlatformRef string
rulesRef string
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
)
func TestManifest(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Manifest Suite")
}
var _ = BeforeSuite(func() {
var err error
config := &configuration.Configuration{}
// Get a free port to be used by the registry.
port, err := testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
// Create the registry address to which will bind.
config.HTTP.Addr = fmt.Sprintf("localhost:%d", port)
localRegistryHost = config.HTTP.Addr
// Create the oras registry.
localRegistry, err = testutils.NewOrasRegistry(localRegistryHost, true)
Expect(err).ToNot(HaveOccurred())
// Start the local registry.
go func() {
err := testutils.StartRegistry(context.Background(), config)
Expect(err).ToNot(BeNil())
}()
// Check that the registry is up and accepting connections.
Eventually(func(g Gomega) error {
res, err := http.Get(fmt.Sprintf("http://%s", config.HTTP.Addr))
g.Expect(err).ShouldNot(HaveOccurred())
g.Expect(res.StatusCode).Should(Equal(http.StatusOK))
return err
}).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred())
// Initialize options for command.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Push the artifacts to the registry.
// Same artifacts will be used to test the puller code.
pusher := ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), true, nil)
// Push plugin artifact with multiple architectures.
filePathsAndPlatforms := ocipusher.WithFilepathsAndPlatforms([]string{testPluginTarball, testPluginTarball, testPluginTarball},
[]string{testPluginPlatform1, testPluginPlatform2, testPluginPlatform3})
pluginMultiPlatformRef = localRegistryHost + "/plugins:multiplatform"
artConfig := oci.ArtifactConfig{}
Expect(artConfig.ParseDependencies("my-dep:1.2.3|my-alt-dep:1.4.5")).ToNot(HaveOccurred())
Expect(artConfig.ParseRequirements("my-req:7.8.9")).ToNot(HaveOccurred())
artifactConfig := ocipusher.WithArtifactConfig(artConfig)
// Build options slice.
options := []ocipusher.Option{filePathsAndPlatforms, artifactConfig}
// Push the plugin artifact.
_, err = pusher.Push(ctx, oci.Plugin, pluginMultiPlatformRef, options...)
Expect(err).ShouldNot(HaveOccurred())
// Prepare and push artifact without config layer.
filePaths := ocipusher.WithFilepaths([]string{testRuleTarball})
artConfig = oci.ArtifactConfig{}
Expect(artConfig.ParseDependencies("dep1:1.2.3", "dep2:2.3.1")).ToNot(HaveOccurred())
options = []ocipusher.Option{
filePaths,
ocipusher.WithTags("latest"),
}
// Push a rulesfile artifact
options = append(options, ocipusher.WithArtifactConfig(artConfig))
rulesRef = localRegistryHost + "/rulesfiles:regular"
_, err = pusher.Push(ctx, oci.Rulesfile, rulesRef, options...)
Expect(err).ShouldNot(HaveOccurred())
})
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,204 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package manifest_test
import (
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
var usage = `Usage:
falcoctl artifact manifest [ref] [flags]
Flags:
-h, --help help for manifest
--plain-http allows interacting with remote registry via plain http requests
--platform string os and architecture of the artifact in OS/ARCH format (default "linux/amd64")
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
var help = `Get the manifest layer of an artifact
Usage:
falcoctl artifact manifest [ref] [flags]
Flags:
-h, --help help for manifest
--plain-http allows interacting with remote registry via plain http requests
--platform string os and architecture of the artifact in OS/ARCH format (default "linux/amd64")
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
var _ = Describe("Manifest", func() {
const (
artifactCmd = "artifact"
manifestCmd = "manifest"
plaingHTTP = "--plain-http"
configFlag = "--config"
platformFlag = "--platform"
)
var (
err error
args []string
configDir string
)
var assertFailedBehavior = func(usage, specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(usage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
JustBeforeEach(func() {
configDir = GinkgoT().TempDir()
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
err = nil
Expect(output.Clear()).ShouldNot(HaveOccurred())
args = nil
})
Context("help message", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, "--help"}
})
It("should match the saved one", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(string(output.Contents())).Should(Equal(help))
})
})
Context("wrong number of arguments", func() {
When("number of arguments equal to 0", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd}
})
assertFailedBehavior(usage, "ERROR accepts 1 arg(s), received 0 ")
})
When("number of arguments equal to 2", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, "arg1", "arg2", configFlag, configDir}
})
assertFailedBehavior(usage, "ERROR accepts 1 arg(s), received 2 ")
})
})
Context("failure", func() {
When("unreachable/non existing registry", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, "noregistry/noartifact", plaingHTTP, configFlag, configDir}
})
assertFailedBehavior(usage, "ERROR unable to fetch reference \"noregistry/noartifact:latest\"")
})
When("non existing repository", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, localRegistryHost + "/noartifact", plaingHTTP, configFlag, configDir}
})
assertFailedBehavior(usage, "noartifact:latest: not found")
})
When("non parsable reference", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, " ", plaingHTTP, configFlag, configDir}
})
assertFailedBehavior(usage, "ERROR cannot find among the configured indexes, skipping ")
})
When("no manifest for given platform", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, pluginMultiPlatformRef, plaingHTTP, configFlag, configDir, platformFlag, "linux/wrong"}
})
assertFailedBehavior(usage, "ERROR unable to find a manifest matching the given platform: linux/wrong")
})
})
Context("success", func() {
When("without image index and no platform (rulesfiles)", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, rulesRef, plaingHTTP, configFlag, configDir}
})
It("should success", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(`{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.cncf.falco.rulesfile.config.v1+json","digest":"sha256:c329db306d80e7f1e3a5df28bb7d75a0a1545ad1e8f717a4ab4534a3d558affa","size":86},"layers":[{"mediaType":"application/vnd.cncf.falco.rulesfile.layer.v1+tar.gz","digest":"sha256:8ed676f9801d987a26854827beb176eb9164dec3b09a714406348fe1096f7c6c","size":2560,"annotations":{"org.opencontainers.image.title":"rules.tar.gz"}}],"annotations":{"org.opencontainers.image.created":`))) //nolint:lll //testing purpose
})
})
When("no platform flag", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, pluginMultiPlatformRef, plaingHTTP, configFlag, configDir}
})
It("should success getting the platform where tests are running", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(
`{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.cncf.falco.plugin.config.v1+json","digest":"sha256:39ae8c14fd9ef38d0f1836ba7be71627023ce615f165c3663586a325eee04724","size":164},"layers":[{"mediaType":"application/vnd.cncf.falco.plugin.layer.v1+tar.gz","digest":"sha256:45a192b10e9bbfc82f4216b071afefd7fba56e02e856e37186430d40160e5d64","size":6659921,"annotations":{"org.opencontainers.image.title":"plugin.tar.gz"}}],"annotations":{"org.opencontainers.image.created":`))) //nolint:lll //testing purpose
})
})
When("with valid platform", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, pluginMultiPlatformRef, plaingHTTP, configFlag, configDir, platformFlag, testPluginPlatform3}
})
It("should success", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(
`{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.cncf.falco.plugin.config.v1+json","digest":"sha256:39ae8c14fd9ef38d0f1836ba7be71627023ce615f165c3663586a325eee04724","size":164},"layers":[{"mediaType":"application/vnd.cncf.falco.plugin.layer.v1+tar.gz","digest":"sha256:45a192b10e9bbfc82f4216b071afefd7fba56e02e856e37186430d40160e5d64","size":6659921,"annotations":{"org.opencontainers.image.title":"plugin.tar.gz"}}],"annotations":{"org.opencontainers.image.created":`))) //nolint:lll //testing purpose
})
})
When("with non existing platform for artifacts without platforms", func() {
BeforeEach(func() {
args = []string{artifactCmd, manifestCmd, rulesRef, plaingHTTP, configFlag, configDir, platformFlag, testPluginPlatform3}
})
It("should success and ignore the platform flag", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(
`{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.cncf.falco.rulesfile.config.v1+json","digest":"sha256:c329db306d80e7f1e3a5df28bb7d75a0a1545ad1e8f717a4ab4534a3d558affa","size":86},"layers":[{"mediaType":"application/vnd.cncf.falco.rulesfile.layer.v1+tar.gz","digest":"sha256:8ed676f9801d987a26854827beb176eb9164dec3b09a714406348fe1096f7c6c","size":2560,"annotations":{"org.opencontainers.image.title":"rules.tar.gz"}}],"annotations":{"org.opencontainers.image.created":`))) //nolint:lll //testing purpose
})
})
})
})

View File

@ -0,0 +1,91 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package search
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/pkg/oci"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
const (
defaultMinScore = 0.65
// CommandName name of the command. It has to be the first word in the use line.
CommandName = "search"
)
type artifactSearchOptions struct {
*options.Common
minScore float64
artifactType oci.ArtifactType
}
func (o *artifactSearchOptions) Validate() error {
if o.minScore <= 0 || o.minScore > 1 {
return fmt.Errorf("minScore must be a number within (0,1]")
}
return nil
}
// NewArtifactSearchCmd returns the artifact search command.
func NewArtifactSearchCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := artifactSearchOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: fmt.Sprintf("%s [keyword1 [keyword2 ...]] [flags]", CommandName),
DisableFlagsInUseLine: true,
Short: "Search an artifact by keywords",
Long: "Search an artifact by keywords",
Args: cobra.MinimumNArgs(1),
PreRunE: func(cmd *cobra.Command, args []string) error {
return o.Validate()
},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunArtifactSearch(ctx, args)
},
}
cmd.Flags().Float64VarP(&o.minScore, "min-score", "", defaultMinScore,
"the minimum score used to match artifact names with search keywords")
cmd.Flags().Var(&o.artifactType, "type", `Only search artifacts with a specific type. Allowed values: "rulesfile", "plugin", "asset"`)
return cmd
}
func (o *artifactSearchOptions) RunArtifactSearch(_ context.Context, args []string) error {
resultEntries := o.IndexCache.MergedIndexes.SearchByKeywords(o.minScore, args...)
var data [][]string
for _, entry := range resultEntries {
if o.artifactType != "" && o.artifactType != oci.ArtifactType(entry.Type) {
continue
}
indexName := o.IndexCache.MergedIndexes.IndexByEntry(entry).Name
row := []string{indexName, entry.Name, entry.Type, entry.Registry, entry.Repository}
data = append(data, row)
}
return o.Printer.PrintTable(output.ArtifactSearch, data)
}

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package search defines the logic to search for artifacts in the configured index files.
package search

28
cmd/cmd_suite_test.go Normal file
View File

@ -0,0 +1,28 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cmd_test
import (
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
func TestCmd(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Cmd Suite")
}

View File

@ -1,56 +0,0 @@
/*
Copyright © 2019 The Falco Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// ConvertOptions represents the convert command options
type ConvertOptions struct {
genericclioptions.IOStreams
}
// Validate validates the `convert` command options
func (o ConvertOptions) Validate(c *cobra.Command, args []string) error {
return nil
}
// NewConvertOptions instantiates the `convert` command options
func NewConvertOptions(streams genericclioptions.IOStreams) CommandOptions {
return &ConvertOptions{
IOStreams: streams,
}
}
// NewConvertCommand creates the `convert` command
func NewConvertCommand(streams genericclioptions.IOStreams) *cobra.Command {
// o := NewConvertOptions(streams).(*ConvertOptions)
cmd := &cobra.Command{
Use: "convert",
TraverseChildren: true,
DisableFlagsInUseLine: true,
Short: "Conversion helpers",
Long: `Various conversion helpers`,
}
cmd.AddCommand(NewPspRulesConvCommand(streams))
return cmd
}

View File

@ -1,56 +0,0 @@
/*
Copyright © 2019 The Falco Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"github.com/falcosecurity/falcoctl/pkg/kubernetes/factory"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// DeleteOptions represents the `delete` command options
type DeleteOptions struct {
genericclioptions.IOStreams
}
// Validate validates the `delete` command options
func (o DeleteOptions) Validate(c *cobra.Command, args []string) error {
return nil
}
// NewDeleteOptions instantiates the `delete` command options
func NewDeleteOptions(streams genericclioptions.IOStreams) CommandOptions {
return &DeleteOptions{
IOStreams: streams,
}
}
// NewDeleteCommand creates the `delete` command
func NewDeleteCommand(streams genericclioptions.IOStreams, f factory.Factory) *cobra.Command {
// o := NewDeleteOptions(streams).(*DeleteOptions)
cmd := &cobra.Command{
Use: "delete",
DisableFlagsInUseLine: true,
Short: "Delete a component wih falcoctl",
Long: `Delete a component wih falcoctl`,
}
cmd.AddCommand(NewFalcoDeleteCommand(streams, f))
return cmd
}

17
cmd/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package cmd implements all the falcoctl commands.
package cmd

View File

@ -0,0 +1,74 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package drivercleanup
import (
"bytes"
"strings"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"golang.org/x/net/context"
"github.com/falcosecurity/falcoctl/pkg/options"
)
type driverCleanupOptions struct {
*options.Common
*options.Driver
}
// NewDriverCleanupCmd cleans a driver up.
func NewDriverCleanupCmd(ctx context.Context, opt *options.Common, driver *options.Driver) *cobra.Command {
o := driverCleanupOptions{
Common: opt,
Driver: driver,
}
cmd := &cobra.Command{
Use: "cleanup [flags]",
DisableFlagsInUseLine: true,
Short: "Cleanup a driver",
Long: `Cleans a driver up, eg for kmod, by removing it from dkms.`,
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunDriverCleanup(ctx)
},
}
return cmd
}
func (o *driverCleanupOptions) RunDriverCleanup(_ context.Context) error {
o.Printer.Logger.Info("Running falcoctl driver cleanup", o.Printer.Logger.Args(
"driver type", o.Driver.Type,
"driver name", o.Driver.Name))
var buf bytes.Buffer
if !o.Printer.DisableStyling {
o.Printer.Spinner, _ = o.Printer.Spinner.Start("Cleaning up existing drivers")
}
err := o.Driver.Type.Cleanup(o.Printer.WithWriter(&buf), o.Driver.Name)
if o.Printer.Spinner != nil {
_ = o.Printer.Spinner.Stop()
}
if o.Printer.Logger.Formatter == pterm.LogFormatterJSON {
// Only print formatted text if we are formatting to json
out := strings.ReplaceAll(buf.String(), "\n", ";")
o.Printer.Logger.Info("Driver cleanup", o.Printer.Logger.Args("output", out))
} else {
// Print much more readable output as-is
o.Printer.DefaultText.Print(buf.String())
}
return err
}

View File

@ -0,0 +1,69 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package drivercleanup_test
import (
"context"
"os"
"path/filepath"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
var (
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
configFile string
err error
args []string
)
func TestCleanup(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Cleanup Suite")
}
var _ = BeforeSuite(func() {
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,101 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package drivercleanup_test
import (
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
//nolint:lll // no need to check for line length.
var driverCleanupHelp = `Cleans a driver up, eg for kmod, by removing it from dkms.
Usage:
falcoctl driver cleanup [flags]
Flags:
-h, --help help for cleanup
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--host-root string Driver host root to be used. (default "/")
--kernelrelease string Specify the kernel release for which to download/build the driver in the same format used by 'uname -r' (e.g. '6.1.0-10-cloud-amd64')
--kernelversion string Specify the kernel version for which to download/build the driver in the same format used by 'uname -v' (e.g. '#1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27)')
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
--name string Driver name to be used. (default "falco")
--repo strings Driver repo to be used. (default [https://download.falco.org/driver])
--type strings Driver types allowed in descending priority order (ebpf, kmod, modern_ebpf) (default [modern_ebpf,kmod,ebpf])
--version string Driver version to be used.
`
var addAssertFailedBehavior = func(specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
var _ = Describe("cleanup", func() {
var (
driverCmd = "driver"
cleanupCmd = "cleanup"
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{driverCmd, cleanupCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(driverCleanupHelp)))
})
})
// Here we are testing failure cases for cleaning a driver.
Context("failure", func() {
When("with non absolute host-root", func() {
BeforeEach(func() {
args = []string{driverCmd, cleanupCmd, "--config", configFile, "--host-root", "foo/"}
})
addAssertFailedBehavior("ERROR host-root must be an absolute path (foo/)")
})
When("with invalid driver type", func() {
BeforeEach(func() {
args = []string{driverCmd, cleanupCmd, "--config", configFile, "--type", "foo"}
})
addAssertFailedBehavior(`ERROR unsupported driver type specified: foo`)
})
})
})

17
cmd/driver/cleanup/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package drivercleanup defines the cleanup logic for the driver cmd.
package drivercleanup

View File

@ -0,0 +1,326 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package driverconfig
import (
"context"
"fmt"
"os"
"path/filepath"
"testing"
"github.com/falcosecurity/driverkit/pkg/kernelrelease"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"github.com/falcosecurity/falcoctl/pkg/options"
)
const (
falcoName = "falco"
)
func newOptions() *driverConfigOptions {
common := options.NewOptions()
common.Initialize()
// Parse the driver type.
dType, _ := drivertype.Parse("modern_ebpf")
return &driverConfigOptions{
Common: common,
Driver: &options.Driver{
Type: dType,
Name: falcoName,
Repos: []string{"https://download.falco.org/driver"},
Version: "6.0.0+driver",
HostRoot: "/",
Distro: nil,
Kr: kernelrelease.KernelRelease{},
},
update: false,
namespace: "",
kubeconfig: "",
configmap: "",
configDir: "",
}
}
func createFalcoConfigFile(cfg falcoCfg, configDir string) error {
engineKind, err := yaml.Marshal(cfg)
if err != nil {
return fmt.Errorf("unable to marshal falco config: %w", err)
}
// Write the engine configuration to a specialized config file.
if err := os.WriteFile(filepath.Join(configDir, "falco.yaml"), engineKind, 0o600); err != nil {
return fmt.Errorf("unable to write falco.yaml file: %w", err)
}
return nil
}
func createFalcoConfigMap(cfg falcoCfg, dataKey string) (*v1.ConfigMap, error) {
engineKind, err := yaml.Marshal(cfg)
if err != nil {
return nil, fmt.Errorf("unable to marshal falco config: %w", err)
}
cm := &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: falcoName,
Namespace: falcoName,
},
Data: map[string]string{
dataKey: string(engineKind),
},
}
return cm, nil
}
func TestDriverConfigOptions_Commit_Host(t *testing.T) {
testCases := []struct {
name string
args func(t *testing.T) *driverConfigOptions
expected func(t *testing.T, opt *driverConfigOptions, err error)
}{
{
"no falco config file",
func(t *testing.T) *driverConfigOptions {
opt := newOptions()
opt.configDir = "no-file-at-all"
opt.update = true
return opt
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.Error(t, err, "should error since falco configuration file does not exist")
require.ErrorContains(t, err, "open no-file-at-all/falco.yaml: no such file or directory")
},
},
{
"update-falco-config",
func(t *testing.T) *driverConfigOptions {
opt := newOptions()
dir, err := os.MkdirTemp("", "falcoctl-driver-config-test")
require.NoError(t, err)
// Write falco configuration file.
cfg := falcoCfg{engineCfg{Kind: "modern_ebpf"}}
err = createFalcoConfigFile(cfg, dir)
require.NoError(t, err)
opt.configDir = dir
return opt
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.NoError(t, err, "should not error")
// Config file.
specCfgFile := filepath.Join(opt.configDir, "config.d", falcoDriverConfigFile)
// Check that config file has been created.
_, err = os.Stat(specCfgFile)
require.NoError(t, err)
content, err := os.ReadFile(specCfgFile)
require.NoError(t, err)
cfg := falcoCfg{}
err = yaml.Unmarshal(content, &cfg)
require.NoError(t, err)
require.Equal(t, opt.Type.String(), cfg.Engine.Kind)
},
},
{
"falco-not-in-driver-mode",
func(t *testing.T) *driverConfigOptions {
opt := newOptions()
dir, err := os.MkdirTemp("", "falcoctl-driver-config-test")
require.NoError(t, err)
// Write falco configuration file.
cfg := falcoCfg{engineCfg{Kind: "nodriver"}}
err = createFalcoConfigFile(cfg, dir)
require.NoError(t, err)
opt.configDir = dir
return opt
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.NoError(t, err, "should not error")
// Config file.
specCfgFile := filepath.Join(opt.configDir, "config.d", falcoDriverConfigFile)
// Check that config file has been created.
_, err = os.Stat(specCfgFile)
require.True(t, os.IsNotExist(err))
},
},
}
for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()
opt := testCase.args(t)
err := opt.Commit(context.Background(), nil, opt.Type)
testCase.expected(t, opt, err)
})
}
}
func TestDriverConfigOptions_Commit_K8S(t *testing.T) {
testCases := []struct {
name string
args func(t *testing.T) (*driverConfigOptions, *v1.ConfigMap)
expected func(t *testing.T, opt *driverConfigOptions, err error)
}{
{
"no falco configmap, wrong namespace",
func(t *testing.T) (*driverConfigOptions, *v1.ConfigMap) {
opt := newOptions()
opt.namespace = "wrong-namespace"
opt.configmap = falcoName
cm, err := createFalcoConfigMap(falcoCfg{engineCfg{Kind: "modern_ebpf"}}, "falco.yaml")
require.NoError(t, err)
return opt, cm
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.Error(t, err, "should error since falco configmap does not exist")
require.ErrorContains(t, err, "unable to get configmap falco in namespace wrong-namespace")
},
},
{
"no falco configmap, wrong name",
func(t *testing.T) (*driverConfigOptions, *v1.ConfigMap) {
opt := newOptions()
opt.namespace = falcoName
opt.configmap = "wrong-name"
cm, err := createFalcoConfigMap(falcoCfg{engineCfg{Kind: "modern_ebpf"}}, "falco.yaml")
require.NoError(t, err)
return opt, cm
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.Error(t, err, "should error since falco configmap does not exist")
require.ErrorContains(t, err, "unable to get configmap wrong-name in namespace falco")
},
},
{
"no falco config, wrong data key",
func(t *testing.T) (*driverConfigOptions, *v1.ConfigMap) {
opt := newOptions()
opt.namespace = falcoName
opt.configmap = falcoName
cm, err := createFalcoConfigMap(falcoCfg{engineCfg{Kind: "modern_ebpf"}}, "wrong-data-key")
require.NoError(t, err)
return opt, cm
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.Error(t, err, "should error since falco configmap does not exist")
require.ErrorContains(t, err, "configMap falco does not contain key \"falco.yaml\"")
},
},
{
"update-falco-config",
func(t *testing.T) (*driverConfigOptions, *v1.ConfigMap) {
opt := newOptions()
opt.namespace = falcoName
opt.configmap = falcoName
dir, err := os.MkdirTemp("", "falcoctl-driver-config-test")
require.NoError(t, err)
opt.configDir = dir
cm, err := createFalcoConfigMap(falcoCfg{engineCfg{Kind: "modern_ebpf"}}, "falco.yaml")
require.NoError(t, err)
return opt, cm
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.NoError(t, err, "should not error")
// Config file.
specCfgFile := filepath.Join(opt.configDir, "config.d", falcoDriverConfigFile)
// Check that config file has been created.
_, err = os.Stat(specCfgFile)
require.NoError(t, err)
content, err := os.ReadFile(specCfgFile)
require.NoError(t, err)
cfg := falcoCfg{}
err = yaml.Unmarshal(content, &cfg)
require.NoError(t, err)
require.Equal(t, opt.Type.String(), cfg.Engine.Kind)
},
},
{
"falco-not-in-driver-mode",
func(t *testing.T) (*driverConfigOptions, *v1.ConfigMap) {
opt := newOptions()
opt.namespace = falcoName
opt.configmap = falcoName
dir, err := os.MkdirTemp("", "falcoctl-driver-config-test")
require.NoError(t, err)
cm, err := createFalcoConfigMap(falcoCfg{engineCfg{Kind: "nodriver"}}, "falco.yaml")
require.NoError(t, err)
opt.configDir = dir
return opt, cm
},
func(t *testing.T, opt *driverConfigOptions, err error) {
require.NoError(t, err, "should not error")
// Config file.
specCfgFile := filepath.Join(opt.configDir, "config.d", falcoDriverConfigFile)
// Check that config file has been created.
_, err = os.Stat(specCfgFile)
require.True(t, os.IsNotExist(err))
},
},
}
for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()
opt, cm := testCase.args(t)
// Create fake client.
fakeClient := fake.NewSimpleClientset(cm)
err := opt.Commit(context.Background(), fakeClient, opt.Type)
testCase.expected(t, opt, err)
})
}
}

262
cmd/driver/config/config.go Normal file
View File

@ -0,0 +1,262 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverconfig
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/net/context"
"gopkg.in/yaml.v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"github.com/falcosecurity/falcoctl/internal/config"
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"github.com/falcosecurity/falcoctl/pkg/options"
)
const (
longConfig = `Configure a driver for future usages with other driver subcommands.
It will also update local Falco configuration or k8s configmap depending on the environment where it is running, to let Falco use chosen driver.
Only supports deployments of Falco that use a driver engine, ie: one between kmod, ebpf and modern-ebpf.
If engine.kind key is set to a non-driver driven engine, Falco configuration won't be touched.
`
falcoConfigFile = "falco.yaml"
falcoDriverConfigFile = "engine-kind-falcoctl.yaml"
)
type driverConfigOptions struct {
*options.Common
*options.Driver
update bool
namespace string
kubeconfig string
configmap string
configDir string
}
type engineCfg struct {
Kind string `yaml:"kind"`
}
type falcoCfg struct {
Engine engineCfg `yaml:"engine"`
}
// NewDriverConfigCmd configures a driver and stores it in config.
func NewDriverConfigCmd(ctx context.Context, opt *options.Common, driver *options.Driver) *cobra.Command {
o := driverConfigOptions{
Common: opt,
Driver: driver,
}
cmd := &cobra.Command{
Use: "config [flags]",
DisableFlagsInUseLine: true,
Short: "Configure a driver",
Long: longConfig,
PreRunE: func(cmd *cobra.Command, args []string) error {
viper.AutomaticEnv()
_ = viper.BindPFlag("driver.config.configmap", cmd.Flags().Lookup("configmap"))
_ = viper.BindPFlag("driver.config.namespace", cmd.Flags().Lookup("namespace"))
_ = viper.BindPFlag("driver.config.update_falco", cmd.Flags().Lookup("update-falco"))
_ = viper.BindPFlag("driver.config.kubeconfig", cmd.Flags().Lookup("kubeconfig"))
_ = viper.BindPFlag("driver.config.configdir", cmd.Flags().Lookup("falco-config-dir"))
o.configmap = viper.GetString("driver.config.configmap")
o.namespace = viper.GetString("driver.config.namespace")
o.kubeconfig = viper.GetString("driver.config.kubeconfig")
o.update = viper.GetBool("driver.config.update_falco")
o.configDir = viper.GetString("driver.config.configdir")
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunDriverConfig(ctx)
},
}
cmd.Flags().BoolVar(&o.update, "update-falco", true, "Whether to overwrite Falco configuration")
cmd.Flags().StringVar(&o.namespace, "namespace", "", "Kubernetes namespace.")
cmd.Flags().StringVar(&o.kubeconfig, "kubeconfig", "", "Kubernetes config.")
cmd.Flags().StringVar(&o.configmap, "configmap", "", "Falco configmap name.")
cmd.Flags().StringVar(&o.configDir, "falco-config-dir", "/etc/falco", "Falco configuration directory.")
return cmd
}
// RunDriverConfig implements the driver configuration command.
func (o *driverConfigOptions) RunDriverConfig(ctx context.Context) error {
o.Printer.Logger.Info("Running falcoctl driver config", o.Printer.Logger.Args(
"name", o.Driver.Name,
"version", o.Driver.Version,
"type", o.Driver.Type.String(),
"host-root", o.Driver.HostRoot,
"repos", strings.Join(o.Driver.Repos, ",")))
if o.update {
var cl kubernetes.Interface
var err error
if o.namespace != "" {
// Create a new clientset.
if cl, err = setupClient(o.kubeconfig); err != nil {
return err
}
}
if err := o.Commit(ctx, cl, o.Driver.Type); err != nil {
return err
}
}
o.Printer.Logger.Info("Storing falcoctl driver config")
return config.StoreDriver(o.Driver.ToDriverConfig(), o.ConfigFile)
}
func checkFalcoRunsWithDrivers(engineKind string) bool {
// Modify the data in the ConfigMap/Falco config file ONLY if engine.kind is set to a known driver type.
// This ensures that we modify the config only for Falcos running with drivers, and not plugins/gvisor.
// Scenario: user has multiple Falco pods deployed in its cluster, one running with driver,
// other running with plugins. We must only touch the one running with driver.
if _, err := drivertype.Parse(engineKind); err != nil {
return false
}
return true
}
func (o *driverConfigOptions) IsRunningInDriverModeHost() (bool, error) {
o.Printer.Logger.Debug("Checking if Falco is running in driver mode on host system")
falcoCfgFile := filepath.Join(o.configDir, falcoConfigFile)
yamlFile, err := os.ReadFile(filepath.Clean(falcoCfgFile))
if err != nil {
return false, err
}
cfg := falcoCfg{}
if err = yaml.Unmarshal(yamlFile, &cfg); err != nil {
return false, fmt.Errorf("unable to unmarshal falco.yaml to falcoCfg struct: %w", err)
}
return checkFalcoRunsWithDrivers(cfg.Engine.Kind), nil
}
func (o *driverConfigOptions) IsRunningInDriverModeK8S(ctx context.Context, cl kubernetes.Interface) (bool, error) {
o.Printer.Logger.Debug("Checking if Falco is running in driver mode in Kubernetes")
configMap, err := cl.CoreV1().ConfigMaps(o.namespace).Get(ctx, o.configmap, metav1.GetOptions{})
if err != nil {
return false, fmt.Errorf("unable to get configmap %s in namespace %s: %w", o.configmap, o.namespace, err)
}
// Check that this is a Falco config map
falcoYaml, present := configMap.Data["falco.yaml"]
if !present {
o.Printer.Logger.Debug("Skip non Falco-related config map",
o.Printer.Logger.Args("configMap", configMap.Name))
return false, fmt.Errorf("configMap %s does not contain key \"falco.yaml\"", o.configmap)
}
// Check that Falco is configured to run with a driver
var falcoConfig falcoCfg
err = yaml.Unmarshal([]byte(falcoYaml), &falcoConfig)
if err != nil {
return false, fmt.Errorf("unable to unmarshal falco.yaml to falcoCfg struct: %w", err)
}
return checkFalcoRunsWithDrivers(falcoConfig.Engine.Kind), nil
}
// Commit saves the updated driver type to Falco config,
// in a specialized configuration file under /etc/falco/config.d.
func (o *driverConfigOptions) Commit(ctx context.Context, cl kubernetes.Interface, driverType drivertype.DriverType) error {
// If set to true, then we need to overwrite the driver type.
var overwrite bool
var err error
if cl != nil {
if overwrite, err = o.IsRunningInDriverModeK8S(ctx, cl); err != nil {
return err
}
} else {
if overwrite, err = o.IsRunningInDriverModeHost(); err != nil {
return err
}
}
if overwrite {
o.Printer.Logger.Info("Committing driver config to specialized configuration file under",
o.Printer.Logger.Args("directory", filepath.Join(o.configDir, "config.d")))
return overwriteDriverType(o.configDir, driverType)
}
o.Printer.Logger.Info("Falco is not configured to run with a driver, no need to set driver type.")
return nil
}
func setupClient(kubeconfig string) (kubernetes.Interface, error) {
var cfg *rest.Config
var err error
// Create the rest config.
if kubeconfig != "" {
cfg, err = clientcmd.BuildConfigFromFlags("", kubeconfig)
} else {
cfg, err = rest.InClusterConfig()
}
if err != nil {
return nil, err
}
// Create the clientset.
return kubernetes.NewForConfig(cfg)
}
func overwriteDriverType(configDir string, driverType drivertype.DriverType) error {
var falcoConfig falcoCfg
configDir = filepath.Join(configDir, "config.d")
// First thing, check if config.d folder exists in the configuration directory.
_, err := os.Stat(configDir)
if os.IsNotExist(err) {
// Create it.
// #nosec G301 -- under /etc we want 755 permissions
if err := os.MkdirAll(configDir, 0o755); err != nil {
return fmt.Errorf("unable to create directory %s: %w", configDir, err)
}
} else if err != nil && !os.IsNotExist(err) {
return err
}
falcoConfig.Engine.Kind = driverType.String()
engineKind, err := yaml.Marshal(falcoConfig)
if err != nil {
return fmt.Errorf("unable to marshal falco config: %w", err)
}
// Write the engine configuration to a specialized config file.
// #nosec G306 //under /etc we want 644 permissions
if err := os.WriteFile(filepath.Join(configDir, falcoDriverConfigFile), engineKind, 0o644); err != nil {
return fmt.Errorf("unable to persist engine kind to filesystem: %w", err)
}
return nil
}

View File

@ -0,0 +1,69 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverconfig_test
import (
"context"
"os"
"path/filepath"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
var (
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
configFile string
err error
args []string
)
func TestConfig(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Config Suite")
}
var _ = BeforeSuite(func() {
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,109 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverconfig_test
import (
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
//nolint:lll // no need to check for line length.
var driverConfigHelp = `Configure a driver for future usages with other driver subcommands.
It will also update local Falco configuration or k8s configmap depending on the environment where it is running, to let Falco use chosen driver.
Only supports deployments of Falco that use a driver engine, ie: one between kmod, ebpf and modern-ebpf.
If engine.kind key is set to a non-driver driven engine, Falco configuration won't be touched.
Usage:
falcoctl driver config [flags]
Flags:
--configmap string Falco configmap name.
--falco-config-dir string Falco configuration directory. (default "/etc/falco")
-h, --help help for config
--kubeconfig string Kubernetes config.
--namespace string Kubernetes namespace.
--update-falco Whether to overwrite Falco configuration (default true)
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--host-root string Driver host root to be used. (default "/")
--kernelrelease string Specify the kernel release for which to download/build the driver in the same format used by 'uname -r' (e.g. '6.1.0-10-cloud-amd64')
--kernelversion string Specify the kernel version for which to download/build the driver in the same format used by 'uname -v' (e.g. '#1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27)')
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
--name string Driver name to be used. (default "falco")
--repo strings Driver repo to be used. (default [https://download.falco.org/driver])
--type strings Driver types allowed in descending priority order (ebpf, kmod, modern_ebpf) (default [modern_ebpf,kmod,ebpf])
--version string Driver version to be used.
`
var addAssertFailedBehavior = func(specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
var _ = Describe("config", func() {
var (
driverCmd = "driver"
configCmd = "config"
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{driverCmd, configCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(driverConfigHelp)))
})
})
// Here we are testing failure cases for configuring a driver.
Context("failure", func() {
When("with non absolute host-root", func() {
BeforeEach(func() {
args = []string{driverCmd, configCmd, "--config", configFile, "--host-root", "foo/"}
})
addAssertFailedBehavior("ERROR host-root must be an absolute path (foo/)")
})
When("with invalid driver type", func() {
BeforeEach(func() {
args = []string{driverCmd, configCmd, "--config", configFile, "--type", "foo"}
})
addAssertFailedBehavior(`ERROR unsupported driver type specified: foo`)
})
})
})

17
cmd/driver/config/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package driverconfig defines the configure logic for the driver cmd.
package driverconfig

241
cmd/driver/driver_linux.go Normal file
View File

@ -0,0 +1,241 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build linux
// Package driver implements the driver related cmd line interface.
package driver
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/blang/semver"
"github.com/spf13/cobra"
"github.com/spf13/viper"
drivercleanup "github.com/falcosecurity/falcoctl/cmd/driver/cleanup"
driverconfig "github.com/falcosecurity/falcoctl/cmd/driver/config"
driverinstall "github.com/falcosecurity/falcoctl/cmd/driver/install"
driverprintenv "github.com/falcosecurity/falcoctl/cmd/driver/printenv"
"github.com/falcosecurity/falcoctl/internal/config"
driverdistro "github.com/falcosecurity/falcoctl/pkg/driver/distro"
driverkernel "github.com/falcosecurity/falcoctl/pkg/driver/kernel"
drivertype "github.com/falcosecurity/falcoctl/pkg/driver/type"
"github.com/falcosecurity/falcoctl/pkg/options"
)
// NewDriverCmd returns the driver command.
func NewDriverCmd(ctx context.Context, opt *options.Common) *cobra.Command {
driver := &options.Driver{}
driverTypesEnum := options.NewDriverTypes()
var (
driverTypesStr []string
driverKernelRelease string
driverKernelVersion string
)
cmd := &cobra.Command{
Use: "driver",
DisableFlagsInUseLine: true,
Short: "Interact with falcosecurity driver",
Long: `Interact with falcosecurity driver.`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
opt.Initialize()
if err := config.Load(opt.ConfigFile); err != nil {
return err
}
// Override "version" flag with viper config if not set by user.
f := cmd.Flags().Lookup("version")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag version")
} else if !f.Changed && viper.IsSet(config.DriverVersionKey) {
val := viper.Get(config.DriverVersionKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite \"version\" flag: %w", err)
}
}
// Override "repo" flag with viper config if not set by user.
f = cmd.Flags().Lookup("repo")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag repo")
} else if !f.Changed && viper.IsSet(config.DriverReposKey) {
val, err := config.DriverRepos()
if err != nil {
return err
}
if err := cmd.Flags().Set(f.Name, strings.Join(val, ",")); err != nil {
return fmt.Errorf("unable to overwrite \"repo\" flag: %w", err)
}
}
// Override "name" flag with viper config if not set by user.
f = cmd.Flags().Lookup("name")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag name")
} else if !f.Changed && viper.IsSet(config.DriverNameKey) {
val := viper.Get(config.DriverNameKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite \"name\" flag: %w", err)
}
}
// Override "host-root" flag with viper config if not set by user.
f = cmd.Flags().Lookup("host-root")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag host-root")
} else if !f.Changed && viper.IsSet(config.DriverHostRootKey) {
val := viper.Get(config.DriverHostRootKey)
if err := cmd.Flags().Set(f.Name, fmt.Sprintf("%v", val)); err != nil {
return fmt.Errorf("unable to overwrite \"host-root\" flag: %w", err)
}
}
// Override "type" flag with viper config if not set by user.
f = cmd.Flags().Lookup("type")
if f == nil {
// should never happen
return fmt.Errorf("unable to retrieve flag type")
} else if !f.Changed && viper.IsSet(config.DriverTypeKey) {
val, err := config.DriverTypes()
if err != nil {
return err
}
if err := cmd.Flags().Set(f.Name, strings.Join(val, ",")); err != nil {
return fmt.Errorf("unable to overwrite \"type\" flag: %w", err)
}
}
// Logic to discover correct driver to be used
// Step 1: build up allowed driver types
allowedDriverTypes := make([]drivertype.DriverType, 0)
for _, dTypeStr := range driverTypesStr {
// Ok driver type was enforced by the user
drvType, err := drivertype.Parse(dTypeStr)
if err != nil {
return err
}
allowedDriverTypes = append(allowedDriverTypes, drvType)
opt.Printer.Logger.Debug("Allowed driver",
opt.Printer.Logger.Args("type", drvType))
}
// Step 2: fetch system info (kernel release/version and distro)
var err error
driver.Kr, err = driverkernel.FetchInfo(driverKernelRelease, driverKernelVersion)
if err != nil {
return err
}
opt.Printer.Logger.Debug("Fetched kernel info", opt.Printer.Logger.Args(
"arch", driver.Kr.Architecture.ToNonDeb(),
"kernel release", driver.Kr.String(),
"kernel version", driver.Kr.KernelVersion))
driver.Distro, err = driverdistro.Discover(driver.Kr, driver.HostRoot)
if err != nil {
if !errors.Is(err, driverdistro.ErrUnsupported) {
return err
}
opt.Printer.Logger.Debug("Detected an unsupported target system; falling back at generic logic.")
}
opt.Printer.Logger.Debug("Discovered distro", opt.Printer.Logger.Args("target", driver.Distro))
driver.Type = driver.Distro.PreferredDriver(driver.Kr, allowedDriverTypes)
if driver.Type == nil {
return fmt.Errorf("no supported driver found for distro: %s, "+
"kernelrelease %s, "+
"kernelversion %s, "+
"arch %s",
driver.Distro.String(),
driver.Kr.String(),
driver.Kr.KernelVersion,
driver.Kr.Architecture.ToNonDeb())
}
opt.Printer.Logger.Debug("Detected supported driver", opt.Printer.Logger.Args("type", driver.Type.String()))
// If empty, try to load it automatically from /usr/src sub folders,
// using the most recent (ie: the one with greatest semver) driver version.
if driver.Version == "" {
driver.Version = loadDriverVersion()
}
return driver.Validate()
},
}
cmd.PersistentFlags().StringSliceVar(&driverTypesStr, "type", config.DefaultDriver.Type,
"Driver types allowed in descending priority order "+driverTypesEnum.Allowed())
cmd.PersistentFlags().StringVar(&driver.Version, "version", config.DefaultDriver.Version, "Driver version to be used.")
cmd.PersistentFlags().StringSliceVar(&driver.Repos, "repo", config.DefaultDriver.Repos, "Driver repo to be used.")
cmd.PersistentFlags().StringVar(&driver.Name, "name", config.DefaultDriver.Name, "Driver name to be used.")
cmd.PersistentFlags().StringVar(&driver.HostRoot, "host-root", config.DefaultDriver.HostRoot, "Driver host root to be used.")
cmd.PersistentFlags().StringVar(&driverKernelRelease,
"kernelrelease",
"",
"Specify the kernel release for which to download/build the driver in the same format used by 'uname -r' "+
"(e.g. '6.1.0-10-cloud-amd64')")
cmd.PersistentFlags().StringVar(&driverKernelVersion,
"kernelversion",
"",
"Specify the kernel version for which to download/build the driver in the same format used by 'uname -v' "+
"(e.g. '#1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27)')")
cmd.AddCommand(driverinstall.NewDriverInstallCmd(ctx, opt, driver))
cmd.AddCommand(driverconfig.NewDriverConfigCmd(ctx, opt, driver))
cmd.AddCommand(drivercleanup.NewDriverCleanupCmd(ctx, opt, driver))
cmd.AddCommand(driverprintenv.NewDriverPrintenvCmd(ctx, opt, driver))
return cmd
}
func loadDriverVersion() string {
isSet := false
greatestVrs := semver.Version{}
paths, _ := filepath.Glob("/usr/src/falco-*")
for _, path := range paths {
fileInfo, err := os.Stat(path)
// We expect path to point to a folder,
// otherwise skip it.
if err != nil {
continue
}
if !fileInfo.IsDir() {
continue
}
drvVer := strings.TrimPrefix(filepath.Base(path), "falco-")
sv, err := semver.Parse(drvVer)
if err != nil {
// Not a semver; return it because we
// Won't be able to check it against semver driver versions.
return drvVer
}
if sv.GT(greatestVrs) {
greatestVrs = sv
isSet = true
}
}
if isSet {
return greatestVrs.String()
}
return ""
}

View File

@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !linux
package driver
import (
"github.com/spf13/cobra"
"golang.org/x/net/context"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
)
// NewDriverCmd returns an empty driver command since it is not supported on non linuxes
func NewDriverCmd(ctx context.Context, opt *commonoptions.Common) *cobra.Command {
return &cobra.Command{}
}

17
cmd/driver/install/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package driverinstall defines the installation logic for the driver cmd.
package driverinstall

View File

@ -0,0 +1,219 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverinstall
import (
"bytes"
"crypto/tls"
"errors"
"fmt"
"net/http"
"strings"
"time"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"golang.org/x/net/context"
driverdistro "github.com/falcosecurity/falcoctl/pkg/driver/distro"
"github.com/falcosecurity/falcoctl/pkg/options"
)
type driverDownloadOptions struct {
InsecureDownload bool
HTTPTimeout time.Duration
HTTPHeaders string
}
type driverInstallOptions struct {
*options.Common
*options.Driver
Download bool
Compile bool
DownloadHeaders bool
driverDownloadOptions
}
// NewDriverInstallCmd returns the driver install command.
func NewDriverInstallCmd(ctx context.Context, opt *options.Common, driver *options.Driver) *cobra.Command {
o := driverInstallOptions{
Common: opt,
Driver: driver,
// Defaults to downloading or building if needed
Download: true,
Compile: true,
}
cmd := &cobra.Command{
Use: "install [flags]",
DisableFlagsInUseLine: true,
Short: "Install previously configured driver",
Long: `Install previously configured driver, either downloading it or attempting a build.`,
RunE: func(cmd *cobra.Command, args []string) error {
dest, err := o.RunDriverInstall(ctx)
if dest != "" {
// We don't care about errors at this stage
// Fallback: try to load any available driver if leaving with an error.
// It is only useful for kmod, as it will try to
// modprobe a pre-existent version of the driver,
// hoping it will be compatible.
_ = driver.Type.Load(o.Printer, dest, o.Driver.Name, err != nil)
}
return err
},
}
cmd.Flags().BoolVar(&o.Download, "download", true, "Whether to enable download of prebuilt drivers")
cmd.Flags().BoolVar(&o.Compile, "compile", true, "Whether to enable local compilation of drivers")
cmd.Flags().BoolVar(&o.DownloadHeaders, "download-headers", true, "Whether to enable automatic kernel headers download where supported")
cmd.Flags().BoolVar(&o.InsecureDownload, "http-insecure", false, "Whether you want to allow insecure downloads or not")
cmd.Flags().DurationVar(&o.HTTPTimeout, "http-timeout", 60*time.Second, "Timeout for each http try")
cmd.Flags().StringVar(&o.HTTPHeaders, "http-headers",
"",
"Optional comma-separated list of headers for the http GET request "+
"(e.g. --http-headers='x-emc-namespace: default,Proxy-Authenticate: Basic'). Not necessary if default repo is used")
return cmd
}
//nolint:gosec // this was an existent option in falco-driver-loader that we are porting.
func setDefaultHTTPClientOpts(downloadOptions driverDownloadOptions) {
// Skip insecure verify
if downloadOptions.InsecureDownload {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
http.DefaultClient.Timeout = downloadOptions.HTTPTimeout
}
// RunDriverInstall implements the driver install command.
func (o *driverInstallOptions) RunDriverInstall(ctx context.Context) (string, error) {
o.Printer.Logger.Info("Running falcoctl driver install", o.Printer.Logger.Args(
"driver version", o.Driver.Version,
"driver type", o.Driver.Type,
"driver name", o.Driver.Name,
"compile", o.Compile,
"download", o.Download,
"target", o.Distro.String(),
"arch", o.Kr.Architecture.ToNonDeb(),
"kernel release", o.Kr.String(),
"kernel version", o.Kr.KernelVersion))
if !o.Driver.Type.HasArtifacts() {
o.Printer.Logger.Info("No artifacts needed for the selected driver.")
return "", nil
}
if !o.Download && !o.Compile {
o.Printer.Logger.Info("Nothing to do: download and compile disabled.")
return "", nil
}
if o.Distro.String() == driverdistro.UndeterminedDistro {
if o.Compile {
o.Download = false
o.Printer.Logger.Info(
"Detected an unsupported target system, please get in touch with the Falco community. Trying to compile anyway.")
} else {
return "", fmt.Errorf("detected an unsupported target system, please get in touch with the Falco community")
}
}
var (
dest string
buf bytes.Buffer
)
if !o.Printer.DisableStyling {
o.Printer.Spinner, _ = o.Printer.Spinner.Start("Cleaning up existing drivers")
}
err := o.Driver.Type.Cleanup(o.Printer.WithWriter(&buf), o.Driver.Name)
if o.Printer.Spinner != nil {
_ = o.Printer.Spinner.Stop()
}
if o.Printer.Logger.Formatter == pterm.LogFormatterJSON {
// Only print formatted text if we are formatting to json
out := strings.ReplaceAll(buf.String(), "\n", ";")
o.Printer.Logger.Info("Driver cleanup", o.Printer.Logger.Args("output", out))
} else {
// Print much more readable output as-is
o.Printer.DefaultText.Print(buf.String())
}
buf.Reset()
if err != nil {
return "", err
}
if o.Download {
setDefaultHTTPClientOpts(o.driverDownloadOptions)
if !o.Printer.DisableStyling {
o.Printer.Spinner, _ = o.Printer.Spinner.Start("Trying to download the driver")
}
dest, err = driverdistro.Download(ctx, o.Distro, o.Printer.WithWriter(&buf), o.Kr, o.Driver.Name,
o.Driver.Type, o.Driver.Version, o.Driver.Repos, o.HTTPHeaders)
if o.Printer.Spinner != nil {
_ = o.Printer.Spinner.Stop()
}
if o.Printer.Logger.Formatter == pterm.LogFormatterJSON {
// Only print formatted text if we are formatting to json
out := strings.ReplaceAll(buf.String(), "\n", ";")
o.Printer.Logger.Info("Driver download", o.Printer.Logger.Args("output", out))
} else {
// Print much more readable output as-is
o.Printer.DefaultText.Print(buf.String())
}
buf.Reset()
if err == nil {
o.Printer.Logger.Info("Driver downloaded.", o.Printer.Logger.Args("path", dest))
return dest, nil
}
if errors.Is(err, driverdistro.ErrAlreadyPresent) {
o.Printer.Logger.Info("Skipping download, driver already present.", o.Printer.Logger.Args("path", dest))
return dest, nil
}
// Print the error but go on
// attempting a build if requested
if o.Compile {
o.Printer.Logger.Warn(err.Error())
}
}
if o.Compile {
if !o.Printer.DisableStyling {
o.Printer.Spinner, _ = o.Printer.Spinner.Start("Trying to build the driver")
}
dest, err = driverdistro.Build(ctx, o.Distro, o.Printer.WithWriter(&buf), o.Kr, o.Driver.Name, o.Driver.Type, o.Driver.Version, o.DownloadHeaders)
if o.Printer.Spinner != nil {
_ = o.Printer.Spinner.Stop()
}
if o.Printer.Logger.Formatter == pterm.LogFormatterJSON {
// Only print formatted text if we are formatting to json
out := strings.ReplaceAll(buf.String(), "\n", ";")
o.Printer.Logger.Info("Driver build", o.Printer.Logger.Args("output", out))
} else {
// Print much more readable output as-is
o.Printer.DefaultText.Print(buf.String())
}
buf.Reset()
if err == nil {
return dest, nil
}
if errors.Is(err, driverdistro.ErrAlreadyPresent) {
o.Printer.Logger.Info("Skipping build, driver already present.", o.Printer.Logger.Args("path", dest))
return dest, nil
}
}
return o.Driver.Name, fmt.Errorf("failed: %w", err)
}

View File

@ -0,0 +1,69 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverinstall_test
import (
"context"
"os"
"path/filepath"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
var (
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
configFile string
err error
args []string
)
func TestInstall(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Install Suite")
}
var _ = BeforeSuite(func() {
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,130 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverinstall_test
import (
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
//nolint:lll // no need to check for line length.
var driverInstallHelp = `Install previously configured driver, either downloading it or attempting a build.
Usage:
falcoctl driver install [flags]
Flags:
--compile Whether to enable local compilation of drivers (default true)
--download Whether to enable download of prebuilt drivers (default true)
--download-headers Whether to enable automatic kernel headers download where supported (default true)
-h, --help help for install
--http-headers string Optional comma-separated list of headers for the http GET request (e.g. --http-headers='x-emc-namespace: default,Proxy-Authenticate: Basic'). Not necessary if default repo is used
--http-insecure Whether you want to allow insecure downloads or not
--http-timeout duration Timeout for each http try (default 1m0s)
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--host-root string Driver host root to be used. (default "/")
--kernelrelease string Specify the kernel release for which to download/build the driver in the same format used by 'uname -r' (e.g. '6.1.0-10-cloud-amd64')
--kernelversion string Specify the kernel version for which to download/build the driver in the same format used by 'uname -v' (e.g. '#1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27)')
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
--name string Driver name to be used. (default "falco")
--repo strings Driver repo to be used. (default [https://download.falco.org/driver])
--type strings Driver types allowed in descending priority order (ebpf, kmod, modern_ebpf) (default [modern_ebpf,kmod,ebpf])
--version string Driver version to be used.
`
var addAssertFailedBehavior = func(specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
var addAssertOkBehavior = func(specificOut string) {
It("check that does not fail and the usage is not printed", func() {
Succeed()
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificOut)))
})
}
var _ = Describe("install", func() {
var (
driverCmd = "driver"
installCmd = "install"
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{driverCmd, installCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(driverInstallHelp)))
})
})
// Here we are testing failure cases for installing a driver.
Context("failure", func() {
When("with empty driver version", func() {
BeforeEach(func() {
args = []string{driverCmd, installCmd, "--config", configFile}
})
addAssertFailedBehavior(`ERROR version is mandatory and cannot be empty`)
})
When("with non absolute host-root", func() {
BeforeEach(func() {
args = []string{driverCmd, installCmd, "--config", configFile, "--host-root", "foo/", "--version", "1.0.0+driver"}
})
addAssertFailedBehavior("ERROR host-root must be an absolute path (foo/)")
})
When("with invalid driver type", func() {
BeforeEach(func() {
args = []string{driverCmd, installCmd, "--config", configFile, "--type", "foo", "--version", "1.0.0+driver"}
})
addAssertFailedBehavior(`ERROR unsupported driver type specified: foo`)
})
})
Context("nothing-to-do", func() {
When("with false download and compile", func() {
BeforeEach(func() {
args = []string{driverCmd, installCmd, "--config", configFile, "--download=false", "--compile=false", "--version", "1.0.0+driver"}
})
addAssertOkBehavior("INFO Nothing to do: download and compile disabled.")
})
})
})

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package driverprintenv defines the logic to print driver-related variables as env vars.
package driverprintenv

View File

@ -0,0 +1,65 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverprintenv
import (
"strings"
"github.com/spf13/cobra"
"golang.org/x/net/context"
"github.com/falcosecurity/falcoctl/pkg/options"
)
type driverPrintenvOptions struct {
*options.Common
*options.Driver
}
// NewDriverPrintenvCmd print info about driver falcoctl config as env vars.
func NewDriverPrintenvCmd(ctx context.Context, opt *options.Common, driver *options.Driver) *cobra.Command {
o := driverPrintenvOptions{
Common: opt,
Driver: driver,
}
cmd := &cobra.Command{
Use: "printenv [flags]",
DisableFlagsInUseLine: true,
Short: "Print env vars",
Long: `Print variables used by driver as env vars.`,
RunE: func(_ *cobra.Command, _ []string) error {
return o.RunDriverPrintenv(ctx)
},
}
return cmd
}
func (o *driverPrintenvOptions) RunDriverPrintenv(_ context.Context) error {
o.Printer.DefaultText.Printf("DRIVER=%q\n", o.Driver.Type.String())
o.Printer.DefaultText.Printf("DRIVERS_REPO=%q\n", strings.Join(o.Driver.Repos, ", "))
o.Printer.DefaultText.Printf("DRIVER_VERSION=%q\n", o.Driver.Version)
o.Printer.DefaultText.Printf("DRIVER_NAME=%q\n", o.Driver.Name)
o.Printer.DefaultText.Printf("HOST_ROOT=%q\n", o.Driver.HostRoot)
o.Printer.DefaultText.Printf("TARGET_ID=%q\n", o.Distro.String())
o.Printer.DefaultText.Printf("ARCH=%q\n", o.Kr.Architecture.ToNonDeb())
o.Printer.DefaultText.Printf("KERNEL_RELEASE=%q\n", o.Kr.String())
o.Printer.DefaultText.Printf("KERNEL_VERSION=%q\n", o.Kr.KernelVersion)
fixedKr := o.Distro.FixupKernel(o.Kr)
o.Printer.DefaultText.Printf("FIXED_KERNEL_RELEASE=%q\n", fixedKr.String())
o.Printer.DefaultText.Printf("FIXED_KERNEL_VERSION=%q\n", fixedKr.KernelVersion)
return nil
}

View File

@ -0,0 +1,69 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverprintenv_test
import (
"context"
"os"
"path/filepath"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
var (
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
configFile string
err error
args []string
)
func TestPrintenv(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Printenv Suite")
}
var _ = BeforeSuite(func() {
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,146 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package driverprintenv_test
import (
"bufio"
"os"
"regexp"
"strings"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
//nolint:lll // no need to check for line length.
var driverPrintenvHelp = `Print variables used by driver as env vars.
Usage:
falcoctl driver printenv [flags]
Flags:
-h, --help help for printenv
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--host-root string Driver host root to be used. (default "/")
--kernelrelease string Specify the kernel release for which to download/build the driver in the same format used by 'uname -r' (e.g. '6.1.0-10-cloud-amd64')
--kernelversion string Specify the kernel version for which to download/build the driver in the same format used by 'uname -v' (e.g. '#1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27)')
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
--name string Driver name to be used. (default "falco")
--repo strings Driver repo to be used. (default [https://download.falco.org/driver])
--type strings Driver types allowed in descending priority order (ebpf, kmod, modern_ebpf) (default [modern_ebpf,kmod,ebpf])
--version string Driver version to be used.
`
var driverPrintenvDefaultConfig = `DRIVER=".*"
DRIVERS_REPO="https:\/\/download\.falco\.org\/driver"
DRIVER_VERSION="1.0.0\+driver"
DRIVER_NAME="falco"
HOST_ROOT="\/"
TARGET_ID=".*"
ARCH="x86_64|aarch64"
KERNEL_RELEASE=".*"
KERNEL_VERSION=".*"
FIXED_KERNEL_RELEASE=".*"
FIXED_KERNEL_VERSION=".*"
`
var addAssertFailedBehavior = func(specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
var _ = Describe("printenv", func() {
var (
driverCmd = "driver"
printenvCmd = "printenv"
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{driverCmd, printenvCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(driverPrintenvHelp)))
})
})
// Here we are testing failure cases for cleaning a driver.
Context("failure", func() {
When("with empty driver version", func() {
BeforeEach(func() {
args = []string{driverCmd, printenvCmd, "--config", configFile}
})
addAssertFailedBehavior(`ERROR version is mandatory and cannot be empty `)
})
When("with non absolute host-root", func() {
BeforeEach(func() {
args = []string{driverCmd, printenvCmd, "--config", configFile, "--host-root", "foo/", "--version", "1.0.0+driver"}
})
addAssertFailedBehavior("ERROR host-root must be an absolute path (foo/)")
})
When("with invalid driver type", func() {
BeforeEach(func() {
args = []string{driverCmd, printenvCmd, "--config", configFile, "--type", "foo", "--version", "1.0.0+driver"}
})
addAssertFailedBehavior(`unsupported driver type specified: foo`)
})
})
Context("success", func() {
When("with default config values", func() {
BeforeEach(func() {
args = []string{driverCmd, printenvCmd, "--config", configFile, "--version", "1.0.0+driver"}
})
It("should match the saved one", func() {
Succeed()
MatchRegexp(driverPrintenvDefaultConfig)
Expect(string(output.Contents())).To(MatchRegexp(driverPrintenvDefaultConfig))
// Expect that output is bash setenv compatible
scanner := bufio.NewScanner(output)
for scanner.Scan() {
vals := strings.Split(scanner.Text(), "=")
Expect(vals).Should(HaveLen(2))
err := os.Setenv(vals[0], vals[1])
Expect(err).Should(BeNil())
}
})
})
})
})

View File

@ -1,76 +0,0 @@
/*
Copyright © 2019 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"os"
"k8s.io/cli-runtime/pkg/genericclioptions"
kubernetesfalc "github.com/falcosecurity/falcoctl/pkg/kubernetes"
"github.com/falcosecurity/falcoctl/pkg/kubernetes/factory"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
)
// FalcoDeleteOptions represents the `delete falco` command options
type FalcoDeleteOptions struct {
genericclioptions.IOStreams
daemonSetName string
}
// Validate validates the `delete falco` command options
func (o FalcoDeleteOptions) Validate(c *cobra.Command, args []string) error {
return nil
}
// NewFalcoDeleteOptions instantiates the `delete falco` command options
func NewFalcoDeleteOptions(streams genericclioptions.IOStreams) CommandOptions {
return &FalcoDeleteOptions{
IOStreams: streams,
}
}
// NewFalcoDeleteCommand creates the `delete falco` command
func NewFalcoDeleteCommand(streams genericclioptions.IOStreams, f factory.Factory) *cobra.Command {
o := NewFalcoDeleteOptions(streams).(*FalcoDeleteOptions)
cmd := &cobra.Command{
Use: "falco",
DisableFlagsInUseLine: true,
Short: "Delete Falco from Kubernetes",
Long: `Delete Falco from Kubernetes`,
Run: func(cmd *cobra.Command, args []string) {
// todo > pass daemonset name using o.daemonSetName
installer, err := kubernetesfalc.NewFalcoInstaller(f)
if err != nil {
logger.Critical("Fatal error: %v", err)
os.Exit(1)
}
err = installer.Delete()
if err != nil {
logger.Critical("Fatal error: %v", err)
os.Exit(1)
}
},
}
cmd.Flags().StringVarP(&o.daemonSetName, "daemonset-name", "D", o.daemonSetName, "Set the name to use with the Falco DaemonSet")
return cmd
}

View File

@ -1,76 +0,0 @@
/*
Copyright © 2019 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"os"
kubernetesfalc "github.com/falcosecurity/falcoctl/pkg/kubernetes"
"github.com/falcosecurity/falcoctl/pkg/kubernetes/factory"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// FalcoInstallOptions represents the `install falco` command options
type FalcoInstallOptions struct {
genericclioptions.IOStreams
daemonSetName string
}
// Validate validates the `install falco` command options
func (o FalcoInstallOptions) Validate(c *cobra.Command, args []string) error {
return nil
}
// NewFalcoInstallOptions instantiates the `install falco` command options
func NewFalcoInstallOptions(streams genericclioptions.IOStreams) CommandOptions {
return &FalcoInstallOptions{
IOStreams: streams,
}
}
// NewFalcoInstallCommand creates the `install falco` command
func NewFalcoInstallCommand(streams genericclioptions.IOStreams, f factory.Factory) *cobra.Command {
o := NewFalcoInstallOptions(streams).(*FalcoInstallOptions)
cmd := &cobra.Command{
Use: "falco",
TraverseChildren: true,
DisableFlagsInUseLine: true,
Short: "Install Falco in Kubernetes",
Long: `Deploy Falco to Kubernetes`,
Run: func(cmd *cobra.Command, args []string) {
// todo > pass daemonset name using o.daemonSetName
installer, err := kubernetesfalc.NewFalcoInstaller(f)
if err != nil {
logger.Critical("Fatal error: %v", err)
os.Exit(1)
}
err = installer.Install()
if err != nil {
logger.Critical("Fatal error: %v", err)
os.Exit(1)
}
},
}
cmd.Flags().StringVarP(&o.daemonSetName, "daemonset-name", "D", o.daemonSetName, "Set the name to use with the Falco DaemonSet")
return cmd
}

95
cmd/index/add/add.go Normal file
View File

@ -0,0 +1,95 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package add
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/pkg/index/cache"
"github.com/falcosecurity/falcoctl/pkg/options"
)
// IndexAddOptions contains the options for the index add command.
type IndexAddOptions struct {
*options.Common
}
// NewIndexAddCmd returns the index add command.
func NewIndexAddCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := IndexAddOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: "add [NAME] [URL] [BACKEND] [flags]",
DisableFlagsInUseLine: true,
Short: "Add an index to the local falcoctl configuration",
Long: "Add an index to the local falcoctl configuration. Indexes are used to perform search operations for artifacts",
Args: cobra.RangeArgs(2, 3),
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunIndexAdd(ctx, args)
},
}
return cmd
}
// RunIndexAdd implements the index add command.
func (o *IndexAddOptions) RunIndexAdd(ctx context.Context, args []string) error {
var err error
logger := o.Printer.Logger
name := args[0]
url := args[1]
backend := ""
if len(args) > 2 {
backend = args[2]
}
logger.Debug("Creating in-memory cache using", logger.Args("indexes file", config.IndexesFile, "indexes directory", config.IndexesDir))
indexCache, err := cache.New(ctx, config.IndexesFile, config.IndexesDir)
if err != nil {
return fmt.Errorf("unable to create index cache: %w", err)
}
logger.Info("Adding index", logger.Args("name", name, "path", url))
if err = indexCache.Add(ctx, name, backend, url); err != nil {
return fmt.Errorf("unable to add index: %w", err)
}
logger.Debug("Writing cache to disk")
if _, err = indexCache.Write(); err != nil {
return fmt.Errorf("unable to write cache to disk: %w", err)
}
logger.Debug("Adding new index entry to configuration", logger.Args("file", o.ConfigFile))
if err = config.AddIndexes([]config.Index{{
Name: name,
URL: url,
Backend: backend,
}}, o.ConfigFile); err != nil {
return fmt.Errorf("index entry %q: %w", name, err)
}
logger.Info("Index successfully added")
return nil
}

View File

@ -0,0 +1,87 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package add_test
import (
"context"
"fmt"
"os"
"path/filepath"
"testing"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"oras.land/oras-go/v2/registry/remote"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
//nolint:unused // false positive
const (
rulesfiletgz = "../../../pkg/test/data/rules.tar.gz"
rulesfileyaml = "../../../pkg/test/data/rules.yaml"
plugintgz = "../../../pkg/test/data/plugin.tar.gz"
)
//nolint:unused // false positive
var (
registry string
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
port int
orasRegistry *remote.Registry
configFile string
err error
args []string
)
func TestAdd(t *testing.T) {
RegisterFailHandler(Fail)
port, err = testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
registry = fmt.Sprintf("localhost:%d", port)
RunSpecs(t, "Add Suite")
}
var _ = BeforeSuite(func() {
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
//nolint:unused // false positive
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

121
cmd/index/add/add_test.go Normal file
View File

@ -0,0 +1,121 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package add_test
import (
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
//nolint:lll // no need to check for line length.
var indexAddUsage = `Usage:
falcoctl index add [NAME] [URL] [BACKEND] [flags]
Flags:
-h, --help help for add
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
//nolint:lll // no need to check for line length.
var indexAddHelp = `Add an index to the local falcoctl configuration. Indexes are used to perform search operations for artifacts
Usage:
falcoctl index add [NAME] [URL] [BACKEND] [flags]
Flags:
-h, --help help for add
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
var addAssertFailedBehavior = func(usage, specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(usage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
var indexAddTests = Describe("add", func() {
var (
indexCmd = "index"
addCmd = "add"
indexName = "testName"
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{indexCmd, addCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(indexAddHelp)))
})
})
// Here we are testing failure cases for adding a new index.
Context("failure", func() {
When("without URL", func() {
BeforeEach(func() {
args = []string{indexCmd, addCmd, "--config", configFile, indexName}
})
addAssertFailedBehavior(indexAddUsage, "ERROR accepts between 2 and 3 arg(s), received 1")
})
When("with invalid URL", func() {
BeforeEach(func() {
args = []string{indexCmd, addCmd, "--config", configFile, indexName, "NOTAPROTOCAL://something"}
})
addAssertFailedBehavior(indexAddUsage, "ERROR unable to add index: unable to fetch index \"testName\""+
" with URL \"NOTAPROTOCAL://something\": unable to fetch index: cannot fetch index: Get "+
"\"notaprotocal://something\": unsupported protocol scheme \"notaprotocal\"")
})
When("with invalid backend", func() {
BeforeEach(func() {
args = []string{indexCmd, addCmd, "--config", configFile, indexName, "http://noindex", "notabackend"}
})
addAssertFailedBehavior(indexAddUsage, "ERROR unable to add index: unable to fetch index \"testName\" "+
"with URL \"http://noindex\": unsupported index backend type: notabackend")
})
})
})

17
cmd/index/add/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package add defines the options and add logic for the index files.
package add

17
cmd/index/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package index implements the index commands.
package index

50
cmd/index/index.go Normal file
View File

@ -0,0 +1,50 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package index
import (
"context"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/cmd/index/add"
"github.com/falcosecurity/falcoctl/cmd/index/list"
"github.com/falcosecurity/falcoctl/cmd/index/remove"
"github.com/falcosecurity/falcoctl/cmd/index/update"
"github.com/falcosecurity/falcoctl/internal/config"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
)
// NewIndexCmd returns the index command.
func NewIndexCmd(ctx context.Context, opt *commonoptions.Common) *cobra.Command {
cmd := &cobra.Command{
Use: "index",
DisableFlagsInUseLine: true,
Short: "Interact with index",
Long: "Interact with index",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
opt.Initialize()
return config.Load(opt.ConfigFile)
},
}
cmd.AddCommand(add.NewIndexAddCmd(ctx, opt))
cmd.AddCommand(remove.NewIndexRemoveCmd(ctx, opt))
cmd.AddCommand(update.NewIndexUpdateCmd(ctx, opt))
cmd.AddCommand(list.NewIndexListCmd(ctx, opt))
return cmd
}

17
cmd/index/list/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package list defines the logic to list the already configured index files.
package list

67
cmd/index/list/list.go Normal file
View File

@ -0,0 +1,67 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package list
import (
"context"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/internal/config"
indexConf "github.com/falcosecurity/falcoctl/pkg/index/config"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
type indexListOptions struct {
*options.Common
}
// NewIndexListCmd returns the index list command.
func NewIndexListCmd(_ context.Context, opt *options.Common) *cobra.Command {
o := indexListOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: "list [flags]",
DisableFlagsInUseLine: true,
Short: "List all the added indexes",
Long: "List all the added indexes that were configured in falcoctl",
Args: cobra.ExactArgs(0),
Aliases: []string{"ls"},
RunE: func(cmd *cobra.Command, _ []string) error {
return o.RunIndexList()
},
}
return cmd
}
func (o *indexListOptions) RunIndexList() error {
indexConfig, err := indexConf.New(config.IndexesFile)
if err != nil {
return err
}
var data [][]string
for _, conf := range indexConfig.Configs {
newEntry := []string{conf.Name, conf.URL, conf.AddedTimestamp, conf.UpdatedTimestamp}
data = append(data, newEntry)
}
return o.Printer.PrintTable(output.IndexList, data)
}

17
cmd/index/remove/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package remove defines options and logic to remove a previously add index file.
package remove

View File

@ -0,0 +1,83 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package remove
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/pkg/index/cache"
"github.com/falcosecurity/falcoctl/pkg/options"
)
type indexRemoveOptions struct {
*options.Common
}
// NewIndexRemoveCmd returns the index remove command.
func NewIndexRemoveCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := indexRemoveOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: "remove [INDEX1 [INDEX2 ...]] [flags]",
DisableFlagsInUseLine: true,
Short: "Remove an index from the local falcoctl configuration",
Long: "Remove an index from the local falcoctl configuration",
Args: cobra.MinimumNArgs(1),
Aliases: []string{"rm"},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunIndexRemove(ctx, args)
},
}
return cmd
}
func (o *indexRemoveOptions) RunIndexRemove(ctx context.Context, args []string) error {
logger := o.Printer.Logger
logger.Debug("Creating in-memory cache using", logger.Args("indexes file", config.IndexesFile, "indexes directory", config.IndexesDir))
indexCache, err := cache.New(ctx, config.IndexesFile, config.IndexesDir)
if err != nil {
return fmt.Errorf("unable to create index cache: %w", err)
}
for _, name := range args {
logger.Info("Removing index", logger.Args("name", name))
if err = indexCache.Remove(name); err != nil {
return fmt.Errorf("unable to remove index: %w", err)
}
}
logger.Debug("Writing cache to disk")
if _, err = indexCache.Write(); err != nil {
return fmt.Errorf("unable to write cache to disk: %w", err)
}
logger.Debug("Removing indexes entries from configuration", logger.Args("file", o.ConfigFile))
if err = config.RemoveIndexes(args, o.ConfigFile); err != nil {
return err
}
logger.Info("Indexes successfully removed")
return nil
}

17
cmd/index/update/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package update defines options and logic to update the index files.
package update

View File

@ -0,0 +1,77 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package update
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/pkg/index/cache"
"github.com/falcosecurity/falcoctl/pkg/options"
)
type indexUpdateOptions struct {
*options.Common
}
// NewIndexUpdateCmd returns the index update command.
func NewIndexUpdateCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := indexUpdateOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: "update [INDEX1 [INDEX2 ...]] [flags]",
DisableFlagsInUseLine: true,
Short: "Update an existing index",
Long: "Update an existing index",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunIndexUpdate(ctx, args)
},
}
return cmd
}
func (o *indexUpdateOptions) RunIndexUpdate(ctx context.Context, args []string) error {
logger := o.Printer.Logger
logger.Debug("Creating in-memory cache using", logger.Args("indexes file", config.IndexesFile, "indexes directory", config.IndexesDir))
indexCache, err := cache.New(ctx, config.IndexesFile, config.IndexesDir)
if err != nil {
return fmt.Errorf("unable to create index cache: %w", err)
}
for _, arg := range args {
logger.Info("Updating index file", logger.Args("name", arg))
if err := indexCache.Update(ctx, arg); err != nil {
return fmt.Errorf("an error occurred while updating index %q: %w", arg, err)
}
}
logger.Debug("Writing cache to disk")
if _, err = indexCache.Write(); err != nil {
return fmt.Errorf("unable to write cache to disk: %w", err)
}
logger.Info("Indexes successfully updated")
return nil
}

View File

@ -1,58 +0,0 @@
/*
Copyright © 2019 The Falco Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"github.com/falcosecurity/falcoctl/pkg/kubernetes/factory"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// InstallOptions represents the install command options
type InstallOptions struct {
genericclioptions.IOStreams
}
// Validate validates the `install` command options
func (o InstallOptions) Validate(c *cobra.Command, args []string) error {
return nil
}
// NewInstallOptions instantiates the `install` command options
func NewInstallOptions(streams genericclioptions.IOStreams) CommandOptions {
return &InstallOptions{
IOStreams: streams,
}
}
// NewInstallCommand creates the `install` command
func NewInstallCommand(streams genericclioptions.IOStreams, f factory.Factory) *cobra.Command {
// o := NewInstallOptions(streams).(*InstallOptions)
cmd := &cobra.Command{
Use: "install",
TraverseChildren: true,
DisableFlagsInUseLine: true,
Short: "Install a component wih falcoctl",
Long: `Install a component wih falcoctl`,
}
cmd.AddCommand(NewFalcoInstallCommand(streams, f))
cmd.AddCommand(NewProbeInstallCommand(streams))
return cmd
}

View File

@ -1,28 +0,0 @@
/*
Copyright © 2019 The Falco Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"github.com/spf13/cobra"
)
// CommandOptions is ...
type CommandOptions interface {
Validate(*cobra.Command, []string) error
// Complete(factory.Factory, *cobra.Command, []string) error
// Run() error
}

View File

@ -1,42 +0,0 @@
// +build !linux
/*
Copyright © 2019 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// NewProbeInstallCommand creates the `install probe` command
func NewProbeInstallCommand(streams genericclioptions.IOStreams) *cobra.Command {
cmd := &cobra.Command{
Use: "probe",
DisableFlagsInUseLine: true,
Short: "Install the Falco probe locally (linux only)",
Long: `Download and install the Falco module locally`,
RunE: func(cmd *cobra.Command, args []string) error {
logger.Critical("this command only works on machines running a linux kernel")
return nil
},
}
return cmd
}

View File

@ -1,136 +0,0 @@
/*
Copyright © 2019 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"fmt"
"os"
"path"
"github.com/falcosecurity/falcoctl/pkg/probeloader"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// ProbeInstallOptions represents the `install probe` command options
type ProbeInstallOptions struct {
genericclioptions.IOStreams
falcoVersion string
falcoProbePath string
falcoProbeFile string
falcoProbeURL string
falcoProbeRepo string
}
// Validate validates the `install probe` command options
func (o ProbeInstallOptions) Validate(c *cobra.Command, args []string) error {
if len(o.falcoVersion) == 0 {
return fmt.Errorf("missing Falco version: specify it via FALCOCTL_FALCO_VERSION env variable or via --falco-version flag")
}
return nil
}
// NewProbeInstallOptions instantiates the `install probe` command options
func NewProbeInstallOptions(streams genericclioptions.IOStreams) CommandOptions {
o := &ProbeInstallOptions{
IOStreams: streams,
}
o.falcoVersion = viper.GetString("falco-version") // FALCOCTL_FALCO_VERSION env var
o.falcoProbePath = viper.GetString("falco-probe-path") // FALCOCTL_FALCO_PROBE_PATH env var
if len(o.falcoProbePath) == 0 {
o.falcoProbePath = "/" // default
}
o.falcoProbeFile = viper.GetString("falco-probe-file") // FALCOCTL_FALCO_PROBE_FILE env var
if len(o.falcoProbeFile) == 0 {
o.falcoProbeFile = "falco-probe.ko" // default
}
o.falcoProbeURL = viper.GetString("falco-probe-url") // FALCOCTL_FALCO_PROBE_URL env var
o.falcoProbeRepo = viper.GetString("falco-probe-repo") // FALCOCTL_FALCO_PROBE_REPO env var
if len(o.falcoProbeRepo) == 0 {
o.falcoProbeRepo = "https://s3.amazonaws.com/download.draios.com/stable/sysdig-probe-binaries/" // default
}
return o
}
// NewProbeInstallCommand creates the `install probe` command
func NewProbeInstallCommand(streams genericclioptions.IOStreams) *cobra.Command {
o := NewProbeInstallOptions(streams).(*ProbeInstallOptions)
cmd := &cobra.Command{
Use: "probe",
DisableFlagsInUseLine: true,
Short: "Install the Falco probe locally",
Long: `Download and install the Falco module locally`,
PreRun: func(cmd *cobra.Command, args []string) {
if err := o.Validate(cmd, args); err != nil {
logger.Critical("%s", err)
os.Exit(1)
}
},
RunE: func(cmd *cobra.Command, args []string) error {
falcoProbeFullpath := path.Join(o.falcoProbePath, o.falcoProbeFile)
falcoConfigHash, err := probeloader.GetKernelConfigHash()
if err != nil {
logger.Critical("Error getting Kernel Config Hash: %s", err)
return err
}
falcoKernelRelease, err := probeloader.GetKernelRelease()
if err != nil {
logger.Critical("Error getting Kernel Version: %s", err)
return err
}
logger.Always("FALCO_VERSION: %s", o.falcoVersion)
logger.Always("FALCO_PROBE_URL: %s", o.falcoProbeURL)
logger.Always("FALCO_PROBE_REPO: %s", o.falcoProbeRepo)
logger.Always("KERNEL_VERSION: %s", falcoKernelRelease)
logger.Always("KERNEL_CONFIG_HASH: %s", falcoConfigHash)
// if FALCO_PROBE_URL not set, build it
if o.falcoProbeURL == "" {
o.falcoProbeURL = fmt.Sprintf("%sfalco-probe-%s-x86_64-%s-%s.ko", o.falcoProbeRepo, o.falcoVersion, falcoKernelRelease, falcoConfigHash)
}
// fetch module
err = probeloader.FetchModule(o.falcoProbeURL, falcoProbeFullpath)
if err != nil {
logger.Critical("Error fetching module: %s", err)
return err
}
// load module
// TODO(ducy): Need to implement removal of module, retry loop, and timeout
err = probeloader.LoadModule(falcoProbeFullpath)
if err != nil {
logger.Critical("Error loading module: %s", err)
return err
}
return nil
},
}
// TODO(fntlnz, leodido): validation
cmd.Flags().StringVar(&o.falcoVersion, "falco-version", o.falcoVersion, "The falco version for which to download the probe")
cmd.Flags().StringVar(&o.falcoProbePath, "falco-probe-path", o.falcoProbePath, "The path where to download the falco probe")
cmd.Flags().StringVar(&o.falcoProbeFile, "falco-probe-file", o.falcoProbeFile, "The name of the falco probe file")
cmd.Flags().StringVar(&o.falcoProbeURL, "falco-probe-url", o.falcoProbeURL, "The direct URL where to download the falco probe from, alternative to the repo, not the default, this skips the search since a direct url is provided")
cmd.Flags().StringVar(&o.falcoProbeRepo, "falco-probe-repo", o.falcoProbeRepo, "The URL of the s3 repo where to search for the probe")
return cmd
}

View File

@ -1,132 +0,0 @@
/*
Copyright © 2019 The Falco Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd
import (
"fmt"
"os"
converter "github.com/falcosecurity/falcoctl/pkg/converter/psp"
"github.com/kris-nova/logger"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"io/ioutil"
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// PspRulesConvOptions represents options for PSP to Falco rules conversion
type PspRulesConvOptions struct {
genericclioptions.IOStreams
pspPath string
rulesPath string
}
// Validate options to psp_conv command
func (o PspRulesConvOptions) Validate(c *cobra.Command, args []string) error {
if o.pspPath == "" {
return fmt.Errorf("--psp-path must be provided")
}
if o.rulesPath == "" {
return fmt.Errorf("--rules-path must be provided")
}
return nil
}
// NewPspRulesConvOptions instantiates PspRulesConvOptions
func NewPspRulesConvOptions(streams genericclioptions.IOStreams) CommandOptions {
o := &PspRulesConvOptions{
IOStreams: streams,
}
o.pspPath = viper.GetString("psp-path") // FALCOCTL_PSP_PATH env var
o.rulesPath = viper.GetString("rules-path") // FALCOCTL_RULES_PATH env var
if len(o.rulesPath) == 0 {
o.rulesPath = "./psp_falco_rules.yaml" // default
}
return o
}
func debugLog(format string, args ...interface{}) {
logger.Debug(format, args)
}
func infoLog(format string, args ...interface{}) {
logger.Info(format, args)
}
func errorLog(format string, args ...interface{}) {
logger.Critical(format, args)
}
func convertPspFalcoRules(pspPath string, rulesPath string) error {
pspFile, err := os.Open(pspPath)
if err != nil {
return fmt.Errorf("Could not open PSP file for reading: %s", pspPath)
}
defer pspFile.Close()
logger.Debug("Reading PSP from %s", pspPath)
psp, err := ioutil.ReadAll(pspFile)
conv, err := converter.NewConverter(debugLog, infoLog, errorLog)
if err != nil {
return fmt.Errorf("Could not create converter: %v", err)
}
rules, err := conv.GenerateRules("", string(psp))
if err != nil {
return fmt.Errorf("Could not convert psp file to falco rules: %v", err)
}
err = ioutil.WriteFile(rulesPath, []byte(rules), 0644)
logger.Debug("Wrote rules to %s", rulesPath)
return nil
}
// NewPspRulesConvCommand instantiates the `convert psp` command
func NewPspRulesConvCommand(streams genericclioptions.IOStreams) *cobra.Command {
o := NewPspRulesConvOptions(streams).(*PspRulesConvOptions)
cmd := &cobra.Command{
Use: "psp",
Short: "Convert a PSP to a set of Falco Rules",
Long: `Convert a K8s Pod Security Policy (PSP), provided via the --psp-path argument, to a set of Falco rules that can evaluate the conditions in the PSP.
The resulting rules are written to the file provided by the --rules-path argument`,
PreRun: func(cmd *cobra.Command, args []string) {
if err := o.Validate(cmd, args); err != nil {
logger.Critical("%s", err)
os.Exit(1)
}
},
Run: func(cmd *cobra.Command, args []string) {
if err := convertPspFalcoRules(o.pspPath, o.rulesPath); err != nil {
logger.Critical("%s", err)
os.Exit(1)
}
},
}
cmd.Flags().StringVarP(&o.pspPath, "psp-path", "P", o.pspPath, "Path to PSP as YAML file")
cmd.Flags().StringVarP(&o.rulesPath, "rules-path", "R", o.rulesPath, "Write converted rules to this file")
return cmd
}

43
cmd/registry/auth/auth.go Normal file
View File

@ -0,0 +1,43 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package auth
import (
"context"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/cmd/registry/auth/basic"
"github.com/falcosecurity/falcoctl/cmd/registry/auth/gcp"
"github.com/falcosecurity/falcoctl/cmd/registry/auth/oauth"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
)
// NewAuthCmd returns the registry command.
func NewAuthCmd(ctx context.Context, opt *commonoptions.Common) *cobra.Command {
cmd := &cobra.Command{
Use: "auth",
DisableFlagsInUseLine: true,
Short: "Handle authentication towards OCI registries",
Long: "Handle authentication towards OCI registries",
}
cmd.AddCommand(basic.NewBasicCmd(ctx, opt))
cmd.AddCommand(oauth.NewOauthCmd(ctx, opt))
cmd.AddCommand(gcp.NewGcpCmd(ctx, opt))
return cmd
}

View File

@ -0,0 +1,162 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package basic
import (
"bufio"
"context"
"fmt"
"io"
"os"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/term"
"oras.land/oras-go/v2/registry/remote/credentials"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/internal/login/basic"
"github.com/falcosecurity/falcoctl/internal/utils"
"github.com/falcosecurity/falcoctl/pkg/oci/authn"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
type loginOptions struct {
*options.Common
username string
password string
passwordFromStdin bool
}
// NewBasicCmd returns the basic command.
func NewBasicCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := loginOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: "basic [hostname]",
DisableFlagsInUseLine: true,
Short: "Login to an OCI registry",
Long: `Login to an OCI registry
Example - Log in with username and password from command line flags:
falcoctl registry auth basic -u username -p password localhost:5000
Example - Login with username and password from env variables:
FALCOCTL_REGISTRY_AUTH_BASIC_USERNAME=username FALCOCTL_REGISTRY_AUTH_BASIC_PASSWORD=password falcoctl registry auth basic localhost:5000
Example - Login with username and password from stdin:
falcoctl registry auth basic -u username --password-stdin localhost:5000
Example - Login with username and password in an interactive prompt:
falcoctl registry auth basic localhost:5000
`,
Args: cobra.ExactArgs(1),
PreRunE: func(cmd *cobra.Command, args []string) error {
_ = viper.BindPFlag("registry.auth.basic.username", cmd.Flags().Lookup("username"))
_ = viper.BindPFlag("registry.auth.basic.password", cmd.Flags().Lookup("password"))
_ = viper.BindPFlag("registry.auth.basic.password_stdin", cmd.Flags().Lookup("password-stdin"))
o.username = viper.GetString("registry.auth.basic.username")
o.password = viper.GetString("registry.auth.basic.password")
o.passwordFromStdin = viper.GetBool("registry.auth.basic.password_stdin")
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunBasic(ctx, args)
},
}
cmd.Flags().StringVarP(&o.username, "username", "u", "", "registry username")
cmd.Flags().StringVarP(&o.password, "password", "p", "", "registry password")
cmd.Flags().BoolVar(&o.passwordFromStdin, "password-stdin", false, "read password from stdin")
return cmd
}
// RunBasic executes the business logic for the basic command.
func (o *loginOptions) RunBasic(ctx context.Context, args []string) error {
var reg string
logger := o.Printer.Logger
// Allow to have the registry expressed as a ref, but actually extract it.
reg, err := utils.GetRegistryFromRef(args[0])
if err != nil {
reg = args[0]
}
if err := getCredentials(o.Printer, o); err != nil {
return err
}
// create empty client
client := authn.NewClient()
// create credential store
credentialStore, err := credentials.NewStore(config.RegistryCredentialConfPath(), credentials.StoreOptions{
AllowPlaintextPut: true,
})
if err != nil {
return fmt.Errorf("unable to create new store: %w", err)
}
if err := basic.Login(ctx, client, credentialStore, reg, o.username, o.password); err != nil {
return err
}
logger.Debug("Credentials added", logger.Args("credential store", config.RegistryCredentialConfPath()))
logger.Info("Login succeeded", logger.Args("registry", reg, "user", o.username))
return nil
}
// getCredentials is used to retrieve username and password from standard input.
func getCredentials(p *output.Printer, opt *loginOptions) error {
reader := bufio.NewReader(os.Stdin)
if opt.username == "" {
p.DefaultText.Print(p.FormatTitleAsLoggerInfo("Enter username:"))
username, err := reader.ReadString('\n')
if err != nil {
return err
}
opt.username = strings.TrimSpace(username)
}
if opt.password == "" {
if opt.passwordFromStdin {
password, err := io.ReadAll(os.Stdin)
if err != nil {
return err
}
opt.password = strings.TrimSuffix(string(password), "\n")
opt.password = strings.TrimSuffix(opt.password, "\r")
} else {
p.DefaultText.Print(p.FormatTitleAsLoggerInfo("Enter password: "))
bytePassword, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return err
}
opt.password = string(bytePassword)
}
}
return nil
}

View File

@ -0,0 +1,150 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package basic_test
import (
"context"
"crypto/tls"
"fmt"
"net/http"
"os"
"path/filepath"
"testing"
"time"
"github.com/distribution/distribution/v3/configuration"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"golang.org/x/crypto/bcrypt"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
//nolint:unused // false positive
var (
registry string
registryBasic string
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
port int
portBasic int
configFile string
err error
args []string
)
func TestBasic(t *testing.T) {
var err error
RegisterFailHandler(Fail)
port, err = testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
portBasic, err = testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
registry = fmt.Sprintf("localhost:%d", port)
registryBasic = fmt.Sprintf("localhost:%d", portBasic)
RunSpecs(t, "Auth Basic Suite")
}
var _ = BeforeSuite(func() {
config := &configuration.Configuration{}
config.HTTP.Addr = fmt.Sprintf("localhost:%d", port)
testHtpasswdFileBasename := "authtest.htpasswd"
testUsername, testPassword := "username", "password"
pwBytes, err := bcrypt.GenerateFromPassword([]byte(testPassword), bcrypt.DefaultCost)
Expect(err).To(BeNil())
htpasswdPath := filepath.Join(GinkgoT().TempDir(), testHtpasswdFileBasename)
err = os.WriteFile(htpasswdPath, []byte(fmt.Sprintf("%s:%s\n", testUsername, string(pwBytes))), 0o644)
Expect(err).To(BeNil())
tlsConfig, err := testutils.BuildRegistryTLSConfig(GinkgoT().TempDir(), []string{"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"})
Expect(err).To(BeNil())
configBasic := &configuration.Configuration{}
configBasic.HTTP.Addr = fmt.Sprintf("localhost:%d", portBasic)
configBasic.Auth = configuration.Auth{
"htpasswd": configuration.Parameters{
"realm": "localhost",
"path": htpasswdPath,
},
}
configBasic.HTTP.DrainTimeout = time.Duration(10) * time.Second
configBasic.HTTP.TLS.CipherSuites = tlsConfig.CipherSuites
configBasic.HTTP.TLS.Certificate = tlsConfig.CertificatePath
configBasic.HTTP.TLS.Key = tlsConfig.PrivateKeyPath
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Start the local registry.
go func() {
err := testutils.StartRegistry(context.Background(), config)
Expect(err).ToNot(BeNil())
}()
// Check that the registry is up and accepting connections.
Eventually(func(g Gomega) error {
res, err := http.Get(fmt.Sprintf("http://%s", config.HTTP.Addr))
g.Expect(err).ShouldNot(HaveOccurred())
g.Expect(res.StatusCode).Should(Equal(http.StatusOK))
return err
}).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred())
// Start the local registry with basic authentication.
go func() {
err := testutils.StartRegistry(context.Background(), configBasic)
Expect(err).ToNot(BeNil())
}()
// Check that the registry is up and accepting connections.
Eventually(func(g Gomega) error {
res, err := http.Get(fmt.Sprintf("https://%s", configBasic.HTTP.Addr))
g.Expect(err).ShouldNot(HaveOccurred())
g.Expect(res.StatusCode).Should(Equal(http.StatusOK))
return err
}).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred())
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
//nolint:unused // false positive
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,141 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package basic_test
import (
"regexp"
_ "github.com/distribution/distribution/v3/registry/auth/htpasswd"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
type Config struct {
Registry Registry `yaml:"registry"`
}
type Registry struct {
Auth Auth `yaml:"auth"`
}
type Auth struct {
OAuth []OAuth `yaml:"oauth"`
}
type OAuth struct {
Registry string `yaml:"registry"`
ClientSecret string `yaml:"clientsecret"`
ClientID string `yaml:"clientid"`
TokerURL string `yaml:"tokenurl"`
}
//nolint:lll,unused // no need to check for line length.
var registryAuthBasicUsage = `Usage:
falcoctl registry auth basic [hostname]
Flags:
-h, --help help for basic
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--disable-styling Disable output styling such as spinners, progress bars and colors. Styling is automatically disabled if not attacched to a tty (default false)
-v, --verbose Enable verbose logs (default false)
`
//nolint:unused // false positive
var registryAuthBasicHelp = `Login to an OCI registry
Example - Log in with username and password from command line flags:
falcoctl registry auth basic -u username -p password localhost:5000
Example - Login with username and password from env variables:
FALCOCTL_REGISTRY_AUTH_BASIC_USERNAME=username FALCOCTL_REGISTRY_AUTH_BASIC_PASSWORD=password falcoctl registry auth basic localhost:5000
Example - Login with username and password from stdin:
falcoctl registry auth basic -u username --password-stdin localhost:5000
Example - Login with username and password in an interactive prompt:
falcoctl registry auth basic localhost:5000
Usage:
falcoctl registry auth basic [hostname]
Flags:
-h, --help help for basic
-p, --password string registry password
--password-stdin read password from stdin
-u, --username string registry username
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
//nolint:unused // false positive
var registryAuthBasicAssertFailedBehavior = func(usage, specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(usage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
//nolint:unused // false positive
var registryAuthBasicTests = Describe("auth", func() {
const (
// Used as flags for all the test cases.
registryCmd = "registry"
authCmd = "auth"
basicCmd = "basic"
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{registryCmd, authCmd, basicCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(registryAuthBasicHelp)))
})
})
Context("failure", func() {
When("without hostname", func() {
BeforeEach(func() {
args = []string{registryCmd, authCmd, basicCmd}
})
registryAuthBasicAssertFailedBehavior(registryAuthBasicUsage,
"ERROR accepts 1 arg(s), received 0")
})
})
})

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package basic defines the logic to authenticate against an OCI registry.
package basic

17
cmd/registry/auth/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package auth defines the logic to authenticate against an OCI registry.
package auth

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package gcp defines the logic to authenticate against an Artifact registry using GCP credentials.
package gcp

View File

@ -0,0 +1,84 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package gcp
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/internal/login/gcp"
"github.com/falcosecurity/falcoctl/pkg/options"
)
const (
longGcp = `Register an Artifact Registry to use GCP Application Default credentials to connect to it.
In particular, it can use Workload Identity or GCE metadata server to authenticate.
Example
falcoctl registry auth gcp europe-docker.pkg.dev
`
)
// RegistryGcpOptions contains the options for the registry gcp command.
type RegistryGcpOptions struct {
*options.Common
}
// NewGcpCmd returns the gcp command.
func NewGcpCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := RegistryGcpOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: "gcp [REGISTRY]",
DisableFlagsInUseLine: true,
Short: "Register an Artifact Registry to log in using GCP Application Default credentials",
Long: longGcp,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunGcp(ctx, args)
},
}
return cmd
}
// RunGcp executes the business logic for the gcp command.
func (o *RegistryGcpOptions) RunGcp(ctx context.Context, args []string) error {
var err error
logger := o.Printer.Logger
reg := args[0]
if err = gcp.Login(ctx, reg); err != nil {
return err
}
logger.Info("GCP authentication successful", logger.Args("registry", reg))
logger.Debug("Adding new gcp entry to configuration", logger.Args("file", o.ConfigFile))
if err = config.AddGcp([]config.GcpAuth{{
Registry: reg,
}}, o.ConfigFile); err != nil {
return fmt.Errorf("index entry %q: %w", reg, err)
}
logger.Info("GCG authentication entry successfully added", logger.Args("registry", reg, "confgi file", o.ConfigFile))
return nil
}

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package oauth defines the logic to authenticate against an OCI registry via OAuth2.0.
package oauth

View File

@ -0,0 +1,94 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package oauth
import (
"context"
"fmt"
"github.com/spf13/cobra"
"golang.org/x/oauth2/clientcredentials"
"github.com/falcosecurity/falcoctl/internal/config"
"github.com/falcosecurity/falcoctl/internal/login/oauth"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
const (
longOauth = `Store client credentials for later OAuth2.0 authentication
Client credentials will be saved in the ~/.config directory.
Example
falcoctl registry oauth \
--token-url="http://localhost:9096/token" \
--client-id=000000 \
--client-secret=999999 --scopes="my-scope" \
hostname
`
)
// RegistryOauthOptions contains the options for the registry oauth command.
type RegistryOauthOptions struct {
*options.Common
Conf clientcredentials.Config
}
// NewOauthCmd returns the oauth command.
func NewOauthCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := RegistryOauthOptions{
Common: opt,
}
cmd := &cobra.Command{
Use: "oauth [HOSTNAME]",
DisableFlagsInUseLine: true,
Short: "Retrieve access and refresh tokens for OAuth2.0 client credentials flow authentication",
Long: longOauth,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunOAuth(ctx, args)
},
}
cmd.Flags().StringVar(&o.Conf.TokenURL, "token-url", "", "token URL used to get access and refresh tokens")
if err := cmd.MarkFlagRequired("token-url"); err != nil {
output.ExitOnErr(o.Printer, fmt.Errorf("unable to mark flag \"token-url\" as required"))
}
cmd.Flags().StringVar(&o.Conf.ClientID, "client-id", "", "client ID of the OAuth2.0 app")
if err := cmd.MarkFlagRequired("client-id"); err != nil {
output.ExitOnErr(o.Printer, fmt.Errorf("unable to mark flag \"client-id\" as required"))
}
cmd.Flags().StringVar(&o.Conf.ClientSecret, "client-secret", "", "client secret of the OAuth2.0 app")
if err := cmd.MarkFlagRequired("client-secret"); err != nil {
output.ExitOnErr(o.Printer, fmt.Errorf("unable to mark flag \"client-secret\" as required"))
return nil
}
cmd.Flags().StringSliceVar(&o.Conf.Scopes, "scopes", nil, "comma separeted list of scopes for which requesting access")
return cmd
}
// RunOAuth executes the business logic for the oauth command.
func (o *RegistryOauthOptions) RunOAuth(ctx context.Context, args []string) error {
reg := args[0]
if err := oauth.Login(ctx, reg, &o.Conf); err != nil {
return err
}
o.Printer.Logger.Info("Client credentials correctly saved", o.Printer.Logger.Args("file", config.ClientCredentialsFile))
return nil
}

View File

@ -0,0 +1,128 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package oauth_test
import (
"context"
"fmt"
"net/http"
"os"
"os/user"
"path/filepath"
"testing"
"time"
"github.com/distribution/distribution/v3/configuration"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"oras.land/oras-go/v2/registry/remote"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
//nolint:unused // false positive
var (
registry string
oauthServer string
oauthPort int
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
port int
orasRegistry *remote.Registry
configFile string
err error
args []string
)
func TestOAuth(t *testing.T) {
var err error
RegisterFailHandler(Fail)
port, err = testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
oauthPort, err = testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
registry = fmt.Sprintf("localhost:%d", port)
RunSpecs(t, "OAuth Suite")
}
var _ = BeforeSuite(func() {
// Get the current user's home directory
usr, err := user.Current()
Expect(err).ToNot(HaveOccurred())
// Construct the path for the .config directory
configDir := filepath.Join(usr.HomeDir, ".config", "falcoctl")
// Check if the directory already exists
if _, err := os.Stat(configDir); os.IsNotExist(err) {
// Directory doesn't exist, create it
err := os.MkdirAll(configDir, 0o755)
Expect(err).ToNot(HaveOccurred())
}
config := &configuration.Configuration{}
config.HTTP.Addr = fmt.Sprintf("localhost:%d", port)
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create the oras registry.
orasRegistry, err = testutils.NewOrasRegistry(registry, true)
Expect(err).ToNot(HaveOccurred())
// Start the local registry.
go func() {
err := testutils.StartRegistry(context.Background(), config)
Expect(err).ToNot(BeNil())
}()
// Check that the registry is up and accepting connections.
Eventually(func(g Gomega) error {
res, err := http.Get(fmt.Sprintf("http://%s", config.HTTP.Addr))
g.Expect(err).ShouldNot(HaveOccurred())
g.Expect(res.StatusCode).Should(Equal(http.StatusOK))
return err
}).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred())
go func() {
err := testutils.StartOAuthServer(context.Background(), oauthPort)
Expect(err).ToNot(BeNil())
}()
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
//nolint:unused // false positive
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,208 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package oauth_test
import (
"fmt"
"os"
"regexp"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/falcosecurity/falcoctl/cmd"
)
type Config struct {
Registry Registry `yaml:"registry"`
}
type Registry struct {
Auth Auth `yaml:"auth"`
}
type Auth struct {
OAuth []OAuth `yaml:"oauth"`
}
type OAuth struct {
Registry string `yaml:"registry"`
ClientSecret string `yaml:"clientsecret"`
ClientID string `yaml:"clientid"`
TokerURL string `yaml:"tokenurl"`
}
//nolint:unused // false positive
var correctIndexConfig = `indexes:
- name: falcosecurity
url: https://falcosecurity.github.io/falcoctl/index.yaml
`
//nolint:lll,unused // no need to check for line length.
var registryAuthOAuthUsage = `Usage:
falcoctl registry auth oauth [HOSTNAME]
Flags:
--client-id string client ID of the OAuth2.0 app
--client-secret string client secret of the OAuth2.0 app
-h, --help help for oauth
--scopes strings comma separeted list of scopes for which requesting access
--token-url string token URL used to get access and refresh tokens
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--log-format string Set formatting for logs (color, text, json) (default "color")
--log-level string Set level for logs (info, warn, debug, trace) (default "info")
`
//nolint:unused // false positive
var registryAuthOAuthHelp = `Store client credentials for later OAuth2.0 authentication
Client credentials will be saved in the ~/.config directory.
Example
falcoctl registry oauth \
--token-url="http://localhost:9096/token" \
--client-id=000000 \
--client-secret=999999 --scopes="my-scope" \
hostname
`
//nolint:unused // false positive
var registryAuthOAuthAssertFailedBehavior = func(usage, specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(usage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
//nolint:unused // false positive
var registryAuthOAuthTests = Describe("auth", func() {
const (
// Used as flags for all the test cases.
registryCmd = "registry"
authCmd = "auth"
oauthCmd = "oauth"
anSource = "myrepo.com/rules.git"
artifact = "generic-repo"
repo = "/" + artifact
tag = "tag"
repoAndTag = repo + ":" + tag
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{registryCmd, authCmd, oauthCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(registryAuthOAuthHelp)))
})
})
Context("failure", func() {
When("without hostname", func() {
BeforeEach(func() {
args = []string{registryCmd, authCmd, oauthCmd}
})
registryAuthOAuthAssertFailedBehavior(registryAuthOAuthUsage,
"ERROR accepts 1 arg(s), received 0")
})
When("wrong client id", func() {
BeforeEach(func() {
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err = os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
args = []string{registryCmd, authCmd, oauthCmd,
"--client-id=000001", "--client-secret=999999",
"--token-url", fmt.Sprintf("http://localhost:%d/token", oauthPort),
"--config", configFilePath,
"127.0.0.1:5000",
}
})
registryAuthOAuthAssertFailedBehavior(registryAuthOAuthUsage,
`ERROR wrong client credentials, unable to retrieve token`)
})
When("wrong client secret", func() {
BeforeEach(func() {
// start the OAuthServer
baseDir := GinkgoT().TempDir()
configFilePath := baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err := os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
args = []string{registryCmd, authCmd, oauthCmd,
"--client-id=000000", "--client-secret=999998",
"--token-url", fmt.Sprintf("http://localhost:%d/token", oauthPort),
"--config", configFilePath,
"127.0.0.1:5000",
}
})
registryAuthOAuthAssertFailedBehavior(registryAuthOAuthUsage,
`ERROR wrong client credentials, unable to retrieve token`)
})
})
Context("success", func() {
var (
configFilePath string
)
When("all good", func() {
BeforeEach(func() {
baseDir := GinkgoT().TempDir()
configFilePath = baseDir + "/config.yaml"
content := []byte(correctIndexConfig)
err = os.WriteFile(configFilePath, content, 0o644)
Expect(err).To(BeNil())
args = []string{registryCmd, authCmd, oauthCmd,
"--client-id=000000", "--client-secret=999999",
"--token-url", fmt.Sprintf("http://localhost:%d/token", oauthPort),
"--config", configFilePath,
registry,
}
})
It("should successed", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(
`INFO Client credentials correctly saved`)))
})
})
})
})

17
cmd/registry/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package registry implements the registry commands.
package registry

17
cmd/registry/pull/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package pull defnines the logic to pull artifacts from remote repositories.
package pull

144
cmd/registry/pull/pull.go Normal file
View File

@ -0,0 +1,144 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pull
import (
"context"
"fmt"
"runtime"
"github.com/spf13/cobra"
"github.com/falcosecurity/falcoctl/internal/utils"
ociutils "github.com/falcosecurity/falcoctl/pkg/oci/utils"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
const (
longPull = `Pull Falco "rulesfile" or "plugin" OCI artifacts from remote registry.
Artifact references are passed as arguments.
A reference is a fully qualified reference ("<registry>/<repository>"),
optionally followed by ":<tag>" (":latest" is assumed by default when no tag is given).
Example - Pull artifact "myplugin" for the platform where falcoctl is running (default) in the current working directory (default):
falcoctl registry pull localhost:5000/myplugin:latest
Example - Pull artifact "myplugin" for platform "linux/arm64" in the current working directory (default):
falcoctl registry pull localhost:5000/myplugin:latest --platform linux/arm64
Example - Pull artifact "myplugin" for platform "linux/arm64" in "myDir" directory:
falcoctl registry pull localhost:5000/myplugin:latest --platform linux/arm64 --dest-dir=./myDir
Example - Pull artifact "myrulesfile":
falcoctl registry pull localhost:5000/myrulesfile:latest
`
)
type pullOptions struct {
*options.Common
*options.Artifact
*options.Registry
destDir string
}
func (o *pullOptions) Validate() error {
return o.Artifact.Validate()
}
// NewPullCmd returns the pull command.
func NewPullCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := pullOptions{
Common: opt,
Artifact: &options.Artifact{},
Registry: &options.Registry{},
}
cmd := &cobra.Command{
Use: "pull hostname/repo[:tag|@digest] [flags]",
DisableFlagsInUseLine: true,
Short: "Pull a Falco OCI artifact from remote registry",
Long: longPull,
Args: cobra.ExactArgs(1),
PreRunE: func(cmd *cobra.Command, args []string) error {
if err := o.Validate(); err != nil {
return err
}
ref := args[0]
_, err := utils.GetRegistryFromRef(ref)
if err != nil {
return err
}
o.Common.Initialize()
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunPull(ctx, args)
},
}
o.Registry.AddFlags(cmd)
output.ExitOnErr(o.Printer, o.Artifact.AddFlags(cmd))
cmd.Flags().StringVarP(&o.destDir, "dest-dir", "o", "", "destination dir where to save the artifacts(default: current directory)")
return cmd
}
// RunPull executes the business logic for the pull command.
func (o *pullOptions) RunPull(ctx context.Context, args []string) error {
logger := o.Printer.Logger
ref := args[0]
registry, err := utils.GetRegistryFromRef(ref)
if err != nil {
return err
}
puller, err := ociutils.Puller(o.PlainHTTP, o.Printer)
if err != nil {
return fmt.Errorf("an error occurred while creating the puller for registry %s: %w", registry, err)
}
err = ociutils.CheckConnectionForRegistry(ctx, puller.Client, o.PlainHTTP, registry)
if err != nil {
return err
}
logger.Info("Preparing to pull artifact", logger.Args("name", args[0]))
if o.destDir == "" {
logger.Info("Pulling artifact in the current directory")
} else {
logger.Info("Pulling artifact in", logger.Args("directory", o.destDir))
}
os, arch := runtime.GOOS, runtime.GOARCH
if len(o.Artifact.Platforms) > 0 {
os, arch = o.OSArch(0)
}
res, err := puller.Pull(ctx, ref, o.destDir, os, arch)
if err != nil {
return err
}
logger.Info("Artifact pulled", logger.Args("name", args[0], "type", res.Type, "digest", res.Digest))
return nil
}

View File

@ -0,0 +1,110 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pull_test
import (
"context"
"fmt"
"net/http"
"os"
"path/filepath"
"testing"
"time"
"github.com/distribution/distribution/v3/configuration"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/spf13/cobra"
"oras.land/oras-go/v2/registry/remote"
"github.com/falcosecurity/falcoctl/cmd"
commonoptions "github.com/falcosecurity/falcoctl/pkg/options"
testutils "github.com/falcosecurity/falcoctl/pkg/test"
)
//nolint:unused // false positive
const (
rulesfiletgz = "../../../pkg/test/data/rules.tar.gz"
rulesfileyaml = "../../../pkg/test/data/rules.yaml"
plugintgz = "../../../pkg/test/data/plugin.tar.gz"
)
//nolint:unused // false positive
var (
registry string
ctx = context.Background()
output = gbytes.NewBuffer()
rootCmd *cobra.Command
opt *commonoptions.Common
port int
orasRegistry *remote.Registry
configFile string
err error
args []string
)
func TestPull(t *testing.T) {
RegisterFailHandler(Fail)
port, err = testutils.FreePort()
Expect(err).ToNot(HaveOccurred())
registry = fmt.Sprintf("localhost:%d", port)
RunSpecs(t, "Pull Suite")
}
var _ = BeforeSuite(func() {
config := &configuration.Configuration{}
config.HTTP.Addr = fmt.Sprintf("localhost:%d", port)
// Create and configure the common options.
opt = commonoptions.NewOptions()
opt.Initialize(commonoptions.WithWriter(output))
// Create the oras registry.
orasRegistry, err = testutils.NewOrasRegistry(registry, true)
Expect(err).ToNot(HaveOccurred())
// Start the local registry.
go func() {
err := testutils.StartRegistry(context.Background(), config)
Expect(err).ToNot(BeNil())
}()
// Check that the registry is up and accepting connections.
Eventually(func(g Gomega) error {
res, err := http.Get(fmt.Sprintf("http://%s", config.HTTP.Addr))
g.Expect(err).ShouldNot(HaveOccurred())
g.Expect(res.StatusCode).Should(Equal(http.StatusOK))
return err
}).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred())
// Create temporary directory used to save the configuration file.
configFile, err = testutils.CreateEmptyFile("falcoctl.yaml")
Expect(err).Should(Succeed())
})
var _ = AfterSuite(func() {
configDir := filepath.Dir(configFile)
Expect(os.RemoveAll(configDir)).Should(Succeed())
})
//nolint:unused // false positive
func executeRoot(args []string) error {
rootCmd.SetArgs(args)
rootCmd.SetOut(output)
return cmd.Execute(rootCmd, opt)
}

View File

@ -0,0 +1,327 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pull_test
import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"oras.land/oras-go/v2/registry/remote/auth"
"github.com/falcosecurity/falcoctl/cmd"
"github.com/falcosecurity/falcoctl/pkg/oci"
"github.com/falcosecurity/falcoctl/pkg/oci/authn"
ocipusher "github.com/falcosecurity/falcoctl/pkg/oci/pusher"
out "github.com/falcosecurity/falcoctl/pkg/output"
)
//nolint:lll,unused // no need to check for line length.
var registryPullUsage = `Usage:
falcoctl registry pull hostname/repo[:tag|@digest] [flags]
Flags:
-o, --dest-dir string destination dir where to save the artifacts(default: current directory)
-h, --help help for pull
--plain-http allows interacting with remote registry via plain http requests
--platform stringArray os and architecture of the artifact in OS/ARCH format (only for plugins artifacts)
Global Flags:
--config string config file to be used for falcoctl (default "/etc/falcoctl/falcoctl.yaml")
--disable-styling Disable output styling such as spinners, progress bars and colors. Styling is automatically disabled if not attacched to a tty (default false)
-v, --verbose Enable verbose logs (default false)
`
//nolint:unused // false positive
var registryPullHelp = `Pull Falco "rulesfile" or "plugin" OCI artifacts from remote registry.
Artifact references are passed as arguments.
A reference is a fully qualified reference ("<registry>/<repository>"),
optionally followed by ":<tag>" (":latest" is assumed by default when no tag is given).
Example - Pull artifact "myplugin" for the platform where falcoctl is running (default) in the current working directory (default):
falcoctl registry pull localhost:5000/myplugin:latest
Example - Pull artifact "myplugin" for platform "linux/arm64" in the current working directory (default):
falcoctl registry pull localhost:5000/myplugin:latest --platform linux/arm64
Example - Pull artifact "myplugin" for platform "linux/arm64" in "myDir" directory:
falcoctl registry pull localhost:5000/myplugin:latest --platform linux/arm64 --dest-dir=./myDir
Example - Pull artifact "myrulesfile":
falcoctl registry pull localhost:5000/myrulesfile:latest
`
//nolint:unused // false positive
var pullAssertFailedBehavior = func(usage, specificError string) {
It("check that fails and the usage is not printed", func() {
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(usage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(specificError)))
})
}
//nolint:unused // false positive
var registryPullTests = Describe("pull", func() {
var (
pusher *ocipusher.Pusher
ref string
config ocipusher.Option
)
const (
// Used as flags for all the test cases.
registryCmd = "registry"
pullCmd = "pull"
dep1 = "myplugin:1.2.3"
dep2 = "myplugin1:1.2.3|otherplugin:3.2.1"
req = "engine_version:15"
anSource = "myrepo.com/rules.git"
artifact = "generic-repo"
repo = "/" + artifact
tag = "tag"
repoAndTag = repo + ":" + tag
)
// Each test gets its own root command and runs it.
// The err variable is asserted by each test.
JustBeforeEach(func() {
rootCmd = cmd.New(ctx, opt)
err = executeRoot(args)
})
JustAfterEach(func() {
Expect(output.Clear()).ShouldNot(HaveOccurred())
})
Context("help message", func() {
BeforeEach(func() {
args = []string{registryCmd, pullCmd, "--help"}
})
It("should match the saved one", func() {
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(registryPullHelp)))
})
})
// Here we are testing all the failure cases using both the rulesfile and plugin artifact types.
// The common logic for the artifacts is tested once using a rulesfile artifact, no need to repeat
// the same test using a plugin artifact.
Context("failure", func() {
var (
tracker out.Tracker
options []ocipusher.Option
filePathsAndPlatforms ocipusher.Option
destDir string
)
const (
plainHTTP = true
testPluginPlatform1 = "linux/amd64"
)
When("without artifact", func() {
BeforeEach(func() {
args = []string{registryCmd, pullCmd}
})
pullAssertFailedBehavior(registryPullUsage, "ERROR accepts 1 arg(s), received 0")
})
When("unreachable registry", func() {
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
args = []string{registryCmd, pullCmd, "noregistry/testrules", "--plain-http", "--config", configFile}
})
pullAssertFailedBehavior(registryPullUsage, "ERROR unable to connect to remote registry")
})
When("invalid repository", func() {
newReg := registry + "/wrong:latest"
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
args = []string{registryCmd, pullCmd, newReg, "--plain-http", "--config", configFile}
})
pullAssertFailedBehavior(registryPullUsage, fmt.Sprintf("ERROR %s: not found", newReg))
})
When("unwritable --dest-dir", func() {
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
destDir = GinkgoT().TempDir()
err = os.Chmod(destDir, 0o555)
Expect(err).To(BeNil())
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{})
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{plugintgz}, []string{testPluginPlatform1})
options = []ocipusher.Option{filePathsAndPlatforms, config}
result, err := pusher.Push(ctx, oci.Plugin, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
args = []string{registryCmd, pullCmd, ref, "--plain-http",
"--platform", testPluginPlatform1, "--dest-dir", destDir,
"--config", configFile,
}
})
It("check that fails and the usage is not printed", func() {
tmp := strings.Split(repoAndTag, "/")
artNameAndTag := tmp[len(tmp)-1]
tmp = strings.Split(artNameAndTag, ":")
artName := tmp[0]
tag := tmp[1]
expectedError := fmt.Sprintf(
"ERROR unable to pull artifact generic-repo with %s tag from repo %s: failed to create file",
tag, artName)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(registryPullUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("--dest-dir not present (and parent not writable)", func() {
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
baseDir := GinkgoT().TempDir()
err = os.Chmod(baseDir, 0o555)
Expect(err).To(BeNil())
destDir = baseDir + "/dest"
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{})
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{plugintgz}, []string{testPluginPlatform1})
options = []ocipusher.Option{filePathsAndPlatforms, config}
result, err := pusher.Push(ctx, oci.Plugin, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
args = []string{registryCmd, pullCmd, ref, "--plain-http",
"--platform", testPluginPlatform1, "--dest-dir", destDir,
"--config", configFile,
}
})
It("check that fails and the usage is not printed", func() {
expectedError := fmt.Sprintf("ERROR unable to pull artifact %s with tag %s from repo %s: failed to ensure directories of the target path: "+
"mkdir %s: permission denied", artifact, tag, artifact, destDir)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(registryPullUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("wrong digest format", func() {
wrongDigest := "sha256:06f961b802bc46ee168555f066d28f4f0e9afdf3f88174c1ee6f9de004fc30a0"
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{})
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{plugintgz}, []string{testPluginPlatform1})
options = []ocipusher.Option{filePathsAndPlatforms, config}
result, err := pusher.Push(ctx, oci.Plugin, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag + "@" + wrongDigest
args = []string{registryCmd, pullCmd, ref, "--plain-http",
"--platform", testPluginPlatform1, "--config", configFile}
})
It("check that fails and the usage is not printed", func() {
expectedError := fmt.Sprintf("ERROR %s: not found", registry+repo+"@"+wrongDigest)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(registryPullUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("missing repository", func() {
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
ref = repoAndTag
args = []string{registryCmd, pullCmd, ref, "--plain-http", "--config", configFile}
})
It("check that fails and the usage is not printed", func() {
expectedError := fmt.Sprintf("ERROR cannot extract registry name from ref %q", ref)
Expect(err).To(HaveOccurred())
Expect(output).ShouldNot(gbytes.Say(regexp.QuoteMeta(registryPullUsage)))
Expect(output).Should(gbytes.Say(regexp.QuoteMeta(expectedError)))
})
})
When("invalid repository", func() {
newReg := registry + "/wrong@something"
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
args = []string{registryCmd, pullCmd, newReg, "--plain-http", "--config", configFile}
})
pullAssertFailedBehavior(registryPullUsage, fmt.Sprintf("ERROR unable to create new repository with ref %s: "+
"invalid reference: invalid digest %q: invalid checksum digest format\n", newReg, "something"))
})
When("invalid platform", func() {
BeforeEach(func() {
configDir := GinkgoT().TempDir()
configFile := filepath.Join(configDir, ".config")
_, err := os.Create(configFile)
Expect(err).To(BeNil())
pusher = ocipusher.NewPusher(authn.NewClient(authn.WithCredentials(&auth.EmptyCredential)), plainHTTP, tracker)
ref = registry + repoAndTag
config = ocipusher.WithArtifactConfig(oci.ArtifactConfig{})
filePathsAndPlatforms = ocipusher.WithFilepathsAndPlatforms([]string{plugintgz}, []string{testPluginPlatform1})
options = []ocipusher.Option{filePathsAndPlatforms, config}
result, err := pusher.Push(ctx, oci.Plugin, ref, options...)
Expect(err).To(BeNil())
Expect(result).ToNot(BeNil())
ref = registry + repoAndTag
args = []string{registryCmd, pullCmd, ref, "--plain-http",
"--platform", "linux/unknown", "--config", configFile}
})
pullAssertFailedBehavior(registryPullUsage, "not found: no matching manifest was found in the manifest list")
})
})
})

17
cmd/registry/push/doc.go Normal file
View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package push defines the logic to push local artifacts to a remote repository.
package push

343
cmd/registry/push/push.go Normal file
View File

@ -0,0 +1,343 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023 The Falco Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package push
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"github.com/blang/semver/v4"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
"github.com/falcosecurity/falcoctl/internal/utils"
"github.com/falcosecurity/falcoctl/pkg/oci"
ocipusher "github.com/falcosecurity/falcoctl/pkg/oci/pusher"
ociutils "github.com/falcosecurity/falcoctl/pkg/oci/utils"
"github.com/falcosecurity/falcoctl/pkg/options"
"github.com/falcosecurity/falcoctl/pkg/output"
)
const (
longPush = `Push Falco "rulesfile" or "plugin" OCI artifacts to remote registry
Example - Push artifact "myplugin.tar.gz" of type "plugin" for the platform where falcoctl is running (default):
falcoctl registry push --type plugin --version "1.2.3" localhost:5000/myplugin:latest myplugin.tar.gz
Example - Push artifact "myplugin.tar.gz" of type "plugin" for platform "linux/arm64":
falcoctl registry push --type plugin --version "1.2.3" localhost:5000/myplugin:latest myplugin.tar.gz --platform linux/arm64
Example - Push artifact "myplugin.tar.gz" of type "plugin" for multiple platforms:
falcoctl registry push --type plugin --version "1.2.3" localhost:5000/myplugin:latest \
myplugin-linux-x86_64.tar.gz --platform linux/x86_64 \
myplugin-linux-arm64.tar.gz --platform linux/arm64
Example - Push artifact "myrulesfile.tar.gz" of type "rulesfile":
falcoctl registry push --type rulesfile --version "0.1.2" localhost:5000/myrulesfile:latest myrulesfile.tar.gz
Example - Push artifact "myrulesfile.tar.gz" of type "rulesfile" with floating tags for the major and minor versions (0 and 0.1):
falcoctl registry push --type rulesfile --version "0.1.2" localhost:5000/myrulesfile:latest myrulesfile.tar.gz \
--add-floating-tags
Example - Push artifact "myrulesfile.tar.gz" of type "rulesfile" to an insecure registry:
falcoctl registry push --type rulesfile --version "0.1.2" --plain-http localhost:5000/myrulesfile:latest myrulesfile.tar.gz
Example - Push artifact "myrulesfile.tar.gz" of type "rulesfile" with a dependency "myplugin:1.2.3":
falcoctl registry push --type rulesfile --version "0.1.2" localhost:5000/myrulesfile:latest myrulesfile.tar.gz \
--depends-on myplugin:1.2.3
Example - Push artifact "myrulesfile.tar.gz" of type "rulesfile" with a dependency "myplugin:1.2.3" and an alternative "otherplugin:3.2.1":
falcoctl registry push --type rulesfile --version "0.1.2" localhost:5000/myrulesfile:latest myrulesfile.tar.gz \
--depends-on "myplugin:1.2.3|otherplugin:3.2.1"
Example - Push artifact "myrulesfile.tar.gz" of type "rulesfile" with multiple dependencies "myplugin:1.2.3", "otherplugin:3.2.1":
falcoctl registry push --type rulesfile --version "0.1.2" localhost:5000/myrulesfile:latest myrulesfile.tar.gz \
--depends-on myplugin:1.2.3 \
--depends-on otherplugin:3.2.1
`
)
type pushOptions struct {
*options.Common
*options.Artifact
*options.Registry
}
func (o *pushOptions) validate() error {
return o.Artifact.Validate()
}
// NewPushCmd returns the push command.
func NewPushCmd(ctx context.Context, opt *options.Common) *cobra.Command {
o := pushOptions{
Common: opt,
Artifact: &options.Artifact{},
Registry: &options.Registry{},
}
cmd := &cobra.Command{
Use: "push hostname/repo[:tag|@digest] file [flags]",
DisableFlagsInUseLine: true,
Short: "Push a Falco OCI artifact to remote registry",
Long: longPush,
Args: cobra.MinimumNArgs(2),
PreRunE: func(cmd *cobra.Command, args []string) error {
if err := o.validate(); err != nil {
return err
}
ref := args[0]
_, err := utils.GetRegistryFromRef(ref)
if err != nil {
return err
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return o.runPush(ctx, args)
},
}
o.Registry.AddFlags(cmd)
output.ExitOnErr(o.Printer, o.Artifact.AddFlags(cmd))
return cmd
}
// runPush executes the business logic for the push command.
func (o *pushOptions) runPush(ctx context.Context, args []string) error {
ref := args[0]
paths := args[1:]
// When creating the tar.gz archives we need to remove them after we are done.
// Holds the path for each temporary dir.
var toBeDeletedTmpDirs []string
logger := o.Printer.Logger
registry, err := utils.GetRegistryFromRef(ref)
if err != nil {
return err
}
pusher, err := ociutils.Pusher(o.PlainHTTP, o.Printer)
if err != nil {
return fmt.Errorf("an error occurred while creating the pusher for registry %s: %w", registry, err)
}
err = ociutils.CheckConnectionForRegistry(ctx, pusher.Client, o.PlainHTTP, registry)
if err != nil {
return err
}
logger.Info("Preparing to push artifact", o.Printer.Logger.Args("name", args[0], "type", o.ArtifactType))
// Make sure to remove temporary working dirs.
defer func() {
for _, dir := range toBeDeletedTmpDirs {
logger.Debug("Removing temporary dir", logger.Args("name", dir))
if err := os.RemoveAll(dir); err != nil {
logger.Warn("Unable to remove temporary dir", logger.Args("name", dir, "error", err.Error()))
}
}
}()
config := &oci.ArtifactConfig{
Name: o.Name,
Version: o.Version,
}
for i, p := range paths {
if err = utils.IsTarGz(filepath.Clean(p)); err != nil && !errors.Is(err, utils.ErrNotTarGz) {
return err
} else if err == nil {
continue
} else {
if o.ArtifactType == oci.Rulesfile {
if config, err = rulesConfigLayer(o.Printer.Logger, p, o.Artifact); err != nil {
return err
}
}
path, err := utils.CreateTarGzArchive("", p, true)
if err != nil {
return err
}
paths[i] = path
toBeDeletedTmpDirs = append(toBeDeletedTmpDirs, filepath.Dir(path))
}
}
if config.Name == "" {
// extract artifact name from ref, if not provided by the user
if config.Name, err = utils.NameFromRef(ref); err != nil {
return err
}
}
if err := config.ParseDependencies(o.Dependencies...); err != nil {
return err
}
if err := config.ParseRequirements(o.Requirements...); err != nil {
return err
}
if o.AutoFloatingTags {
v, err := semver.Parse(o.Version)
if err != nil {
return fmt.Errorf("expected semver for the flag \"--version\": %w", err)
}
o.Tags = append(o.Tags, o.Version, fmt.Sprintf("%v", v.Major), fmt.Sprintf("%v.%v", v.Major, v.Minor))
}
opts := ocipusher.Options{
ocipusher.WithTags(o.Tags...),
ocipusher.WithAnnotationSource(o.AnnotationSource),
ocipusher.WithArtifactConfig(*config),
}
switch o.ArtifactType {
case oci.Plugin:
opts = append(opts, ocipusher.WithFilepathsAndPlatforms(paths, o.Platforms))
case oci.Rulesfile:
opts = append(opts, ocipusher.WithFilepaths(paths))
case oci.Asset:
opts = append(opts, ocipusher.WithFilepaths(paths))
}
res, err := pusher.Push(ctx, o.ArtifactType, ref, opts...)
if err != nil {
return err
}
logger.Info("Artifact pushed", logger.Args("name", args[0], "type", res.Type, "digest", res.RootDigest))
return nil
}
const (
// depsKey is the key for deps in the rulesfiles.
depsKey = "required_plugin_versions"
// engineKey is the key in the rulesfiles.
engineKey = "required_engine_version"
// engineRequirementKey is used as name for the engine requirement in the config layer for the rulesfile artifacts.
engineRequirementKey = "engine_version_semver"
)
func rulesConfigLayer(logger *pterm.Logger, filePath string, artifactOptions *options.Artifact) (*oci.ArtifactConfig, error) {
var data []map[string]interface{}
// Setup OCI artifact configuration
config := oci.ArtifactConfig{
Name: artifactOptions.Name,
Version: artifactOptions.Version,
}
yamlFile, err := os.ReadFile(filepath.Clean(filePath))
if err != nil {
return nil, fmt.Errorf("unable to open rulesfile %s: %w", filePath, err)
}
if err := yaml.Unmarshal(yamlFile, &data); err != nil {
return nil, fmt.Errorf("unable to unmarshal rulesfile %s: %w", filePath, err)
}
// Parse the artifact dependencies.
// Check if the user has provided any.
if len(artifactOptions.Dependencies) != 0 {
logger.Info("Dependencies provided by user", logger.Args("rulesfile", filePath))
if err = config.ParseDependencies(artifactOptions.Dependencies...); err != nil {
return nil, err
}
} else {
// If no user provided then try to parse them from the rulesfile.
var found bool
logger.Info("Parsing dependencies from: ", logger.Args("rulesfile", filePath))
var requiredPluginVersionsEntry interface{}
var ok bool
for _, entry := range data {
if requiredPluginVersionsEntry, ok = entry[depsKey]; !ok {
continue
}
var deps []oci.ArtifactDependency
byteData, err := yaml.Marshal(requiredPluginVersionsEntry)
if err != nil {
return nil, fmt.Errorf("unable to parse dependencies from rulesfile: %w", err)
}
err = yaml.Unmarshal(byteData, &deps)
if err != nil {
return nil, fmt.Errorf("unable to parse dependencies from rulesfile: %w", err)
}
logger.Info("Dependencies correctly parsed from rulesfile")
// Set the deps.
config.Dependencies = deps
found = true
break
}
if !found {
logger.Warn("No dependencies were provided by the user and none were found in the rulesfile.")
}
}
// Parse the requirements.
// Check if the user has provided any.
if len(artifactOptions.Requirements) != 0 {
logger.Info("Requirements provided by user")
if err = config.ParseRequirements(artifactOptions.Requirements...); err != nil {
return nil, err
}
} else {
var found bool
var engineVersion string
logger.Info("Parsing requirements from: ", logger.Args("rulesfile", filePath))
// If no user provided requirements then try to parse them from the rulesfile.
for _, entry := range data {
if requiredEngineVersionEntry, ok := entry[engineKey]; ok {
// Check if the version is an int. This is for backward compatibility. The engine version used to be an
// int but internally used by falco as a semver minor version.
// 15 -> 0.15.0
if engVersionInt, ok := requiredEngineVersionEntry.(int); ok {
engineVersion = fmt.Sprintf("0.%d.0", engVersionInt)
} else {
engineVersion, ok = requiredEngineVersionEntry.(string)
if !ok {
return nil, fmt.Errorf("%s must be an int or a string respecting the semver specification, got type %T", engineKey, requiredEngineVersionEntry)
}
// Check if it is in semver format.
if _, err := semver.Parse(engineVersion); err != nil {
return nil, fmt.Errorf("%s must be in semver format: %w", engineVersion, err)
}
}
// Set the requirements.
config.Requirements = []oci.ArtifactRequirement{{
Name: engineRequirementKey,
Version: engineVersion,
}}
found = true
break
}
}
if !found {
logger.Warn("No requirements were provided by the user and none were found in the rulesfile.")
}
}
return &config, nil
}

Some files were not shown because too many files have changed in this diff Show More