morningman opened a new pull request, #4722: URL: https://github.com/apache/doris-website/pull/4722
## Summary Implements the GitHub App bypass design for `asf-site`, keeping `force_orphan: true` so the published branch stays a single commit. - Adds a ruleset that blocks `deletion` and `non_fast_forward` on `asf-site`. Only the deploy GitHub App (and `apache/root` for Infra recovery) can bypass it. - Moves the `asf-site` publish into a separate `publish-site` job that mints a GitHub App token and runs in the `Production` environment. - Stores the App private key as a `Production` environment secret. The environment allows deployments only from protected branches, so a workflow on a writer's branch cannot read it. - Reduces the OSS deploy job to `contents: read`; only the App token can write `asf-site`. ## Why a separate job and environment The App private key must **not** be a repository secret: any writer can read repository secrets by pushing a workflow. An environment secret on `Production` with `deployment_branch_policy: protected_branches: true` means: - the master deploy job can read it; - a workflow on a writer's branch, or a same-repo pull request, cannot — the environment only permits protected branches; - the OSS deploy job, which handles the build artifact, never gets the secret at all. The OSS upload job keeps `id-token: write` and does not declare the environment, so its Aliyun OIDC subject remains `ref:refs/heads/master` and the #4712 immutable-subject migration is unaffected. ## Before this can be merged This is a **draft** because the App and its credentials must be provisioned outside this PR: 1. Org owner / ASF Infra creates a GitHub App with `Contents: Read and write` and installs it on `apache/doris-website`. 2. Add the repository variable `DEPLOY_APP_ID` = the App ID. 3. Add the `Production` environment secret `DEPLOY_APP_PRIVATE_KEY` = the App private key. 4. Replace the `actor_id: 0` placeholder under `rulesets[0].bypass_actors` with the same App ID. 5. Delete the legacy `ALIYUN_*` secrets from the `Production` environment; they have been unused since the OIDC migration. 6. Mark the PR ready, merge, and run a manual deploy to verify. If merged as-is, the ruleset creation fails (invalid actor `0`) and the publish job fails (missing variable and secret). ## What changes versus before | | Before | After | |---|---|---| | `asf-site` protection | none | deletion + force-push blocked | | Bypass identity | — | deploy App + `apache/root` | | `asf-site` push token | `GITHUB_TOKEN` | GitHub App installation token | | App key storage | — | `Production` environment secret, protected-branch policy | | OSS deploy job token | `contents: write` | `contents: read` | | `force_orphan` | true | true (branch stays one commit) | | Job layout | one `deploy` job | `deploy` (OSS) → `publish-site` (App push) | `publish-site` runs after `deploy`, preserving the current "assets first, HTML second" order. The App token push **does** trigger `on: push` workflows (unlike `GITHUB_TOKEN`); there are currently no workflows triggered on `asf-site`, so there is no recursion. Publishing metrics now cover only the OSS deploy job; the short `publish-site` job is not included in the reported budget. ## Residual risks - `deletion` + `non_fast_forward` prevent deletion and history rewriting, but **do not** stop a writer from making a normal commit to `asf-site`. - If the App private key leaks, it can force-push until the App key is rotated. The key is environment-scoped, but a malicious master commit can still read it. - A malicious commit merged to `master` can use the App; branch protection and review remain the root of trust. ## Validation - `actionlint` 1.7.12 passes on both modified workflows. - `.asf.yaml` parses; the raw ruleset matches the asfyaml `rulesets` schema, and the environment matches the `environments` schema. - After the App is provisioned, verify with a manual deploy: `GET /repos/apache/doris-website/rulesets` should show the ruleset, the App push should succeed, and a human force-push should be rejected. ## Related PRs - #4713 (deletion-only ruleset) is superseded by this PR. - #4712 (immutable OIDC subject) is independent: the OSS job keeps its ref-based subject. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
