-
Notifications
You must be signed in to change notification settings - Fork 67
fix(openbao-migrations): refresh bundled security dependencies #1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+571
−36
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4113d71
build(openbao-migrations): refresh kubectl binary
sbaum1994 acad337
build(openbao-migrations): rebuild Bao dependencies
sbaum1994 843abda
fix(openbao): support non-root migration hooks
sbaum1994 b7e50db
fix(openbao-migrations): harden dependency verification
sbaum1994 c50f50a
fix(openbao-migrations): reject malformed versions
sbaum1994 89d0dd3
fix(openbao-migrations): preserve Kubernetes client skew
sbaum1994 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #!/bin/sh | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -eu | ||
|
|
||
| kubectl_version=${KUBECTL_VERSION:-v1.36.4} | ||
| kubectl_source_commit=${KUBECTL_SOURCE_COMMIT:-bb826b1d48562f110659e64e8ec444327433db95} | ||
| kubectl_source_sha256=${KUBECTL_SOURCE_SHA256:-3c28f11492472df48e658551bf268fd92938b127b0f9dcef7090ac800318c821} | ||
| kubectl_build_date=${KUBECTL_BUILD_DATE:-2026-08-20T03:09:25Z} | ||
| kubectl_source_date_epoch=${KUBECTL_SOURCE_DATE_EPOCH:-1787195365} | ||
| target_arch=${TARGETARCH:?TARGETARCH must be set} | ||
| output_dir=${OUTPUT_DIR:-/out} | ||
| source_url=${KUBECTL_SOURCE_URL:-"https://dl.k8s.io/${kubectl_version}/kubernetes-src.tar.gz"} | ||
|
|
||
| case "$target_arch" in | ||
| amd64 | arm64) ;; | ||
| *) | ||
| echo "unsupported kubectl architecture: $target_arch" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| work_dir=$(mktemp -d "${TMPDIR:-/tmp}/nvcf-kubectl-source.XXXXXX") | ||
| cleanup() { | ||
| rm -rf "$work_dir" | ||
| } | ||
| trap cleanup EXIT INT TERM | ||
|
|
||
| archive="$work_dir/kubernetes-src.tar.gz" | ||
| source_dir="$work_dir/source" | ||
| mkdir -p "$source_dir" "$output_dir" | ||
|
|
||
| curl --fail --location --silent --show-error "$source_url" --output "$archive" | ||
| printf '%s %s\n' "$kubectl_source_sha256" "$archive" | sha256sum -c - | ||
| tar -xzf "$archive" -C "$source_dir" | ||
|
|
||
| version_ldflags="" | ||
| for package in k8s.io/client-go/pkg/version k8s.io/component-base/version; do | ||
| version_ldflags="$version_ldflags -X ${package}.gitVersion=${kubectl_version}" | ||
| version_ldflags="$version_ldflags -X ${package}.gitCommit=${kubectl_source_commit}" | ||
| version_ldflags="$version_ldflags -X ${package}.gitTreeState=clean" | ||
| version_ldflags="$version_ldflags -X ${package}.buildDate=${kubectl_build_date}" | ||
| version_ldflags="$version_ldflags -X ${package}.gitMajor=1" | ||
| version_ldflags="$version_ldflags -X ${package}.gitMinor=36" | ||
| done | ||
|
|
||
| ( | ||
| cd "$source_dir" | ||
| CGO_ENABLED=0 \ | ||
| GOOS=linux \ | ||
| GOARCH="$target_arch" \ | ||
| GOTOOLCHAIN=local \ | ||
| GOPROXY=off \ | ||
| SOURCE_DATE_EPOCH="$kubectl_source_date_epoch" \ | ||
| go build \ | ||
| -mod=vendor \ | ||
| -trimpath \ | ||
| -buildvcs=false \ | ||
| -tags=selinux,notest,grpcnotrace \ | ||
| -ldflags="-s -w -buildid=${version_ldflags}" \ | ||
| -o "$output_dir/kubectl" \ | ||
| ./cmd/kubectl | ||
| ) | ||
|
|
||
| chmod 0555 "$output_dir/kubectl" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| #!/bin/sh | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -eu | ||
|
|
||
| script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) | ||
| repo_root=$(CDPATH= cd -- "$script_dir/.." && pwd) | ||
|
|
||
| bao_version=${BAO_VERSION:-2.6.2} | ||
| bao_source_commit=${BAO_SOURCE_COMMIT:-dd9c19c37a878cf4a81b18efb8d6f0599c7da923} | ||
| bao_source_sha256=${BAO_SOURCE_SHA256:-a7784550a9db16f24e99d65a18c9b12a433707c79ef4c1f34262d3f48171c7a9} | ||
| bao_commit_date=${BAO_COMMIT_DATE:-2026-08-18T15:43:05Z} | ||
| x_crypto_version=${X_CRYPTO_VERSION:-v0.56.0} | ||
| grpc_version=${GRPC_VERSION:-v1.83.1} | ||
| go_archive_version=${GO_ARCHIVE_VERSION:-v0.3.0} | ||
| output_dir=${OUTPUT_DIR:-"$repo_root/files/openbao"} | ||
| source_url=${BAO_SOURCE_URL:-"https://github.com/openbao/openbao/releases/download/v${bao_version}/openbao-dist-v${bao_version}.tar.xz"} | ||
|
|
||
| if [ -n "${WORK_DIR:-}" ]; then | ||
| work_dir=$WORK_DIR | ||
| work_dir_is_ours=0 | ||
| else | ||
| work_dir=$(mktemp -d "${TMPDIR:-/tmp}/nvcf-openbao-source.XXXXXX") | ||
| work_dir_is_ours=1 | ||
| fi | ||
|
|
||
| cleanup() { | ||
| if [ -z "${KEEP_WORK_DIR:-}" ] && [ "$work_dir_is_ours" = "1" ]; then | ||
| rm -rf "$work_dir" | ||
| else | ||
| echo "Keeping work dir: $work_dir" | ||
| fi | ||
| } | ||
| trap cleanup EXIT INT TERM | ||
|
|
||
| archive="$work_dir/openbao.tar.xz" | ||
| source_dir="$work_dir/source" | ||
| mkdir -p "$source_dir" "$output_dir" | ||
|
|
||
| curl --fail --location --silent --show-error "$source_url" --output "$archive" | ||
| printf '%s %s\n' "$bao_source_sha256" "$archive" | sha256sum -c - | ||
| tar -xJf "$archive" --strip-components=1 -C "$source_dir" | ||
|
|
||
| ( | ||
| cd "$source_dir" | ||
| GOFLAGS=-mod=mod go get \ | ||
| "golang.org/x/crypto@${x_crypto_version}" \ | ||
| "google.golang.org/grpc@${grpc_version}" \ | ||
| "github.com/moby/go-archive@${go_archive_version}" | ||
| GOFLAGS=-mod=mod go mod tidy | ||
| GOFLAGS=-mod=mod go mod verify | ||
|
|
||
| if [ -n "${TARGETARCH:-}" ]; then | ||
| arches=$TARGETARCH | ||
| else | ||
| arches="amd64 arm64" | ||
| fi | ||
|
|
||
| for arch in $arches; do | ||
| CGO_ENABLED=0 GOOS=linux GOARCH="$arch" go build \ | ||
| -mod=mod \ | ||
| -buildvcs=false \ | ||
| -trimpath \ | ||
| -tags ui \ | ||
| -ldflags "-s -w -X github.com/openbao/openbao/version.fullVersion=${bao_version} -X github.com/openbao/openbao/version.GitCommit=${bao_source_commit} -X github.com/openbao/openbao/version.CommitDate=${bao_commit_date}" \ | ||
| -o "$output_dir/bao-linux-${arch}" \ | ||
| . | ||
| chmod 555 "$output_dir/bao-linux-${arch}" | ||
| done | ||
| ) | ||
|
|
||
| BAO_DIR="$output_dir" ARCHES="${TARGETARCH:-amd64 arm64}" "$script_dir/verify-openbao.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/sh | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -eu | ||
|
|
||
| kubectl=${KUBECTL_BINARY:-/out/kubectl} | ||
| kubectl_go_version=${KUBECTL_GO_VERSION:-go1.26.6} | ||
| target_arch=${TARGETARCH:?TARGETARCH must be set} | ||
| metadata=$(mktemp) | ||
| trap 'rm -f "$metadata"' EXIT INT TERM | ||
|
|
||
| go version -m "$kubectl" >"$metadata" | ||
|
|
||
| actual_go_version=$(awk 'NR == 1 { print $2 }' "$metadata") | ||
| path=$(awk '$1 == "path" { print $2 }' "$metadata") | ||
| goos=$(awk '$1 == "build" && $2 ~ /^GOOS=/ { sub(/^GOOS=/, "", $2); print $2 }' "$metadata") | ||
| goarch=$(awk '$1 == "build" && $2 ~ /^GOARCH=/ { sub(/^GOARCH=/, "", $2); print $2 }' "$metadata") | ||
| cgo_enabled=$(awk '$1 == "build" && $2 ~ /^CGO_ENABLED=/ { sub(/^CGO_ENABLED=/, "", $2); print $2 }' "$metadata") | ||
|
|
||
| if [ "$actual_go_version" != "$kubectl_go_version" ]; then | ||
| echo "$kubectl embeds $actual_go_version; expected $kubectl_go_version" >&2 | ||
| exit 1 | ||
| fi | ||
| if [ "$path" != "k8s.io/kubernetes/cmd/kubectl" ]; then | ||
| echo "$kubectl has unexpected module path: $path" >&2 | ||
| exit 1 | ||
| fi | ||
| if [ "$goos" != "linux" ] || [ "$goarch" != "$target_arch" ] || [ "$cgo_enabled" != "0" ]; then | ||
| echo "$kubectl has unexpected target metadata: GOOS=$goos GOARCH=$goarch CGO_ENABLED=$cgo_enabled" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "verified $kubectl: $kubectl_go_version linux/$target_arch" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.