WEBBOOK CHAPTER

기능이 아니라 경계를 지키는 웹 보안: 22장. Tenant 격리 negative test 세트

22장. Tenant 격리 negative test 세트

tenant A의 viewer·dispatcher·admin이 tenant B 예약을 ID, 검색, export, object URL, websocket, batch, support API로 접근하는 조합을 만든다. 존재 여부가 오류 시간·메시지로 노출되는지도 본다. 관리자도 명시적 cross-tenant 승인 없이는 거절한다.


for (const role of ['viewer','dispatcher','admin']) {
  test(`${role} cannot read another tenant`, async () => {
    await expect(api.as(role,'tenant-a').get('/tenant-b/reservations/r-9'))
      .rejects.toMatchObject({status:403});
  });
}

DB tenant predicate 누락, cache key 충돌, async worker context 유실을 별도 시험한다. row-level security를 쓰더라도 application 정책과 운영자 우회 권한을 검토한다. 합성 전용 계정만 사용한다.