Skip to content

ci: probe runner account assumptions on CodeBuild (not for merge) - #968

Closed
wangyb-A wants to merge 5 commits into
mainfrom
ci/codebuild-runner-account-probe
Closed

wangyb-A wants to merge 5 commits into
mainfrom
ci/codebuild-runner-account-probe

Conversation

@wangyb-A

@wangyb-A wangyb-A commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Purpose

Temporary probe, not for merge. Records which account the CodeBuild-hosted runner executes as and whether the assumptions baked into the shared AI review workflows in aws-durable-execution-ci hold there:

  • the invoking account is named runner (Defaults:runner env_keep, chown runner:<user>, install -o runner)
  • /home/runner exists and is the parent of GITHUB_WORKSPACE
  • a freshly created unprivileged user cannot reach ambient AWS credentials

The same script runs on the CodeBuild project default (EC2, standard:7.0) and on ubuntu-latest as a control.

What it checks

  1. id, $HOME, presence of a runner account/group and /home/runner
  2. GITHUB_WORKSPACE location and its parent chain (namei -l)
  3. passwordless sudo, visudo, setfacl availability
  4. ambient credential plumbing: AWS_CONTAINER_* / CODEBUILD_* variable names (values never printed), reachability of 169.254.170.2 and IMDS
  5. whether a Defaults:runner env_keep sudoers rule matches the actual invoker, versus Defaults:$(id -un)
  6. as a new probe-user: inherited AWS variables, credential endpoint reachability, ability to read root/sudo process environ, workspace traversability
  7. whether chown runner:… / install -o runner succeed against the literal runner account

Context: Codex finding on aws/aws-durable-execution-ci#67.

@wangyb-A wangyb-A closed this Oct 6, 2026
@wangyb-A
wangyb-A deleted the ci/codebuild-runner-account-probe branch October 6, 2026 20:28
Adds a step that mirrors the Docker usage of llrt-cloud-test.js (busybox-based linux/amd64 build, then run) on both the CodeBuild project default and ubuntu-latest. The real LLRT workflow cannot be dispatched from this branch because the test role's OIDC trust only covers pull_request, main and tag subjects.
@wangyb-A wangyb-A reopened this Oct 6, 2026
Alex Wang added 2 commits October 6, 2026 22:18
Runs prepare_ai_review_user.sh (claude-review, codex-review), prepare_ai_summary_user.sh and prepare_codex_implementation_user.sh from aws-durable-execution-ci@d901b2f as the real job account on the CodeBuild project default (root) and on ubuntu-latest (runner), then mirrors each workflow's env -i launch with a stub binary to show exactly which variables reach the model process.
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime October 6, 2026 22:37 — with GitHub Actions Failure
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime October 6, 2026 22:43 — with GitHub Actions Failure
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime October 6, 2026 22:45 — with GitHub Actions Inactive

on:
workflow_dispatch:
pull_request:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex AI review · Finding arf_v1_rsxkeo6em43qllvaijkvz3rnp6

[P1] Keep PR-authored code off the CodeBuild runner

A pull_request workflow runs the PR's workflow definition, allowing a contributor to replace these probe commands and execute arbitrary code on the CodeBuild runner. Restricting GITHUB_TOKEN permissions does not protect the runner's ambient AWS service-role credentials. The same exposure exists in ci-toolkit-scripts-probe.yml. Remove both pull_request triggers and use only a trusted push/manual invocation, or a base-branch pull_request_target workflow that never executes the head revision.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codex AI review

Found one high-severity CI trust-boundary issue in the new CodeBuild probes. No SDK runtime behavior is changed.

Reviewed commit d22bc1a89fd8c71b82984b232e6ad51bfc6b7eea. Workflow run

@wangyb-A wangyb-A closed this Oct 6, 2026

This branch was previously deployed

1 inactive deployment
ai-pr-review-runtime — d22bc1a8 Deployed Oct 6, 2026 by wangyb-A via codex-review / Generate Codex review #2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant