Skip to content

[BE/Security][Memory] 인증형 내부 Chatbot durable Conversation Memory 활성화 #649

Description

@HyungminYoon1

배경

nodease/mbased#521은 Public Chatbot을 익명 durable Session이 아닌 client-held bounded history 방식으로 확정하고 완료됐다. 로그인 사용자와 active organization이 명확한 내부 Chatbot만 별도 authenticated route와 storage namespace에서 durable Conversation Memory를 사용한다.

현재 dev에는 nodease/mbased#368의 내부 Chatbot authenticated execution subject, nodease/mbased#519의 Memory persistence/lifecycle foundation, nodease/mbased#397의 ProviderExecutionCapability와 nodease/mbased#475의 durable usage ledger가 존재한다. 다만 현재 workflow execute 기반 내부 실행을 Target durable Memory surface로 바로 활성화하면 CSRF, graph eligibility와 별도 내부 Chatbot 이용 권한이 비어 있으므로 feature flag를 기본 OFF로 유지한다.

목표

Authenticated internal Chatbot에서 current user·active organization·exact deployment version과 access-policy revision에 고정된 window-only durable Session/Turn/Entry 수직 경로를 완성한다. Public /run-public과 Public client-held storage 경계는 변경하지 않고 production cutover를 주장하지 않는다.

완료된 기반

활성화 선행 조건

#649 코드는 병렬로 준비할 수 있지만 위 세 이슈가 완료되어 공식 계약과 구현 증거가 연결되기 전에는 feature flag를 켜거나 production traffic을 수용하지 않는다.

구현 범위

공식 계약과 route

  • Accepted ADR과 conversation-memory/chatbot-deployment/Auth 문서에서 authenticated internal window-only contract를 Current/Target/Non-scope로 확정한다.
  • 내부 Chatbot 전용 authenticated Session create/resolve, Turn start/status와 close/reset/delete logical lifecycle route를 Public route와 분리한다.
  • request가 보낸 user, organization, deployment binding을 권한 근거로 신뢰하지 않고 서버의 current user, X-Organization-Id, canonical active deployment/version과 policy revision을 사용한다.

Memory 수직 경로

  • Conversation Session 생성/resolve와 user Turn 시작
  • StartTurn + durable dispatch, Workflow admission, final CompleteTurn의 exactly-once 상태 전이
  • completed user/final assistant Entry만 append하고 incomplete/failed output을 context에 포함하지 않음
  • Summary 없이 bounded window-only context를 구성하며 node/channel/deployment version/storage generation을 격리
  • session lifecycle revision과 content revision을 optimistic precondition으로 검증
  • create/close/reset/delete의 논리 lifecycle과 [BE/Infra][Memory] Physical purge·storage generation migration·versioned worker rollout #523 physical purge handoff

실행·외부 효과 경계

  • Gateway는 [BE][Security] cookie 인증 API CSRF 방어 도입 #145 CSRF, [FE/BE/Security][Chatbot] 내부 Chatbot 이용 권한·deployment access policy #650 이용 권한, active membership, workflow execute와 deployment/version을 queue publish 전에 검증한다.
  • Worker는 queue envelope를 권한 근거로 신뢰하지 않고 current deployment/version, subject, organization, access-policy revision, credential/KB permission과 lifecycle을 provider I/O 전에 재검증한다.
  • provider attempt/lease/fencing, provider_started marker와 main-generation usage ledger를 연결해 retry/redelivery/crash/concurrent Turn에서 중복 provider 호출·Entry·usage를 방지한다.
  • Memory content materialization은 유효한 lease와 최신 lifecycle/access revision 뒤에만 수행하며 revoke/delete 이후 raw context를 재사용하지 않는다.

Privacy·audit·rollout

  • content는 승인된 application encryption 경계를 사용하고 raw transcript, prompt/completion, private source, credential/token을 response 외 log/audit/trace에 남기지 않는다.
  • lifecycle과 security mutation만 canonical audit/outbox로 기록하고 정상 Turn 상태는 bounded operational telemetry로 분리한다.
  • Gateway/Worker schema·queue capability readiness가 하나라도 없으면 fail-closed한다.
  • feature flag 기본 OFF, 전용 versioned task/queue와 혼합 Worker rollout 방어를 사용한다. Production activation과 global compatibility 제거는 [BE/Infra][Memory] Physical purge·storage generation migration·versioned worker rollout #523/nodease/mbased#524에서 수행한다.

TDD 및 보안 검증

  • 다른 user/organization/deployment/version Session 접근과 resource existence 비노출
  • workflow execute만 있고 [FE/BE/Security][Chatbot] 내부 Chatbot 이용 권한·deployment access policy #650 이용 권한이 없는 사용자 차단
  • membership·Chatbot grant·KB permission·credential revoke 후 queue/provider/Memory write 전 fail-closed
  • missing/invalid CSRF, Origin, access-policy revision과 graph mapping 차단
  • retry/redelivery/crash/concurrent Turn의 중복 provider call·Entry·usage 방지
  • stale lifecycle/content revision, provider lease/fencing과 active deployment 교체 차단
  • broker acknowledgement 유실과 dispatch/admission reconciliation
  • secret, raw private source, transcript/prompt/completion의 log/audit/trace 비노출
  • Public Chatbot이 durable Memory route/table/task queue를 사용하지 않는 architecture test
  • feature flag OFF, 구 Worker, schema/capability 미준비에서 fail-closed

완료 기준

  • 선행 세 이슈의 구현·문서·테스트 증거가 연결되고 feature flag 뒤 authenticated internal Session/Turn/Entry window path가 동작한다.
  • current subject, organization, exact deployment version과 access-policy/lifecycle revision이 Gateway와 Worker에서 동일하게 재검증된다.
  • logical delete는 접근을 즉시 차단하고 [BE/Infra][Memory] Physical purge·storage generation migration·versioned worker rollout #523 physical purge handoff를 만든다.
  • retry/concurrency에서도 하나의 logical Turn에 final Entry와 main-generation usage가 한 번만 확정된다.
  • Summary가 없어도 bounded window mode로 안전하게 동작하고 Public 경계가 유지된다.
  • production cutover, physical purge 완료와 UI 전체 완성을 주장하지 않는다.

비범위 및 후속

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions