Skip to content

Commit c7eff10

Browse files
genednaclaude
andcommitted
v0.41.10: BB-13 OCI reject unauthenticated push case
Register `OCI reject unauthenticated push` (plan-20261001 BB-13): oras push without stored credentials fails with the registry 401 visible in its debug output, and the repository stays unknown (tags/list 404 NAME_UNKNOWN). Marks BB-12 done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018bJDjze83ToyPysYzmxxWS Signed-off-by: Eli Ma <eli@patch.sh>
1 parent c340749 commit c7eff10

5 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mega2"
3-
version = "0.41.9"
3+
version = "0.41.10"
44
edition = "2024"
55
license = "MIT OR Apache-2.0"
66
description = "Monorepo engine and Git hosting server for AI agents: trunk-based storage, Git Smart HTTP, Git LFS, OCI registry, and Agent Session Capture"

‎docs/deploy-trunk.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ CASE='OCI ping' # 换成要跑的 case 名
395395
docker compose -p mega2-trunk -f docker/docker-compose-storage-only.yml --profile interop exec -T -e MEGA2_SMOKE_CASE="$CASE" interop-smoke bash /repo/scripts/oci_client_smoke_storage_only.sh 2>&1 | tee target/tmp/bb-oci-case.log
396396
```
397397

398-
已登记 case:`OCI ping`、`OCI oras push and pull`。
398+
已登记 case:`OCI ping`、`OCI oras push and pull`、`OCI reject unauthenticated push`。
399399

400400
不设 `MEGA2_SMOKE_CASE` 时整跑全部默认栈 case;opt-in case(auth-none)只经 `scripts/bb_optin_run.sh none oci_client_smoke_storage_only.sh '<case>' <log>` 运行。
401401

‎docs/plan/plan-20261001.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@
10721072
### Task BB-12: OCI oras push and pull
10731073

10741074
**Task type:** `implementation`
1075-
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.9;Codex R2 PASS;C 组 2023 测试通过;待 D 组 `docker` job)
1075+
**Lifecycle / Acceptance:** `done` / `complete`(v0.41.9;C 组 2023 测试通过;D 组 docker run 36932190577 success)
10761076
**Description:** 在 `scripts/oci_client_smoke_storage_only.sh` 注册 case `OCI oras push and pull`。`oras login --plain-http --password-stdin` 后推送两文件 artifact 到 `bb-${RUN_ID}/oras` 并拉回。 唯一行为轴:oras 高层推拉往返。
10771077
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
10781078
**Current evidence:**
@@ -1122,7 +1122,7 @@
11221122
### Task BB-13: OCI reject unauthenticated push
11231123

11241124
**Task type:** `implementation`
1125-
**Lifecycle / Acceptance:** `pending` / (空)
1125+
**Lifecycle / Acceptance:** `in-progress` / `remote-pending`(v0.41.10;Codex R1 PASS;C 组 2023 测试通过;待 D 组 `docker` job)
11261126
**Description:** 在 `scripts/oci_client_smoke_storage_only.sh` 注册 case `OCI reject unauthenticated push`。不登录执行 `oras push`,随后匿名查询 tags/list。 唯一行为轴:无凭据写拒绝。
11271127
**Out of scope:** 其它 case(各自成卡);改 `src/**`(产品缺陷按 ADR-BB-08 立 `FIX-BB-*`);改既有 smoke 脚本(GC-BB-06);以 cargo IT 作 VER(GC-BB-04)。
11281128
**Current evidence:**

‎scripts/oci_client_smoke_storage_only.sh‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,24 @@ case_oci_oras_push_pull() {
109109
[ "$pushed" = "$fetched" ] || { echo "push digest $pushed != descriptor digest $fetched" >&2; return 1; }
110110
}
111111

112+
# --- BB-13 OCI reject unauthenticated push ------------------------------
113+
case_oci_reject_unauth_push() {
114+
local dir="$WORK/unauth" repo="bb-$RUN_ID/unauth" code
115+
oci_case_begin
116+
mkdir -p "$dir"
117+
export DOCKER_CONFIG="$dir/docker"
118+
printf 'unauth\n' > "$dir/f.txt"
119+
if (cd "$dir" && oci_t oras push --debug --plain-http "$REGISTRY/$repo:v1" f.txt) > "$dir/push.out" 2>&1; then
120+
echo "unauthenticated oras push succeeded" >&2; return 1
121+
fi
122+
rg -q 'Response Status: "401 Unauthorized"' "$dir/push.out" || { echo "push failure did not mention 401" >&2; redact "$TOKEN" < "$dir/push.out" >&2; return 1; }
123+
code=$(oci_curl -o "$dir/tags.json" -w '%{http_code}' "$MEGA2_BASE_URL/v2/$repo/tags/list")
124+
[ "$code" = 404 ] || { echo "tags/list returned $code" >&2; return 1; }
125+
[ "$(jq -r '.errors[0].code' "$dir/tags.json")" = NAME_UNKNOWN ] || { echo "tags/list error code is not NAME_UNKNOWN" >&2; return 1; }
126+
}
127+
112128
run_case "OCI ping" case_oci_ping
113129
run_case "OCI oras push and pull" case_oci_oras_push_pull
130+
run_case "OCI reject unauthenticated push" case_oci_reject_unauth_push
114131

115132
finish

0 commit comments

Comments
 (0)