# 검증기 자신의 javadoc 이 하는 주장 18: *

The verification runs at startup and fails closed. Discovering after an incident that the 19: * application's own credential could drop tables is discovering it too late. # 정책이 검사하는 네 항목 40: if (!allowedRoles.contains(currentUser)) { 44: if (report.canCreateInSchema()) { 51: if (report.canCreateInDatabase()) { 55: searchPathPolicy.requireSafe(report.searchPath()); # 검증기는 프로덕션에서 실제로 불린다 — 다만 기동이 아니라 리포트를 만들 때다 110: private DatabasePrivilegeReport readPrivileges(DataSource dataSource) { 111- try { 112- return roleVerifier.verify(dataSource); 113- } catch (IllegalStateException unverified) { 114- return null; 115- } 112: return roleVerifier.verify(dataSource); # 정책을 넘기는 두 인자짜리 호출 55: public void requireSafe(DataSource dataSource, DatabaseRolePolicy policy) { 56- Objects.requireNonNull(policy, "policy"); 57- policy.requireSafe(verify(dataSource)); 58- } # 그 호출을 하는 곳 (레포 전체): 1 adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/platform/PostgreSqlSecurityContractTest.java:92: new PostgreSqlRuntimeRoleVerifier().requireSafe(runtime, policy); # DatabaseRolePolicy 를 만드는 main 코드: 0 # DatabaseRolePolicy 를 언급하는 파일 전부: PostgreSqlSecurityContractTest.java DatabaseRolePolicyTest.java PostgreSqlRuntimeRoleVerifier.java DatabaseRolePolicy.java # 기동 검사 빈이 실행하는 것 194: public InitializingBean jpaPlatformStartupCheck( 195- JpaDangerousConfigurationGuard guard, Environment environment) { 196- // A refresh-time failure beats a runtime one: OSIV left on, or a schema-mutating ddl-auto in a 197- // profile that forbids it, is a deployment mistake and not a request-time condition. 198- return () -> guard.validate(environment); 199- } 200- # 액추에이터의 검증 완료 표시가 보는 것 36: * Builds the report, deriving only bounded values from the privilege report. 37: * 38: *

The privilege report's {@code currentUser} and {@code searchPath} are deliberately reduced 39: * to a single boolean here: an operator needs to know the runtime role passed verification, not 40: * which role it is. 41: */ 56: privileges != null && !privileges.holdsCreatePrivilege(), 62: return openInViewDisabled && runtimeRoleVerified; # 그 표시를 고정하는 시험이 넣는 입력 37: new DatabasePrivilegeReport("app_runtime", "app, pg_catalog", false, false), 58: new DatabasePrivilegeReport("app_runtime", "app", true, false), # 정책 쪽 단위 시험은 그 두 조합을 실제로 넣는다 21: policy.requireSafe(new DatabasePrivilegeReport("app_runtime", "app, pg_catalog", false, false)); 29: policy.requireSafe(new DatabasePrivilegeReport("app_runtime", "app", true, false))) 38: () -> policy.requireSafe(new DatabasePrivilegeReport("postgres", "app", false, false))) 49: new DatabasePrivilegeReport("app_runtime", "app, public", false, false))) 57: policy.requireSafe(new DatabasePrivilegeReport("app_runtime", "\"$user\", app", false, false)); 58: assertThat(policy.isSafe(new DatabasePrivilegeReport("app_runtime", "app", false, false))) # 안정 등급의 정의 10- 11- /** Verified by the Stable contract suite on the whole PostgreSQL Stable matrix. */ 12: STABLE,