Skip to content

fix(security): bind workflow source and document MSA boundaries - #71

Draft
seonghobae wants to merge 145 commits into
mainfrom
docs/architecture-trust-boundaries
Draft

fix(security): bind workflow source and document MSA boundaries#71
seonghobae wants to merge 145 commits into
mainfrom
docs/architecture-trust-boundaries

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Purpose

Maintain the single canonical Noema documentation/architecture graph: PRD, TRD, root Architecture, ADRs, UML, conceptual/logical ERD, Test Strategy, Operability, licensing/IP-transfer, threat models and requirement→source/test/evidence traceability. Active-PR behavior remains Proposed / In review, never protected-main truth.

Fresh source identity

  • protected main: c85d710804139c0697d7ef8fa47d02b1389e6d84 (fix(security): update transitive nanoid for CVE-2026-67213 #76 integrated; nanoid@3.3.17 is protected truth);
  • branch: docs/architecture-trust-boundaries;
  • current head: 9df895084c451ac59b2299498e6197059c7203ab;
  • comparison against current main: diverged, 141 commits ahead / 1 behind, merge base 9adb784902cae19a150146a8fadd6a0491f67814;
  • GitHub currently reports this PR non-mergeable. Do not destructively rebase, force-push or transfer predecessor evidence. The branch requires controlled convergence onto protected main before merge acceptance.

Documentation sufficiency verdict

  • DESIGN_SUFFICIENT: PASS / In review. The current canonical graph is broad enough to reconstruct product requirements, technical invariants, authority boundaries, runtime/automation topology, persistence truth, UML, security/testing/operability, release/provenance, licensing/IP and traceability. Creating more document families merely to increase count would create parallel authority.
  • PROTECTED_MAIN_OPERATIONALLY_SUFFICIENT: FAIL CLOSED / incomplete. This graph is unmerged and cannot fabricate live rulesets, qualifying independent approval, Reviewer/Maintainer App provisioning, private-vulnerability-reporting setting/staffing/exercise, protected production controls, immutable release/deployment receipts, KPI provenance, customer/revenue evidence or legal ownership/transfer evidence.

A physical relational ERD would be misleading today: current runtime persistence is Durable Object state while GitHub/review/release/acquisition entities are conceptual/external evidence entities until Noema actually owns a durable evidence database.

Current successor ownership

The canonical docs were refreshed to current live ownership and historical-lineage truth:

Latest documentation changes on this branch

The active-work documentation contract now requires current clean successors #90#95 plus #97, and the canonical Traceability/Gap Audit now distinguish:

Latest commits in this continuation:

  • 02e2c4bf92eb0e0b7b0f42f8e504d908bb798bb2 — test contract requiring current successor ownership;
  • 79e38017757d904d87c5ad87e63bcae19f8ef391 — current disclosure/scheduler evidence traceability;
  • 9df895084c451ac59b2299498e6197059c7203ab — documentation gap audit current-owner refresh.

Exact-head evidence boundary

No fresh application/reviewer/Security Scan workflow runs are currently attached to head 9df895084c451ac59b2299498e6197059c7203ab through the available PR-run evidence endpoint. A CodeRabbit commit status is present, but status-only evidence is not CI, formal review or merge authority. Therefore this head is not considered verified or merge-ready.

Historical #71 checks from earlier heads and the pre-#76 synthetic integration are diagnostic only and do not transfer.

Protected-main guidance drift

Protected main AGENTS.md still teaches stale central Security Scan semantics (including stacked PRs and CRITICAL/HIGH-only Trivy language). PR #90 is the clean correction owner: protected-base eligibility, feature-base absence as non-passing defer_until_trigger, and MEDIUM/HIGH/CRITICAL. Until protected integration, live central evidence overrides stale prose.

Licensing/IP boundary

Public visibility, package metadata, SBOM/scanner output or OCI annotations do not create outbound legal authority. Issue #5 owns owner/legal and contributor/IP-transfer evidence; PR #69 owns technical exact-release consistency (artifact_rights_metadata, authenticated bytes, duplicate decoded-key and malformed UTF-8 refusal). Automation does not choose a license.

Safe continuation / merge boundary

This PR remains non-mergeable on a diverged pre-#76 lineage. Safe continuation is to preserve this canonical graph while avoiding destructive history rewriting, then perform a controlled protected-main convergence that preserves #76 and current successor contracts, reacquire exact-head application/reviewer/eligible Security Scan evidence, resolve every valid current finding, satisfy actual live governance and qualifying formal review where required, and only then merge. Post-merge protected-main discoverability and operational acceptance are required before Proposed decisions become Accepted/Implemented.

No version bump, release, deployment, legal-clearance or acquisition-ready claim is made.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e3b197d-e3b7-4e42-bdb9-d5ee2d38e4b5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Noema의 런타임 구조와 신뢰 경계를 문서화했습니다. Worker는 workflow ref와 immutable SHA pair를 검증합니다. readiness, API 계약, 운영 문서와 회귀 테스트를 갱신했습니다.

Changes

아키텍처 및 workflow 신뢰

Layer / File(s) Summary
런타임 credential exchange
src/worker.ts, src/runtime-readiness.ts, wrangler.toml, docs/api-spec.md, test/*
Worker가 reusable 및 일반 workflow의 ref·SHA pair를 검증합니다. 설정 오류는 503으로 처리하고 claim 불일치는 403으로 처리합니다.
보안 경계와 분산 상태
ARCHITECTURE.md, docs/doctoring/architecture-trust-boundaries.md, docs/runbook.md
Cloudflare binding, outbound 요청, Durable Object 상태, alarm 재시도와 exact-head 규칙을 문서화했습니다.
서비스 조합과 권한 plane
ARCHITECTURE.md, docs/doctoring/architecture-trust-boundaries.md, docs/onboarding.md, docs/runbook.md
중앙 workflow, 리뷰 서비스와 Noema의 역할을 분리했습니다. 독립 배포, versioned contract와 authority plane을 정의했습니다.
운영 문서와 회귀 검증
CLAUDE.md, docs/api-spec.md, README.md, CHANGELOG.md, test/*
/health, /ready, /exchange, workflow SHA 설정과 운영 검증 절차를 문서화했습니다. readiness, 문서 계약과 workflow trust 회귀 테스트를 추가·갱신했습니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant CloudflareWorker
  participant NoemaOidcReplayGuard
  participant GitHubApp
  GitHubActions->>CloudflareWorker: /exchange 요청
  CloudflareWorker->>CloudflareWorker: workflow ref·SHA claims 검증
  CloudflareWorker->>NoemaOidcReplayGuard: jti replay 검증
  CloudflareWorker->>GitHubApp: installation token 교환
  GitHubApp-->>CloudflareWorker: 저장소 범위 단기 토큰
  CloudflareWorker-->>GitHubActions: exchange 응답
Loading

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 workflow source 바인딩과 MSA 경계 문서화라는 변경의 핵심을 간결하고 정확하게 요약합니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/architecture-trust-boundaries

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
docs/doctoring/architecture-trust-boundaries.md (1)

70-78: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Durable Object alarm의 제한된 자동 재시도 semantics를 기록하세요.

현재 문서는 alarm이 at-least-once로 실행되고 실패 시 자동 재시도된다고 설명합니다. Cloudflare 공식 문서는 자동 재시도가 exponential backoff와 최대 6회로 제한되며, 무기한 복구가 필요하면 handler가 새 alarm을 명시적으로 예약해야 한다고 설명합니다. 이 제한과 reschedule 요구사항을 추가하세요. (developers.cloudflare.com)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/doctoring/architecture-trust-boundaries.md` around lines 70 - 78, Update
the Durable Object alarm semantics section to state that automatic retries use
exponential backoff and are limited to a maximum of six attempts. Also document
that handlers requiring recovery beyond those retries must explicitly schedule a
new alarm, while preserving the existing at-least-once and stale-state
validation guidance.
test/architecture-documentation.test.ts (1)

5-35: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

문서 회귀 검사를 실제 runtime contract 검사로 강화하세요.

현재 테스트는 required 문자열과 두 개의 오래된 문구만 검사합니다. wrangler.tomlmain, src/entrypoint.ts·src/worker.ts·src/index.ts의 layer ownership, Durable Object binding/class, route method를 비교하지 않습니다. 따라서 runtime 구조가 바뀌어도 일부 키워드가 남아 있으면 테스트가 통과합니다. 문서와 실제 설정·소스의 핵심 관계를 직접 assertion으로 추가하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/architecture-documentation.test.ts` around lines 5 - 35, Strengthen the
architecture documentation tests beyond keyword checks by asserting the runtime
contract against actual configuration and source ownership. In the existing
tests, read wrangler.toml and the relevant src/entrypoint.ts, src/worker.ts, and
src/index.ts files, then validate the configured main entrypoint, layer
ownership, Durable Object binding/class, and route HTTP methods against the
documented architecture. Keep the existing regression assertions while making
these relationships fail when runtime structure changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ARCHITECTURE.md`:
- Around line 11-14: Update the exact workflow trust logic in src/worker.ts to
require immutable SHA-based identity: validate workflow_sha and job_workflow_sha
in addition to the full workflow_ref, rather than trusting mutable branch or tag
refs alone. Update ARCHITECTURE.md lines 11-14 and 24-33 and CLAUDE.md lines 9
and 31-36 so their trust descriptions accurately state the SHA validation and
immutable source binding performed by src/worker.ts.

In `@CLAUDE.md`:
- Line 27: README의 운영 도구 설명과 실제 문서 내용을 정합화하세요. 각 명령(kpi:compute, smoke:check,
production:preflight, readiness:audit, acquisition:manifest/acquisition:audit,
security:evidence)의 필수 NOEMA_* 환경 변수를 README에 명령별로 추가하고, 기존 Worker 및 KPI 수집 예시와
구분해 문서화하세요. 실제 요구 변수를 확인할 수 없다면 해당 변수를 문서화한다고 주장하지 않도록 CLAUDE.md의 문장을 범위에 맞게
축소하세요.

---

Nitpick comments:
In `@docs/doctoring/architecture-trust-boundaries.md`:
- Around line 70-78: Update the Durable Object alarm semantics section to state
that automatic retries use exponential backoff and are limited to a maximum of
six attempts. Also document that handlers requiring recovery beyond those
retries must explicitly schedule a new alarm, while preserving the existing
at-least-once and stale-state validation guidance.

In `@test/architecture-documentation.test.ts`:
- Around line 5-35: Strengthen the architecture documentation tests beyond
keyword checks by asserting the runtime contract against actual configuration
and source ownership. In the existing tests, read wrangler.toml and the relevant
src/entrypoint.ts, src/worker.ts, and src/index.ts files, then validate the
configured main entrypoint, layer ownership, Durable Object binding/class, and
route HTTP methods against the documented architecture. Keep the existing
regression assertions while making these relationships fail when runtime
structure changes.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4bd0e593-d123-4411-ad24-d5e917057839

📥 Commits

Reviewing files that changed from the base of the PR and between 9adb784 and 06ae6aa.

📒 Files selected for processing (6)
  • ARCHITECTURE.md
  • CHANGELOG.md
  • CLAUDE.md
  • README.md
  • docs/doctoring/architecture-trust-boundaries.md
  • test/architecture-documentation.test.ts

Comment thread ARCHITECTURE.md
Comment thread CLAUDE.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/workflow-sha-trust.test.ts`:
- Around line 122-132: Extend the workflow trust tests around
expectWorkflowBlock to cover runtimeEnv without ALLOWED_WORKFLOW_SHA, asserting
it resolves with status 503 and message "Workflow trust configuration
unavailable". Keep the existing malformed-SHA case unchanged and exercise the
undefined binding branch explicitly.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cee8500d-f924-4bb0-9314-7c44ed164834

📥 Commits

Reviewing files that changed from the base of the PR and between 06ae6aa and fadc728.

📒 Files selected for processing (2)
  • src/worker.ts
  • test/workflow-sha-trust.test.ts

Comment thread test/workflow-sha-trust.test.ts
@seonghobae seonghobae changed the title docs(architecture): define current trust and MSA boundaries fix(security): bind workflow source and document MSA boundaries Aug 7, 2026
@seonghobae
seonghobae marked this pull request as draft August 10, 2026 11:43
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