From 5e4da85c94fe0431fbaa605223c5080faefc6c87 Mon Sep 17 00:00:00 2001 From: Ilan Harel Date: Thu, 19 Nov 2026 15:35:03 +0200 Subject: [PATCH] ci: require the Security checks on main Closes #103 Signed-off-by: Ilan Harel --- .github/rulesets/protect-main.json | 9 ++++++++- .github/workflows/security.yml | 3 ++- CHANGELOG.md | 1 + CONTRIBUTING.md | 6 +++--- SECURITY.md | 2 +- docs/DEVELOPING.md | 5 +++-- docs/RELEASING.md | 3 ++- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/rulesets/protect-main.json b/.github/rulesets/protect-main.json index 36ee992..42a2d4c 100644 --- a/.github/rulesets/protect-main.json +++ b/.github/rulesets/protect-main.json @@ -21,7 +21,14 @@ "type": "required_status_checks", "parameters": { "strict_required_status_checks_policy": true, - "required_status_checks": [ { "context": "check" }, { "context": "audit" } ] + "required_status_checks": [ + { "context": "check" }, + { "context": "audit" }, + { "context": "actionlint" }, + { "context": "gitleaks" }, + { "context": "cargo-deny" }, + { "context": "openshell-pin" } + ] } } ], diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 2eec6f4..d714ae5 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -7,7 +7,8 @@ name: Security # openshell-pin the NVIDIA/OpenShell git pin: Cargo.toml tag = Cargo.lock commit = upstream tag # Tools are downloaded by scripts/ci-tools.sh at pinned versions and checked against pinned SHA-256 hashes # (actionlint also against its GitHub build provenance). Run the same checks locally: scripts/security-local.sh -# These jobs are not (yet) required status checks; see .github/rulesets/protect-main.json. +# The job names are required status checks on main (.github/rulesets/protect-main.json, #103): renaming a job here +# needs the same change in the ruleset, or every pull request waits for a check that never reports. on: push: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b63511..5c213f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ version section and adds the squash-merged PR titles since the previous tag. Ver ## [Unreleased] +- ci: the `Security` checks `actionlint`, `gitleaks`, `cargo-deny` and `openshell-pin` are required status checks on `main`, next to `check` and `audit` (`protect-main` ruleset, #103) - ci: `Security` workflow (#101): actionlint on the workflows, gitleaks over the full git history, `cargo deny check` with a new `deny.toml` (advisories, licenses, bans, sources), and `scripts/verify-openshell-pin.sh`, which checks that the Cargo.toml OpenShell tag, the Cargo.lock commit and the upstream tag agree; tools are installed by `scripts/ci-tools.sh` at pinned versions with pinned SHA-256 hashes (actionlint also by attestation); `scripts/security-local.sh` runs the same checks locally; `ci.yml` pins `actions/checkout` and `actions/cache` by commit SHA - feat(lint): warn about OpenShell v0.1.8 pitfalls: `ws://`/`wss://` URL literals declared only by a `rest` egress (REST endpoints answer WebSocket upgrades with 403), and IPv4-mapped IPv6 hosts (`::ffff:a.b.c.d`, evaluated as IPv4) in egress directives and policy files; README notes that symlinked filesystem paths (fail launch since v0.1.8) cannot be detected statically - chore(deps): build against OpenShell v0.1.8 (`openshell-policy-schema`, `openshell-policy`); docs and generated policy headers now name v0.1.8. The gateway validator now rejects `websocket_credential_rewrite: true` on `protocol: rest` (covered by a test); `--scaffold-profiles` skeletons explain the v0.1.8 credential placement rule (credentials go only where the profile declares them); `diff-logs` needs no change for the OCSF `device.container.*` move; the RUSTSEC-2026-0459 ignore stays (v0.1.8 still pins `sqlx` 0.9.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2728b68..c707737 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,14 +14,14 @@ goes through a branch and a pull request. 3. Run `scripts/ci-local.sh` before pushing (`TOOLCHAIN=1.94 scripts/ci-local.sh` pins the toolchain CI uses), and `scripts/security-local.sh` when you touch workflows, dependencies or the OpenShell pin. 4. `git push -u origin ` and open a pull request into `main`. -5. CI must pass (the required `check` and `audit` jobs, and the `Security` workflow's `actionlint`, `gitleaks`, - `cargo-deny` and `openshell-pin` jobs), the branch must be up to date with `main`, and all review +5. CI must pass (the required checks: `check` and `audit` from CI, and `actionlint`, `gitleaks`, `cargo-deny` and + `openshell-pin` from the `Security` workflow), the branch must be up to date with `main`, and all review conversations must be resolved. 6. Merge with **squash merge** (the only merge method enabled; the PR title becomes the commit message, so use a conventional title). The head branch is deleted automatically after the merge. The rules are defined in `.github/rulesets/protect-main.json` and applied with `scripts/protect-main.sh`: pull request -required (0 approvals, conversations resolved), status checks `check` and `audit` required and up to date, linear +required (0 approvals, conversations resolved), status checks `check`, `audit`, `actionlint`, `gitleaks`, `cargo-deny` and `openshell-pin` required and up to date, linear history, no force pushes, no deletion, and no bypass for admins. GitHub only enforces rulesets on private repositories with a paid plan; until then the rules are followed by convention. diff --git a/SECURITY.md b/SECURITY.md index 3705d0a..b96b5dc 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -15,7 +15,7 @@ OpenShell itself should be reported to the OpenShell project (see its `SECURITY. - Every pull request and push to `main`, plus a weekly run, goes through the `Security` workflow: actionlint on the workflows, gitleaks over the full git history, `cargo deny check` (RustSec advisories, licenses, sources; see `deny.toml`) and a check that the pinned `NVIDIA/OpenShell` tag, the commit in `Cargo.lock` and the upstream tag - agree. `cargo audit` runs in CI as well. + agree. `cargo audit` runs in CI as well. All of these are required status checks for merging into `main`. - Third-party GitHub Actions are pinned by commit SHA. CI tools are downloaded at pinned versions and checked against pinned SHA-256 hashes. - Release archives come with `SHA256SUMS` and GitHub build provenance (`gh attestation verify --repo diff --git a/docs/DEVELOPING.md b/docs/DEVELOPING.md index a088ab3..64a950c 100644 --- a/docs/DEVELOPING.md +++ b/docs/DEVELOPING.md @@ -57,7 +57,8 @@ TOOLCHAIN=1.94 scripts/ci-local.sh # pinned like CI; omit TOOLCHAIN to use y Expected last line: `ci-local: all checks passed`. Optional audit: `cargo install cargo-audit --locked && cargo audit`. -The `Security` workflow (`.github/workflows/security.yml`, #101) adds four jobs. Run them locally with +The `Security` workflow (`.github/workflows/security.yml`, #101) adds four jobs, all required status checks on `main` +next to `check` and `audit` (#103). Run them locally with `scripts/security-local.sh` (expected last line: `security-local: all checks passed`): | Job | What it checks | Config | @@ -272,7 +273,7 @@ git switch -c feat/short-name # or fix/..., docs/..., chore/... git commit -s -m "feat: what and why" # -s adds the DCO Signed-off-by line (required) git push -u origin feat/short-name # CI runs on every push to a pull request gh pr create --fill # open the PR into main -gh pr checks --watch # wait for `check` and `audit` to pass +gh pr checks --watch # wait for the required checks (CI and Security) to pass gh pr merge --squash # squash merge; the branch is deleted automatically ``` diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 88a5a3e..e3b8753 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -71,7 +71,8 @@ release" note to the tracking issue. To bring it to `main`: in `src/`), regenerate the goldens (`UPDATE_GOLDEN=1 cargo test`, then review), and add a CHANGELOG line under `## [Unreleased]`. The workflow only moves the pin, so these strings still name the old version until then. 3. Retitle the tracking PR to `chore(deps): bump OpenShell crates to vX.Y.Z`, put `Closes #` in it, - mark it ready for review, and squash-merge it once `check` and `audit` pass. Those required checks come from the + mark it ready for review, and squash-merge it once the required checks pass (`check`, `audit` and the `Security` jobs `actionlint`, `gitleaks`, + `cargo-deny`, `openshell-pin`). Those required checks come from the PR's `pull_request` runs: your push in step 2 starts them; if the head is still a bot commit, select **Approve workflows to run** on the PR (the `CI (dispatched)` statuses do not count as the required checks). `openshell-next` itself survives the merge (the `protect-openshell-next` ruleset blocks the automatic branch deletion) and keeps tracking from `main`.