Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/actions/build-rust-binary/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,36 @@ runs:
INPUTS_EXTRA_CARGO_FLAGS: ${{ inputs.extra-cargo-flags }}
run: GIT_DIR=/nonexistent cargo auditable build --release --package "${INPUTS_PACKAGE}" --bin "${INPUTS_BINARY}" ${INPUTS_EXTRA_CARGO_FLAGS}

- name: Normalize Darwin dynamic binary
if: endsWith(inputs.triple, '-apple-darwin')
shell: bash -euo pipefail {0}
env:
INPUTS_BINARY: ${{ inputs.binary }}
run: |
binary=target/release/${INPUTS_BINARY}
nix_iconv_paths=$(otool -L "$binary" | awk '$1 ~ "^/nix/store/.*/lib/libiconv\\.2\\.dylib$" { print $1 }')
if [[ -n "$nix_iconv_paths" ]]; then
while IFS= read -r nix_iconv_path; do
install_name_tool -change "$nix_iconv_path" /usr/lib/libiconv.2.dylib "$binary"
done <<< "$nix_iconv_paths"
codesign --force --sign - "$binary"
fi

- name: Verify Darwin portability
if: endsWith(inputs.triple, '-apple-darwin')
shell: bash -euo pipefail {0}
env:
INPUTS_BINARY: ${{ inputs.binary }}
run: |
binary=target/release/${INPUTS_BINARY}
nix_dependencies=$(otool -L "$binary" | awk '$1 ~ "^/nix/store/" { print $1 }')
if [[ -n "$nix_dependencies" ]]; then
echo "error: $binary has non-portable Nix store dependencies:" >&2
printf ' %s\n' "$nix_dependencies" >&2
exit 1
fi
codesign --verify --verbose=2 "$binary"

- name: Verify ${{ inputs.binary }}
shell: nix develop ${{ inputs.dev-shell }} -c bash -euo pipefail {0}
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ paths:
- python/openshell

paths-ignore:
# Integration-test targets are not removed by the Rust cfg override.
- crates/*/tests
- python/openshell/_proto
- sdk/typescript/src/gen
10 changes: 4 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
name: CodeQL

on:
pull_request:
merge_group:
types: [checks_requested]
push:
branches: [main]
schedule:
- cron: "29 5 * * 6"
- cron: "29 5 * * *"
workflow_dispatch:

permissions:
Expand All @@ -26,6 +21,9 @@ jobs:
name: CodeQL (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 90
env:
# Keep Rust test fixtures out of production-focused security results.
CODEQL_EXTRACTOR_RUST_OPTION_CARGO_CFG_OVERRIDES: "-test"
strategy:
fail-fast: false
matrix:
Expand Down
26 changes: 14 additions & 12 deletions CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ The GitHub ruleset should require the `OpenShell / ...` statuses published by `R
## Informational security reports

Security analysis that does not need NVIDIA infrastructure runs directly on
GitHub-hosted runners. These workflows receive no secrets and run on fork pull
requests without waiting for copy-pr-bot. Scanner jobs request
`security-events: write` to publish SARIF to Code Scanning. GitHub permits
Code Scanning uploads from `pull_request` runs even when fork and Dependabot
contexts receive a read-only `GITHUB_TOKEN`, so each scanner uploads results
directly and also retains report artifacts:
GitHub-hosted runners. These workflows receive no secrets. The PR-oriented
reports run on fork pull requests without waiting for copy-pr-bot. Scanner jobs
request `security-events: write` to publish SARIF to Code Scanning. GitHub
permits Code Scanning uploads from `pull_request` runs even when fork and
Dependabot contexts receive a read-only `GITHUB_TOKEN`, so those scanners upload
results directly and also retain report artifacts:

- `Workflow Security Reports` runs Actionlint and Zizmor. Actionlint reports
workflow syntax and expression findings. Zizmor reports only High severity,
Expand All @@ -46,13 +46,15 @@ directly and also retains report artifacts:
a warning, so the workflow remains neutral until the repository feature is
available.
- `CodeQL` analyzes product Rust code, examples, and the Go, Python, and
TypeScript SDKs. E2E test code is excluded. Results are uploaded to Code
Scanning and always retained as workflow artifacts.
TypeScript SDKs. Rust `cfg(test)` blocks, Rust integration-test targets, and
E2E test code are excluded. It runs nightly on `main`, remains manually
dispatchable for diagnostics, uploads results to Code Scanning, and retains
workflow artifacts.

Findings do not fail these workflows. Tool startup, configuration, build, and
analysis failures still fail so a broken scanner cannot appear healthy. These
workflows also run on merge groups, but their checks are not required statuses
and do not gate merges.
analysis failures still fail so a broken scanner cannot appear healthy. The
PR-oriented reports also run on merge groups; CodeQL is not a PR or merge-queue
check. None of these reports are required statuses or gate merges.

Run the workflow-definition scanners locally with:

Expand Down Expand Up @@ -184,7 +186,7 @@ The bot's full administrator documentation is internal to NVIDIA. The only comma
| `.github/workflows/e2e-label-help.yml` | When a `test:e2e*` label is applied, posts a PR comment telling the maintainer the next manual step (re-run an existing workflow run, or `/ok to test <SHA>` to refresh the mirror). |
| `.github/workflows/workflow-security.yml` | Runs informational Actionlint and High-severity Zizmor reports on GitHub-hosted runners. |
| `.github/workflows/dependency-review.yml` | Reports dependency changes when GitHub Dependency Graph is available; otherwise publishes a neutral warning. |
| `.github/workflows/codeql.yml` | Runs informational CodeQL analysis for Rust and the Go, Python, and TypeScript SDKs and retains SARIF artifacts. |
| `.github/workflows/codeql.yml` | Runs nightly informational CodeQL analysis on `main` for Rust and the Go, Python, and TypeScript SDKs and retains SARIF artifacts. |

## Release workflows

Expand Down
49 changes: 31 additions & 18 deletions architecture/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ The shared binary build action compiles release artifacts with `cargo auditable`
Branch E2E, Release Dev, and Release Tag image jobs stage those same artifacts
instead of rebuilding binaries in Docker. Each binary build scans its output with
Syft and requires at least one decoded Cargo package before uploading the
artifact. The CI image gains the pinned `cargo-auditable` tool through
`mise install --locked` but ships no auditable OpenShell binary of its own.
artifact. Darwin builds replace Nix's `libiconv` load command with the macOS
system install name, ad-hoc sign the modified binary, and fail if `otool -L`
reports any remaining `/nix/store` dependency. Runtime and Syft verification
run after that normalization. The CI image gains the pinned `cargo-auditable`
tool through `mise install --locked` but ships no auditable OpenShell binary of
its own.

Pushed Docker images carry minimal SLSA provenance and a per-platform SPDX SBOM
generated by BuildKit's default Syft scanner. The registry exporter uses OCI
Expand Down Expand Up @@ -280,18 +284,22 @@ disables emission for Rust tests, E2E runs, and release canaries. This prevents
synthetic activity from contributing to product usage metrics.

Static security checks are deliberately outside the mirror-branch path. They run
directly on GitHub-hosted runners with no secrets, so they also cover fork pull
requests and consume no NVIDIA self-hosted capacity. Scanner jobs request
`security-events: write` and upload SARIF to Code Scanning directly on every
event they run on, including fork and Dependabot pull requests, which Code
Scanning permits for `pull_request` runs despite their read-only `GITHUB_TOKEN`.
Each scanner also retains its report as a workflow artifact. No privileged
intermediate workflow relays those uploads.
Triggers differ by workflow: `.github/workflows/workflow-security.yml` and
`.github/workflows/codeql.yml` run on `pull_request`, `merge_group`, `main`, and
a weekly schedule; `.github/workflows/dependency-review.yml` runs on
`pull_request` and `merge_group` only, because it needs a base and head commit
to compare.
directly on GitHub-hosted runners with no secrets, so the pull-request-triggered
ones also cover fork pull requests, and none of them consume NVIDIA self-hosted
capacity. Scanner jobs request `security-events: write` and upload SARIF to Code
Scanning directly on every event they run on, including fork and Dependabot pull
requests, which Code Scanning permits for `pull_request` runs despite their
read-only `GITHUB_TOKEN`. Each scanner also retains its report as a workflow
artifact. No privileged intermediate workflow relays those uploads.
Triggers differ by workflow: `.github/workflows/workflow-security.yml` runs on
`pull_request`, `merge_group`, `main`, and a weekly schedule;
`.github/workflows/dependency-review.yml` runs on `pull_request` and
`merge_group` only, because it needs a base and head commit to compare; and
`.github/workflows/codeql.yml` runs nightly on the default branch (`main`) via
`schedule`, with `workflow_dispatch` kept for manual diagnostics. CodeQL does
not run on `pull_request`, `merge_group`, or pushes to `main`, so it reports
repository-level Code Scanning state on the default branch instead of per-PR
results, and its four-language matrix stays off the per-change critical path.

- **Actionlint and Zizmor** analyze the workflow definitions themselves.
Repository configuration lives in `.github/actionlint.yml` (self-hosted runner
Expand All @@ -307,10 +315,15 @@ to compare.
reporting on its own once the feature is enabled. Reviews run in warn-only
mode.
- **CodeQL** analyzes product Rust code, examples, and the Go, Python, and
TypeScript SDKs, scoped by `.github/codeql/codeql-config.yml`; E2E test code is
excluded. Only Go requires a build; the other languages use build mode `none`.
Results are uploaded to Code Scanning and always retained as workflow
artifacts.
TypeScript SDKs, scoped by `.github/codeql/codeql-config.yml`. Rust test code
is excluded in two layers: the analyze job sets
`CODEQL_EXTRACTOR_RUST_OPTION_CARGO_CFG_OVERRIDES=-test` so the extractor skips
`#[cfg(test)]` blocks, and `paths-ignore` drops `crates/*/tests`, whose
integration targets the cfg override does not reach. Examples remain in scope,
and E2E test code stays excluded because `e2e/` is not an analyzed path. Only
Go requires a build; the other languages use build mode `none`. Analysis runs
on the nightly schedule or by manual dispatch. Results are uploaded to Code
Scanning and always retained as workflow artifacts.

Findings never fail these checks; scanner and build failures do. A scanner that
cannot run, a CodeQL analyzer that does not complete, and an unexpected
Expand Down
Loading