Merge branch 'main' into claude/r9-a-obs-logs
pr / done (pull_request) Successful in 13m43s

This commit is contained in:
2026-11-13 04:44:09 +00:00
72 changed files with 2062 additions and 208 deletions
+2 -2
View File
@@ -352,8 +352,8 @@ org.springframework.graphql:spring-graphql:2.0.6=architectureTestRuntimeClasspat
org.springframework.integration:spring-integration-core:7.0.7=architectureTestRuntimeClasspath,bootRunH2Classpath,integrationTestRuntimeClasspath,qualificationRuntimeClasspath,testRuntimeClasspath
org.springframework.integration:spring-integration-jdbc:7.0.7=architectureTestRuntimeClasspath,bootRunH2Classpath,integrationTestRuntimeClasspath,qualificationRuntimeClasspath,testRuntimeClasspath
org.springframework.security:spring-security-config:7.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework.security:spring-security-core:7.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework.security:spring-security-crypto:7.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework.security:spring-security-core:7.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework.security:spring-security-crypto:7.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,bootRunH2Classpath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
org.springframework.security:spring-security-oauth2-client:7.0.8=architectureTestRuntimeClasspath,qualificationRuntimeClasspath
org.springframework.security:spring-security-oauth2-core:7.0.8=architectureTestRuntimeClasspath,bootRunH2Classpath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
org.springframework.security:spring-security-oauth2-jose:7.0.8=architectureTestRuntimeClasspath,bootRunH2Classpath,integrationTestRuntimeClasspath,productionRuntimeClasspath,qualificationRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
@@ -26,8 +26,14 @@ import org.springframework.core.env.ConfigurableEnvironment;
* <p>Scoped to the deployable artifact, which means contexts whose main class is {@link
* dev.caskeleton.bootstrap.CaSkeletonApplication}. Slice tests boot minimal applications with no
* environment profile and are not deployments; applying a deployment rule to them would have made
* this validator a tax on every test that does not care where it is running. The {@code test}
* profile is exempt for the same reason from the other direction.
* this validator a tax on every test that does not care where it is running.
*
* <p>The {@code test} profile is refused here. It used to be exempt, so {@code
* SPRING_PROFILES_ACTIVE=test} on the shipped jar started with every production check off: secret
* sentinels accepted, fileserver authorization unenforced, local persistence conveniences on
* (review 2026-11-12). No test boots this main class under {@code test} — Spring's test loader
* makes the test class the main class, and the shipped-composition system tests start it under
* {@code local} or {@code dev} — so the exemption only ever opened production.
*/
public class RuntimeEnvironmentProfileValidator implements EnvironmentPostProcessor, Ordered {
@@ -48,7 +54,13 @@ public class RuntimeEnvironmentProfileValidator implements EnvironmentPostProces
List<String> active = profiles.activeProfiles();
if (profiles.isTestContext()) {
return;
throw StartupFailures.envValidation(
"SPRING_PROFILES_ACTIVE names the "
+ RuntimeEnvironment.testProfileName()
+ " profile, which is reserved for test-source contexts and never starts the shipped "
+ "application: under it every production safety check is off. Set exactly one of "
+ RuntimeEnvironment.deployableProfileNames()
+ ".");
}
if (active.isEmpty()) {
throw StartupFailures.envValidation(
@@ -2,9 +2,13 @@ package dev.caskeleton.bootstrap.runtime;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.catchThrowable;
import dev.caskeleton.adapter.outbound.support.startup.StartupFailureException;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.boot.SpringApplication;
import org.springframework.mock.env.MockEnvironment;
@@ -51,10 +55,18 @@ class RuntimeEnvironmentProfileValidatorTest {
}
}
@Test
@DisplayName("a test-source context may run under test")
void aTestContextIsExempt() {
validate("test");
@ParameterizedTest
@ValueSource(strings = {"test", "prod,test", "TEST"})
@DisplayName("배포 산출물은 test profile 로 뜨지 않는다 — 운영 검사가 모두 꺼지기 때문이다")
void theShippedApplicationRefusesTheTestProfile(String profiles) {
// when
Throwable failure = catchThrowable(() -> validate(profiles.split(",")));
// then
assertThat(failure)
.isInstanceOf(StartupFailureException.class)
.hasMessageContaining("reserved for test-source contexts")
.hasMessageContaining("[dev, local, prod]");
}
@Test
@@ -48,6 +48,14 @@ final class ProviderCallbackIngressBridge implements ProviderCallbackIngress {
public CallbackIngestionResult ingest(ProviderCallbackHttpRequest request) {
Objects.requireNonNull(request, "request");
// The profile comes from the unauthenticated path, so it is checked first: an unknown one is
// refused before any limit check could write the caller's string to the security audit log.
// No line either — any POST could otherwise fill the log at will (review 2026-11-12).
ProviderCallbackAdapter adapter =
adapters
.find(request.providerProfileId())
.orElseThrow(() -> rejected(NotificationFailureCode.CALLBACK_PAYLOAD_REJECTED));
CallbackLimits limits = adapters.limitsFor(request.providerProfileId());
if (request.bodyLength() > limits.maxBodyBytes()) {
securityAudit.callbackRejectedByLimit(request.providerProfileId(), "BODY_TOO_LARGE");
@@ -58,7 +66,6 @@ final class ProviderCallbackIngressBridge implements ProviderCallbackIngress {
throw rejected(NotificationFailureCode.CALLBACK_PAYLOAD_REJECTED);
}
ProviderCallbackAdapter adapter = adapters.require(request.providerProfileId());
if (!adapter.providerId().equals(request.providerId())) {
securityAudit.callbackRejectedByLimit(
request.providerProfileId(), "PROVIDER_PROFILE_MISMATCH");
@@ -24,6 +24,7 @@ import dev.caskeleton.application.notification.platform.api.NormalizedProviderEv
import dev.caskeleton.application.notification.platform.api.ProviderId;
import dev.caskeleton.application.notification.platform.api.ProviderProfileId;
import dev.caskeleton.application.notification.platform.api.error.CallbackValidationException;
import dev.caskeleton.application.notification.platform.api.error.NotificationFailureCode;
import dev.caskeleton.application.notification.platform.observation.NotificationSecurityAuditPort;
import dev.caskeleton.application.notification.platform.port.in.IngestProviderCallbackCommand;
import dev.caskeleton.application.notification.platform.port.in.IngestProviderCallbackUseCase;
@@ -193,6 +194,36 @@ class ProviderCallbackIngressBridgeTest {
.containsExactly(CallbackIngressUnavailableException.class, List.of(), List.of());
}
@Test
@DisplayName(
"설정하지 않은 profile 의 콜백은 크기·형식 검사 전에 CALLBACK_PAYLOAD_REJECTED 로 거절되고 감사 로그에 그 문자열을 남기지 않는다")
void aCallbackForAnUnconfiguredProfileIsRejectedFirstWithoutAuditingTheCallersString() {
// given
ProviderCallbackAdapterRegistry registry =
new MapProviderCallbackAdapterRegistry(
Map.of(), new CallbackLimits(4, Set.of("application/json")));
RecordingAudit audit = new RecordingAudit();
RecordingIngestion ingestion = new RecordingIngestion();
ProviderCallbackIngressBridge bridge =
new ProviderCallbackIngressBridge(registry, ingestion, audit);
// when
Throwable failure =
catchThrowable(() -> bridge.ingest(request("text/plain", "longer than four bytes")));
// then
assertThat(
List.of(
failure instanceof CallbackValidationException rejected
? rejected.descriptor().code()
: String.valueOf(failure),
audit.limitReasons,
audit.signatureReasons,
ingestion.callbacks))
.containsExactly(
NotificationFailureCode.CALLBACK_PAYLOAD_REJECTED, List.of(), List.of(), List.of());
}
@Test
void rawHttpLimitsAreEnforcedBeforeTheProviderAdapterRuns() {
RecordingAdapter adapter = new RecordingAdapter(TWILIO, true);
@@ -215,8 +246,8 @@ class ProviderCallbackIngressBridgeTest {
ProviderCallbackAdapterRegistry registry =
new ProviderCallbackAdapterRegistry() {
@Override
public ProviderCallbackAdapter require(ProviderProfileId profileId) {
return adapter;
public Optional<ProviderCallbackAdapter> find(ProviderProfileId profileId) {
return Optional.of(adapter);
}
@Override