-
Notifications
You must be signed in to change notification settings - Fork 43
feat(openbao): import the JWT secrets plugin under infra/openbao #647
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
Open
balajinvda
wants to merge
8
commits into
main
Choose a base branch
from
feat/openbao-jwt-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
48e85e9
feat(openbao): import the JWT secrets plugin under infra/openbao
balaji-g b6aad63
ci(openbao): build and test the JWT plugin outside the Bazel graph
balaji-g f33c1cf
feat(openbao): import the image source and build the plugin in-image
balaji-g 85fb845
chore(license): regenerate NOTICE for the imported plugin
balaji-g 4525c79
fix(openbao): address review and make the verifier match the build
balaji-g ed923b5
fix(openbao): return the unsupported-algorithm error and stop leaking…
balaji-g be90a69
fix(openbao): address review on the imported image source
balaji-g 27687ba
chore(deps): regenerate dependencies.md for the imported plugin
balaji-g 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Build and test the OpenBao JWT secrets plugin. | ||
| # | ||
| # This module is deliberately NOT in go.work.bazel and has no BUILD.bazel, so | ||
| # the Bazel matrix in bazel.yml never sees it. That is the point: its graph is | ||
| # 278 modules including hashicorp/vault/api and hashicorp/vault/sdk, none of | ||
| # which the root module uses today. Joining the root graph would put all of it | ||
| # into minimal version selection for every service in the repository, to build | ||
| # one plugin binary that ships inside a single image. | ||
| # | ||
| # The cost of that isolation is that nothing else would compile or test this | ||
| # code, and NVIDIA now owns modifications to it. Hence this job: plain go, | ||
| # scoped to the one directory, so the tests actually run. | ||
|
|
||
| name: openbao-jwt-plugin | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'infra/openbao/plugins/vault-plugin-secrets-jwt/**' | ||
| - '.github/workflows/openbao-jwt-plugin.yml' | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'infra/openbao/plugins/vault-plugin-secrets-jwt/**' | ||
| - '.github/workflows/openbao-jwt-plugin.yml' | ||
| merge_group: | ||
| types: [checks_requested] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: openbao-jwt-plugin-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build-test: | ||
| name: build and test | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: infra/openbao/plugins/vault-plugin-secrets-jwt | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: infra/openbao/plugins/vault-plugin-secrets-jwt/go.mod | ||
| cache-dependency-path: infra/openbao/plugins/vault-plugin-secrets-jwt/go.sum | ||
|
|
||
| - name: Build | ||
| run: go build ./... | ||
|
|
||
| - name: Test | ||
| run: go test ./... | ||
|
|
||
| # The plugin must not regain a dependency on friendlyid-go. That project | ||
| # carries no license and is not redistributable; plugin/friendlyid.go is | ||
| # the independently authored replacement. A `go get` that reintroduces it | ||
| # would be a licensing regression, not a build failure, so nothing else | ||
| # would catch it. | ||
| - name: Assert no unlicensed dependency | ||
| run: | | ||
| # Capture first rather than piping into grep. Inside `if`, a failing | ||
| # `go list` would otherwise read as "dependency absent", and under | ||
| # pipefail grep can close the pipe on a match and leave go list | ||
| # killed by SIGPIPE. Either way the gate would pass while blind. | ||
| modules="$(go list -m all)" || { | ||
| echo "::error::failed to enumerate the Go module graph" >&2 | ||
| exit 1 | ||
| } | ||
| if grep -Fq 'github.com/mariuszs/friendlyid-go' <<<"$modules"; then | ||
| echo "::error::friendlyid-go is back in the module graph; it carries no license and cannot be redistributed" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "friendlyid-go absent from the module graph" | ||
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,15 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # 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 | ||
| # | ||
| # https://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. | ||
|
|
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,35 @@ | ||
| # The JWT secrets plugin is compiled here rather than copied in prebuilt. | ||
| # | ||
| # It used to come from scripts/build-jwt-plugin.sh, which cloned a fork hosted | ||
| # outside this repository at a pinned revision and dropped the binaries into | ||
| # files/plugins/. That made the image unbuildable from public source, so the | ||
| # binaries had to reach the build some other way: committed to git, or injected | ||
| # as a private overlay the way the cassandra image takes its exporter jar. | ||
| # | ||
| # Neither is needed now. The plugin source lives at plugins/ inside this build | ||
| # context, so the stage below compiles it from the same commit that produces | ||
| # the image. Nothing is vendored and nothing is injected, so `docker build .` | ||
| # here produces the same image as the release pipeline. | ||
| ARG BAO_VERSION=2.5.5 | ||
| ARG GO_VERSION=1.25 | ||
|
|
||
| FROM golang:${GO_VERSION}-alpine AS plugin-build | ||
| ARG TARGETARCH | ||
| WORKDIR /src | ||
| # Module files first so dependency download caches independently of source edits. | ||
| COPY plugins/vault-plugin-secrets-jwt/go.mod plugins/vault-plugin-secrets-jwt/go.sum ./ | ||
| RUN go mod download | ||
| COPY plugins/vault-plugin-secrets-jwt/ ./ | ||
| # CGO_ENABLED=0 for a static binary: the plugin is exec'd by the OpenBao server | ||
| # inside a distro image it was not linked against, so it must not need a | ||
| # dynamic loader. -trimpath keeps build paths out of the binary. | ||
| RUN GOOS=linux GOARCH="${TARGETARCH}" CGO_ENABLED=0 \ | ||
| go build -trimpath -o /out/vault-plugin-secrets-jwt ./cmd/vault-plugin-secrets-jwt | ||
|
|
||
| FROM openbao/openbao:${BAO_VERSION} | ||
|
|
||
| # hadolint ignore=DL3018 | ||
| RUN apk add --no-cache curl jq bash && \ | ||
| mkdir -p /openbao/plugins | ||
|
|
||
| COPY --from=plugin-build --chmod=0555 /out/vault-plugin-secrets-jwt /openbao/plugins/vault-plugin-secrets-jwt |
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 @@ | ||
| # NVCF OpenBao | ||
|
|
||
| Container image used by NVCF deployments to run [OpenBao](https://openbao.org/), bundled with the additional vault plugin(s) NVCF expects at runtime. | ||
|
|
||
| ## Overview | ||
|
|
||
| This repository ships: | ||
|
|
||
| - A multi-arch container image definition (`Dockerfile`) layered on top of `openbao/openbao` | ||
| - A directory (`files/plugins/`) where the user supplies the vault plugin binary at build time | ||
|
|
||
| ## Plugin binaries | ||
|
|
||
| The image expects an OS-specific plugin binary at build time, placed at: | ||
|
|
||
| - `files/plugins/vault-plugin-secrets-jwt-linux-amd64` (for `--platform linux/amd64`) | ||
| - `files/plugins/vault-plugin-secrets-jwt-linux-arm64` (for `--platform linux/arm64`) | ||
|
|
||
| The plugin is built from source in this repository, at | ||
| `plugins/vault-plugin-secrets-jwt`. Nothing needs to be cloned or placed by | ||
| hand, and no binaries are committed. | ||
|
|
||
| The image build compiles it in a Dockerfile build stage, so `docker build .` | ||
| here produces the same image as the release pipeline: | ||
|
|
||
| ```bash | ||
| docker build --build-arg TARGETARCH=amd64 -t nvcf-openbao:local . | ||
| ``` | ||
|
|
||
| To produce the binaries outside an image build, for local inspection or to run | ||
| the verifier: | ||
|
|
||
| ```bash | ||
| scripts/build-jwt-plugin.sh # writes both arch binaries to files/plugins/ | ||
| scripts/verify-jwt-plugin.sh # asserts module path, target, toolchain, deps | ||
| ``` | ||
|
|
||
| `files/plugins/` is gitignored apart from `.gitkeep`; see | ||
| `files/plugins/PROVENANCE.md` for the dependency floors the verifier enforces. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Docker or another OCI-compatible builder (with `buildx` for multi-arch) | ||
| - A built copy of `vault-plugin-secrets-jwt` for each platform you target, placed in `files/plugins/` | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| ## Building the container | ||
|
|
||
| The `Dockerfile` defaults to the `openbao/openbao:2.5.5` base image. Override the `BAO_VERSION` build-arg to track a different upstream tag. | ||
|
|
||
| ```bash | ||
| docker build \ | ||
| --build-arg TARGETARCH=amd64 \ | ||
| --build-arg BAO_VERSION=2.5.5 \ | ||
| -t <your-registry>/<your-org>/nvcf-openbao:<version> . | ||
| ``` | ||
|
|
||
| For multi-arch builds: | ||
|
|
||
| ```bash | ||
| docker buildx build \ | ||
| --platform linux/amd64,linux/arm64 \ | ||
| --build-arg BAO_VERSION=2.5.5 \ | ||
| -t <your-registry>/<your-org>/nvcf-openbao:<version> \ | ||
| --push . | ||
| ``` | ||
|
|
||
| ## Image contents | ||
|
|
||
| At runtime the image provides: | ||
|
|
||
| - The upstream OpenBao server (`/usr/local/bin/bao`) | ||
| - Alpine packages `curl`, `jq`, and `bash` (used by entrypoint scripts in consumers such as the migrations Job) | ||
| - `/openbao/plugins/vault-plugin-secrets-jwt` - the JWT secrets plugin built from `outfoxx/vault-plugin-secrets-jwt` | ||
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 @@ | ||
| vault-plugin-secrets-jwt-linux-* |
Empty file.
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,35 @@ | ||
| # JWT plugin provenance | ||
|
|
||
| The `vault-plugin-secrets-jwt` binaries in this directory are build output. | ||
| They are not committed; `.gitignore` excludes them and only `.gitkeep` ships. | ||
|
|
||
| ## Source | ||
|
|
||
| `../../plugins/vault-plugin-secrets-jwt` in this repository. The plugin is a | ||
| modified copy of the Apache-2.0 project `outfoxx/vault-plugin-secrets-jwt`; | ||
| that directory's `NOTICE` enumerates every NVIDIA change. | ||
|
|
||
| The image build compiles the plugin from that source in a Dockerfile build | ||
| stage, so the binary and the image come from the same commit. Nothing is | ||
| fetched from outside this repository at build time. | ||
|
|
||
| ## Dependency floors | ||
|
|
||
| Held deliberately, not incidental to a `go mod tidy`: | ||
|
|
||
| - `golang.org/x/net v0.55.0` - security floor | ||
| - `github.com/hashicorp/vault/api v1.15.0` | ||
| - `github.com/hashicorp/vault/sdk v0.15.2` | ||
| - `google.golang.org/grpc v1.69.4` | ||
| - `github.com/go-jose/go-jose/v4 v4.0.4` | ||
|
|
||
| The vault and grpc pins keep compatibility with the previously shipped plugin | ||
| binary. `scripts/verify-jwt-plugin.sh` asserts them against the built artifact. | ||
|
|
||
| ## Local build | ||
|
|
||
| scripts/build-jwt-plugin.sh # writes both arch binaries here | ||
| scripts/verify-jwt-plugin.sh # asserts module path, target, toolchain, deps | ||
|
|
||
| Hashes are reported by the verifier rather than pinned: any source change in | ||
| this repository legitimately changes them. |
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,30 @@ | ||
| # vault-plugin-secrets-jwt | ||
|
|
||
| Third-party code. This is a modified copy of | ||
| [outfoxx/vault-plugin-secrets-jwt](https://github.com/outfoxx/vault-plugin-secrets-jwt), | ||
| Apache-2.0, Copyright 2021 Outfox, Inc. Read `NOTICE` before changing anything | ||
| here; it enumerates every NVIDIA modification, which Apache-2.0 section 4(b) | ||
| requires us to keep accurate. | ||
|
|
||
| ## Rules | ||
|
|
||
| Do not run the repository copyright stamper over this directory. Files that | ||
| carry the upstream Outfox header must keep it. Add an NVIDIA header only to a | ||
| file NVIDIA authored, and record the change in `NOTICE` in the same commit. | ||
|
|
||
| The Go module path is | ||
| `github.com/NVIDIA/nvcf/infra/openbao/plugins/vault-plugin-secrets-jwt`, which | ||
| deliberately differs from the upstream path. We do not track upstream, so the | ||
| path was changed to resolve inside this repository rather than to keep diffs | ||
| against Outfox readable. | ||
|
|
||
| There is no dependency on `github.com/mariuszs/friendlyid-go` and there must | ||
| not be one. That project carries no license and is not redistributable; | ||
| `plugin/friendlyid.go` is the independently authored replacement. | ||
|
|
||
| ## Build and test | ||
|
|
||
| go build ./... | ||
| go test ./... | ||
|
|
||
| The image build that consumes this lives in `infra/openbao`. |
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 @@ | ||
| @AGENTS.md |
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,14 @@ | ||
| Copyright 2021 Outfox, Inc. | ||
|
|
||
| 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. | ||
|
|
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.