fix(study): subject_note_rag 에 licensed_restricted 필터 누락 — 구매자료 분야노트 RAG 누수
explanation_rag 는 restricted_exclude_orm() 으로 licensed_restricted 문서를 제외하는데(B-4, a안 U-2① 단일술어), 복제된 subject_note_rag._gather_document_evidence 는 이 술어를 빠뜨려 구매 자료 verbatim 이 분야노트 RAG 로 샐 수 있었음(services 리뷰 P1 보안 drift). doc_meta 쿼리에 필터 추가 → valid_doc_ids → 청크 쿼리까지 자동 전파(explanation_rag 동일 구조). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ from models.chunk import DocumentChunk
|
|||||||
from models.document import Document
|
from models.document import Document
|
||||||
from models.study_question import StudyQuestion
|
from models.study_question import StudyQuestion
|
||||||
from models.study_topic import StudyTopicDocument
|
from models.study_topic import StudyTopicDocument
|
||||||
|
from services.search.license_filter import restricted_exclude_orm
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -113,6 +114,9 @@ async def _gather_document_evidence(
|
|||||||
select(Document.id, Document.title, Document.ai_summary).where(
|
select(Document.id, Document.title, Document.ai_summary).where(
|
||||||
Document.id.in_(doc_ids),
|
Document.id.in_(doc_ids),
|
||||||
Document.deleted_at.is_(None),
|
Document.deleted_at.is_(None),
|
||||||
|
# B-4: licensed_restricted 제외 — explanation_rag 와 동일 술어(a안 U-2①). 누락 시
|
||||||
|
# 구매 자료 verbatim 이 분야노트 RAG 로 새던 보안 drift(복제 과정 누락).
|
||||||
|
restricted_exclude_orm(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).all()
|
).all()
|
||||||
|
|||||||
Reference in New Issue
Block a user