Skip to content

fix(integration): bind event authority to exact request - #190

Merged
github-actions[bot] merged 4 commits into
mainfrom
fix/integration-request-bound-event-authority-v2
Aug 11, 2026
Merged

fix(integration): bind event authority to exact request#190
github-actions[bot] merged 4 commits into
mainfrom
fix/integration-request-bound-event-authority-v2

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Security outcome

The Integration event-preparation boundary no longer accepts a reusable workspace-only life-os.workspace.v1 proof. It now requires canonical short-lived life-os.integration-event-context.v2 HMAC evidence bound to the exact workspace, timestamp, HTTP method, and route path before tenant identity reaches plugin event preparation.

Test-first evidence

  • adds direct request-authority regressions for route/method replay, workspace mismatch, stale/future timestamps, malformed server clock/configuration, and non-canonical base64url aliases;
  • updates the real Nest HTTP integration journey to use the v2 request-bound proof and explicitly reject the legacy workspace-only signature;
  • preserves fail-closed 401/503 problem classification and existing tenant/body injection protections.

Scope

Only apps/integration-service request authority and its tests are changed. No plugin installation, outbound delivery, secret-store, database, or cross-repository authority is introduced.

Refs #130. Merge only after unchanged exact-head CI, AppGuardrail, SAST Semgrep, Security Scan, Commercial Readiness, CodeRabbit/current review findings, and current-live-main compatibility satisfy live policy.

Summary by CodeRabbit

  • 보안 강화

    • 이벤트 준비 요청의 신뢰 컨텍스트 검증이 요청 메서드와 경로에 연결된 최신 HMAC 서명 방식으로 강화되었습니다.
    • 잘못된 요청 바인딩, 다른 워크스페이스 서명, 비표준 Base64URL 형식 및 레거시 서명이 거부됩니다.
    • 만료되거나 미래의 타임스탬프, 짧은 비밀키, 서버 시간 오류가 감지되며 상황에 맞는 오류 응답이 제공됩니다.
  • 테스트

    • 유효한 서명 승인과 다양한 잘못된 요청 거부 동작을 검증하는 테스트가 추가되었습니다.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 28a698fb-90ac-4b22-ab7f-f56758d7f0e8

📥 Commits

Reviewing files that changed from the base of the PR and between 1f76454 and 5da7991.

📒 Files selected for processing (1)
  • apps/integration-service/src/integration-controller-authority.test.ts
📝 Walkthrough

Walkthrough

이벤트 준비 요청의 신뢰 컨텍스트 검증을 v2 HMAC 방식으로 변경했습니다. 서명을 HTTP 메서드와 경로에 결합했습니다. 잘못된 서명 형식, 요청 바인딩, 워크스페이스, 시간 및 비밀키를 검증하는 테스트를 추가했습니다.

Changes

이벤트 컨텍스트 권한 검증

Layer / File(s) Summary
v2 검증 계약과 HMAC 구현
apps/integration-service/src/main.ts
요청 바인딩과 게이트웨이 헤더 인터페이스를 추가했습니다. POST /v1/events/prepare 바인딩과 life-os.integration-event-context.v2 HMAC 입력을 사용합니다.
이벤트 준비 핸들러와 계약 테스트
apps/integration-service/src/main.ts, apps/integration-service/src/plugin-contract.integration.test.ts
이벤트 준비 핸들러가 새 검증 함수를 호출합니다. 통합 테스트는 v2 서명 수락과 레거시 v1 서명 거부를 확인합니다.
권한 검증 동작 테스트
apps/integration-service/src/integration-controller-authority.test.ts
경로, 메서드, 쿼리, 프래그먼트, 워크스페이스가 다른 서명을 거부합니다. 비정규 Base64URL, 오래된 시간, 미래 시간, 짧은 비밀키, 잘못된 서버 시각도 검증합니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Event caller
  participant Event preparation handler
  participant requireTrustedEventWorkspaceContext
  Event caller->>Event preparation handler: POST /v1/events/prepare with signed headers
  Event preparation handler->>requireTrustedEventWorkspaceContext: headers, secret, request binding
  requireTrustedEventWorkspaceContext-->>Event preparation handler: trusted workspace context or HTTP error
  Event preparation handler-->>Event caller: preparation response or validation error
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 이벤트 권한을 정확한 요청에 바인딩하는 주요 변경 사항을 간결하고 명확하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/integration-request-bound-event-authority-v2

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.

🧹 Nitpick comments (1)
apps/integration-service/src/integration-controller-authority.test.ts (1)

167-214: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

입력 형식 분기를 테스트에 추가하십시오.

requireTrustedEventWorkspaceContext는 비문자열 헤더와 각 패턴 불일치 입력을 아직 테스트하지 않습니다. 해당 fail-closed 동작을 검증하는 케이스를 추가하십시오. integration-service에는 현재 100% 커버리지 게이트가 설정되어 있지 않으므로, 커버리지 게이트 요구사항이라는 설명은 제거하십시오.

🤖 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 `@apps/integration-service/src/integration-controller-authority.test.ts` around
lines 167 - 214, Extend the parameterized “fails closed for $name” tests around
requireTrustedEventWorkspaceContext with cases for non-string headers and inputs
that do not match each accepted header pattern, asserting the corresponding
fail-closed status and error code. Remove any wording or references claiming
this change is required by an integration-service 100% coverage gate.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@apps/integration-service/src/integration-controller-authority.test.ts`:
- Around line 167-214: Extend the parameterized “fails closed for $name” tests
around requireTrustedEventWorkspaceContext with cases for non-string headers and
inputs that do not match each accepted header pattern, asserting the
corresponding fail-closed status and error code. Remove any wording or
references claiming this change is required by an integration-service 100%
coverage gate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b9419cab-953a-40d6-b700-9d2a0fd4786b

📥 Commits

Reviewing files that changed from the base of the PR and between 6189b22 and 1f76454.

📒 Files selected for processing (3)
  • apps/integration-service/src/integration-controller-authority.test.ts
  • apps/integration-service/src/main.ts
  • apps/integration-service/src/plugin-contract.integration.test.ts

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review

Formal review-only request for exact current head 5da7991: the v2 request-bound HMAC authority and malformed-header/pattern fail-closed regressions are present. Please review this exact head only after the terminal Checks remain green and submit an independent GitHub review. Do not mutate or merge.

@github-actions
github-actions Bot merged commit 2042348 into main Aug 11, 2026
38 checks passed
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