Repository navigation
Bump otelgrpc to fix CVE issue - #6100
Conversation
|
Not a good way to fix. Seems bump it cause some compilation error. :( |
|
Compared to https://github.com/dagger/dagger/actions/runs/6851646021/job/18628377264?pr=6099#step:7:310, we have only 1 I'm not sure about other issues in Trivy but it seems we need to update dependencies in the Alpine during build. |
|
Thanks for looking into this @wingyplus! Your changes look good so far. One of the remaining issues is the I will give that a quick shot and push to this PR if successful. |
This fix one of issues, founded in trivy scan job [1]. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]>
Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]>
Since bump otelgrpc, it's required to bump otel/sdk to 1.20. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]>
The buildctl binary is currently required in the engine image since it facilitates connhelpers connecting to the engine inside (by proxying the stdio of an exec'd buildctl process to the unix socket). This is inherited from buildkit and how Dagger has worked for a while. The problem is we keep running into vulnerabilities in this binary that take a while for upstream to fix (i.e. related to otel/grpc), which leaves us to resort to various hacks to get a binary w/out vulnerabilities in the engine image. This change moves us off of upstream's buildctl binary and instead replaces it with the absolute minimal features we need in `./cmd/dialstdio`. There's none of the buildctl subcommands except dial-stdio. This allows us to easily build it from our own go.mod (which makes dependency upgrades easier) and also results in most problematic sources of dependencies no longer being present. The source code for the dial-stdio functionality is mostly a fork of upstream, except all the other adjacent code we don't need has been stripped out. I also switched to use cobra to be consistent w/ our other binaries and avoid a separate dependency on urfave/cli. Attribution on the original source code is given w/ a NOTICE and BUILDKIT_AUTHORS file, same as we did w/ `./cmd/engine`. Signed-off-by: Erik Sipsma <[email protected]>
be3f977 to
fea6204
Compare
We currently are in a situation where the engine image is being built and installing apk packages that are vulnerable. Alpine released newer versions of the packages a few days ago, but we are still hitting cache for the "apk add" execs from before then and thus aren't picking them up. The real fix to this is to switch CI to use Zenith and use one of the various apk/apko/wolfi modules that have been written which avoid this problem, e.g. https://daggerverse.dev/mod/github.com/sipsma/daggerverse/apk@d709dd631e176025ea042dc03fdc90197f4b12ba However, in the meantime this change just wraps the apk add w/ an env var that changes once per day (current unix time / 1 day in seconds), which will hold us over until then. Signed-off-by: Erik Sipsma <[email protected]>
It's not immediately clear how to replace the interceptors with the suggested "NewServerHandler" while still working w/ grpc_middleware. It's possible that's already do-able and I just haven't seen exactly how yet; I didn't invest a ton of time into this since we aren't really using otel yet. Upstream buildkit will also need to deal with this once they upgrade so we can see what they end up doing too. Signed-off-by: Erik Sipsma <[email protected]>
|
Fixed the Basically, we just don't use buildctl anymore. The only reason it was in our engine image was for the The other issue was due to caching of our cc @jedevc @vito this now has meaningful changes outside go.mod, PTAL |
Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Erik Sipsma <[email protected]>
* Bump otelgrpc to v0.46.0 This fix one of issues, founded in trivy scan job [1]. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Run go mod tidy to clean up dependencies Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Bump go.opentelemetry.io/otel/sdk to 1.20.0 Since bump otelgrpc, it's required to bump otel/sdk to 1.20. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * engine: use our own dial-stdio binary rather than buildctl The buildctl binary is currently required in the engine image since it facilitates connhelpers connecting to the engine inside (by proxying the stdio of an exec'd buildctl process to the unix socket). This is inherited from buildkit and how Dagger has worked for a while. The problem is we keep running into vulnerabilities in this binary that take a while for upstream to fix (i.e. related to otel/grpc), which leaves us to resort to various hacks to get a binary w/out vulnerabilities in the engine image. This change moves us off of upstream's buildctl binary and instead replaces it with the absolute minimal features we need in `./cmd/dialstdio`. There's none of the buildctl subcommands except dial-stdio. This allows us to easily build it from our own go.mod (which makes dependency upgrades easier) and also results in most problematic sources of dependencies no longer being present. The source code for the dial-stdio functionality is mostly a fork of upstream, except all the other adjacent code we don't need has been stripped out. I also switched to use cobra to be consistent w/ our other binaries and avoid a separate dependency on urfave/cli. Attribution on the original source code is given w/ a NOTICE and BUILDKIT_AUTHORS file, same as we did w/ `./cmd/engine`. Signed-off-by: Erik Sipsma <[email protected]> * ci: invalidate apk install of engine image once per day. We currently are in a situation where the engine image is being built and installing apk packages that are vulnerable. Alpine released newer versions of the packages a few days ago, but we are still hitting cache for the "apk add" execs from before then and thus aren't picking them up. The real fix to this is to switch CI to use Zenith and use one of the various apk/apko/wolfi modules that have been written which avoid this problem, e.g. https://daggerverse.dev/mod/github.com/sipsma/daggerverse/apk@d709dd631e176025ea042dc03fdc90197f4b12ba However, in the meantime this change just wraps the apk add w/ an env var that changes once per day (current unix time / 1 day in seconds), which will hold us over until then. Signed-off-by: Erik Sipsma <[email protected]> * engine: ignore deprecation lints about otelgrpc interceptors. It's not immediately clear how to replace the interceptors with the suggested "NewServerHandler" while still working w/ grpc_middleware. It's possible that's already do-able and I just haven't seen exactly how yet; I didn't invest a ton of time into this since we aren't really using otel yet. Upstream buildkit will also need to deal with this once they upgrade so we can see what they end up doing too. Signed-off-by: Erik Sipsma <[email protected]> * Use time.Truncate to simplify apk cache expiry Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> --------- Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Christian Schlatter <[email protected]>
* Bump otelgrpc to v0.46.0 This fix one of issues, founded in trivy scan job [1]. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Run go mod tidy to clean up dependencies Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Bump go.opentelemetry.io/otel/sdk to 1.20.0 Since bump otelgrpc, it's required to bump otel/sdk to 1.20. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * engine: use our own dial-stdio binary rather than buildctl The buildctl binary is currently required in the engine image since it facilitates connhelpers connecting to the engine inside (by proxying the stdio of an exec'd buildctl process to the unix socket). This is inherited from buildkit and how Dagger has worked for a while. The problem is we keep running into vulnerabilities in this binary that take a while for upstream to fix (i.e. related to otel/grpc), which leaves us to resort to various hacks to get a binary w/out vulnerabilities in the engine image. This change moves us off of upstream's buildctl binary and instead replaces it with the absolute minimal features we need in `./cmd/dialstdio`. There's none of the buildctl subcommands except dial-stdio. This allows us to easily build it from our own go.mod (which makes dependency upgrades easier) and also results in most problematic sources of dependencies no longer being present. The source code for the dial-stdio functionality is mostly a fork of upstream, except all the other adjacent code we don't need has been stripped out. I also switched to use cobra to be consistent w/ our other binaries and avoid a separate dependency on urfave/cli. Attribution on the original source code is given w/ a NOTICE and BUILDKIT_AUTHORS file, same as we did w/ `./cmd/engine`. Signed-off-by: Erik Sipsma <[email protected]> * ci: invalidate apk install of engine image once per day. We currently are in a situation where the engine image is being built and installing apk packages that are vulnerable. Alpine released newer versions of the packages a few days ago, but we are still hitting cache for the "apk add" execs from before then and thus aren't picking them up. The real fix to this is to switch CI to use Zenith and use one of the various apk/apko/wolfi modules that have been written which avoid this problem, e.g. https://daggerverse.dev/mod/github.com/sipsma/daggerverse/apk@d709dd631e176025ea042dc03fdc90197f4b12ba However, in the meantime this change just wraps the apk add w/ an env var that changes once per day (current unix time / 1 day in seconds), which will hold us over until then. Signed-off-by: Erik Sipsma <[email protected]> * engine: ignore deprecation lints about otelgrpc interceptors. It's not immediately clear how to replace the interceptors with the suggested "NewServerHandler" while still working w/ grpc_middleware. It's possible that's already do-able and I just haven't seen exactly how yet; I didn't invest a ton of time into this since we aren't really using otel yet. Upstream buildkit will also need to deal with this once they upgrade so we can see what they end up doing too. Signed-off-by: Erik Sipsma <[email protected]> * Use time.Truncate to simplify apk cache expiry Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> --------- Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Alex Suraci <[email protected]>
* Bump otelgrpc to v0.46.0 This fix one of issues, founded in trivy scan job [1]. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Run go mod tidy to clean up dependencies Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Bump go.opentelemetry.io/otel/sdk to 1.20.0 Since bump otelgrpc, it's required to bump otel/sdk to 1.20. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * engine: use our own dial-stdio binary rather than buildctl The buildctl binary is currently required in the engine image since it facilitates connhelpers connecting to the engine inside (by proxying the stdio of an exec'd buildctl process to the unix socket). This is inherited from buildkit and how Dagger has worked for a while. The problem is we keep running into vulnerabilities in this binary that take a while for upstream to fix (i.e. related to otel/grpc), which leaves us to resort to various hacks to get a binary w/out vulnerabilities in the engine image. This change moves us off of upstream's buildctl binary and instead replaces it with the absolute minimal features we need in `./cmd/dialstdio`. There's none of the buildctl subcommands except dial-stdio. This allows us to easily build it from our own go.mod (which makes dependency upgrades easier) and also results in most problematic sources of dependencies no longer being present. The source code for the dial-stdio functionality is mostly a fork of upstream, except all the other adjacent code we don't need has been stripped out. I also switched to use cobra to be consistent w/ our other binaries and avoid a separate dependency on urfave/cli. Attribution on the original source code is given w/ a NOTICE and BUILDKIT_AUTHORS file, same as we did w/ `./cmd/engine`. Signed-off-by: Erik Sipsma <[email protected]> * ci: invalidate apk install of engine image once per day. We currently are in a situation where the engine image is being built and installing apk packages that are vulnerable. Alpine released newer versions of the packages a few days ago, but we are still hitting cache for the "apk add" execs from before then and thus aren't picking them up. The real fix to this is to switch CI to use Zenith and use one of the various apk/apko/wolfi modules that have been written which avoid this problem, e.g. https://daggerverse.dev/mod/github.com/sipsma/daggerverse/apk@d709dd631e176025ea042dc03fdc90197f4b12ba However, in the meantime this change just wraps the apk add w/ an env var that changes once per day (current unix time / 1 day in seconds), which will hold us over until then. Signed-off-by: Erik Sipsma <[email protected]> * engine: ignore deprecation lints about otelgrpc interceptors. It's not immediately clear how to replace the interceptors with the suggested "NewServerHandler" while still working w/ grpc_middleware. It's possible that's already do-able and I just haven't seen exactly how yet; I didn't invest a ton of time into this since we aren't really using otel yet. Upstream buildkit will also need to deal with this once they upgrade so we can see what they end up doing too. Signed-off-by: Erik Sipsma <[email protected]> * Use time.Truncate to simplify apk cache expiry Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> --------- Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Alex Suraci <[email protected]>
* Bump otelgrpc to v0.46.0 This fix one of issues, founded in trivy scan job [1]. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Run go mod tidy to clean up dependencies Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Bump go.opentelemetry.io/otel/sdk to 1.20.0 Since bump otelgrpc, it's required to bump otel/sdk to 1.20. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * engine: use our own dial-stdio binary rather than buildctl The buildctl binary is currently required in the engine image since it facilitates connhelpers connecting to the engine inside (by proxying the stdio of an exec'd buildctl process to the unix socket). This is inherited from buildkit and how Dagger has worked for a while. The problem is we keep running into vulnerabilities in this binary that take a while for upstream to fix (i.e. related to otel/grpc), which leaves us to resort to various hacks to get a binary w/out vulnerabilities in the engine image. This change moves us off of upstream's buildctl binary and instead replaces it with the absolute minimal features we need in `./cmd/dialstdio`. There's none of the buildctl subcommands except dial-stdio. This allows us to easily build it from our own go.mod (which makes dependency upgrades easier) and also results in most problematic sources of dependencies no longer being present. The source code for the dial-stdio functionality is mostly a fork of upstream, except all the other adjacent code we don't need has been stripped out. I also switched to use cobra to be consistent w/ our other binaries and avoid a separate dependency on urfave/cli. Attribution on the original source code is given w/ a NOTICE and BUILDKIT_AUTHORS file, same as we did w/ `./cmd/engine`. Signed-off-by: Erik Sipsma <[email protected]> * ci: invalidate apk install of engine image once per day. We currently are in a situation where the engine image is being built and installing apk packages that are vulnerable. Alpine released newer versions of the packages a few days ago, but we are still hitting cache for the "apk add" execs from before then and thus aren't picking them up. The real fix to this is to switch CI to use Zenith and use one of the various apk/apko/wolfi modules that have been written which avoid this problem, e.g. https://daggerverse.dev/mod/github.com/sipsma/daggerverse/apk@d709dd631e176025ea042dc03fdc90197f4b12ba However, in the meantime this change just wraps the apk add w/ an env var that changes once per day (current unix time / 1 day in seconds), which will hold us over until then. Signed-off-by: Erik Sipsma <[email protected]> * engine: ignore deprecation lints about otelgrpc interceptors. It's not immediately clear how to replace the interceptors with the suggested "NewServerHandler" while still working w/ grpc_middleware. It's possible that's already do-able and I just haven't seen exactly how yet; I didn't invest a ton of time into this since we aren't really using otel yet. Upstream buildkit will also need to deal with this once they upgrade so we can see what they end up doing too. Signed-off-by: Erik Sipsma <[email protected]> * Use time.Truncate to simplify apk cache expiry Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> --------- Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Alex Suraci <[email protected]>
* Bump otelgrpc to v0.46.0 This fix one of issues, founded in trivy scan job [1]. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Run go mod tidy to clean up dependencies Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Bump go.opentelemetry.io/otel/sdk to 1.20.0 Since bump otelgrpc, it's required to bump otel/sdk to 1.20. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * engine: use our own dial-stdio binary rather than buildctl The buildctl binary is currently required in the engine image since it facilitates connhelpers connecting to the engine inside (by proxying the stdio of an exec'd buildctl process to the unix socket). This is inherited from buildkit and how Dagger has worked for a while. The problem is we keep running into vulnerabilities in this binary that take a while for upstream to fix (i.e. related to otel/grpc), which leaves us to resort to various hacks to get a binary w/out vulnerabilities in the engine image. This change moves us off of upstream's buildctl binary and instead replaces it with the absolute minimal features we need in `./cmd/dialstdio`. There's none of the buildctl subcommands except dial-stdio. This allows us to easily build it from our own go.mod (which makes dependency upgrades easier) and also results in most problematic sources of dependencies no longer being present. The source code for the dial-stdio functionality is mostly a fork of upstream, except all the other adjacent code we don't need has been stripped out. I also switched to use cobra to be consistent w/ our other binaries and avoid a separate dependency on urfave/cli. Attribution on the original source code is given w/ a NOTICE and BUILDKIT_AUTHORS file, same as we did w/ `./cmd/engine`. Signed-off-by: Erik Sipsma <[email protected]> * ci: invalidate apk install of engine image once per day. We currently are in a situation where the engine image is being built and installing apk packages that are vulnerable. Alpine released newer versions of the packages a few days ago, but we are still hitting cache for the "apk add" execs from before then and thus aren't picking them up. The real fix to this is to switch CI to use Zenith and use one of the various apk/apko/wolfi modules that have been written which avoid this problem, e.g. https://daggerverse.dev/mod/github.com/sipsma/daggerverse/apk@d709dd631e176025ea042dc03fdc90197f4b12ba However, in the meantime this change just wraps the apk add w/ an env var that changes once per day (current unix time / 1 day in seconds), which will hold us over until then. Signed-off-by: Erik Sipsma <[email protected]> * engine: ignore deprecation lints about otelgrpc interceptors. It's not immediately clear how to replace the interceptors with the suggested "NewServerHandler" while still working w/ grpc_middleware. It's possible that's already do-able and I just haven't seen exactly how yet; I didn't invest a ton of time into this since we aren't really using otel yet. Upstream buildkit will also need to deal with this once they upgrade so we can see what they end up doing too. Signed-off-by: Erik Sipsma <[email protected]> * Use time.Truncate to simplify apk cache expiry Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> --------- Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Alex Suraci <[email protected]>
* Bump otelgrpc to v0.46.0 This fix one of issues, founded in trivy scan job [1]. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Run go mod tidy to clean up dependencies Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * Bump go.opentelemetry.io/otel/sdk to 1.20.0 Since bump otelgrpc, it's required to bump otel/sdk to 1.20. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> * engine: use our own dial-stdio binary rather than buildctl The buildctl binary is currently required in the engine image since it facilitates connhelpers connecting to the engine inside (by proxying the stdio of an exec'd buildctl process to the unix socket). This is inherited from buildkit and how Dagger has worked for a while. The problem is we keep running into vulnerabilities in this binary that take a while for upstream to fix (i.e. related to otel/grpc), which leaves us to resort to various hacks to get a binary w/out vulnerabilities in the engine image. This change moves us off of upstream's buildctl binary and instead replaces it with the absolute minimal features we need in `./cmd/dialstdio`. There's none of the buildctl subcommands except dial-stdio. This allows us to easily build it from our own go.mod (which makes dependency upgrades easier) and also results in most problematic sources of dependencies no longer being present. The source code for the dial-stdio functionality is mostly a fork of upstream, except all the other adjacent code we don't need has been stripped out. I also switched to use cobra to be consistent w/ our other binaries and avoid a separate dependency on urfave/cli. Attribution on the original source code is given w/ a NOTICE and BUILDKIT_AUTHORS file, same as we did w/ `./cmd/engine`. Signed-off-by: Erik Sipsma <[email protected]> * ci: invalidate apk install of engine image once per day. We currently are in a situation where the engine image is being built and installing apk packages that are vulnerable. Alpine released newer versions of the packages a few days ago, but we are still hitting cache for the "apk add" execs from before then and thus aren't picking them up. The real fix to this is to switch CI to use Zenith and use one of the various apk/apko/wolfi modules that have been written which avoid this problem, e.g. https://daggerverse.dev/mod/github.com/sipsma/daggerverse/apk@d709dd631e176025ea042dc03fdc90197f4b12ba However, in the meantime this change just wraps the apk add w/ an env var that changes once per day (current unix time / 1 day in seconds), which will hold us over until then. Signed-off-by: Erik Sipsma <[email protected]> * engine: ignore deprecation lints about otelgrpc interceptors. It's not immediately clear how to replace the interceptors with the suggested "NewServerHandler" while still working w/ grpc_middleware. It's possible that's already do-able and I just haven't seen exactly how yet; I didn't invest a ton of time into this since we aren't really using otel yet. Upstream buildkit will also need to deal with this once they upgrade so we can see what they end up doing too. Signed-off-by: Erik Sipsma <[email protected]> * Use time.Truncate to simplify apk cache expiry Co-authored-by: Alex Suraci <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> --------- Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Signed-off-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Erik Sipsma <[email protected]> Co-authored-by: Alex Suraci <[email protected]>
Found in the Trivy scan in #6099. Bump
otelgrpclibrary to 0.46.0 and cleanup dependencies withgo mod tidy.