diff --git a/etl-service/src/test/java/com/xtrmetl/etl/documentation/LocalComposeLoopbackBindingTest.java b/etl-service/src/test/java/com/xtrmetl/etl/documentation/LocalComposeLoopbackBindingTest.java new file mode 100644 index 00000000..6d082b55 --- /dev/null +++ b/etl-service/src/test/java/com/xtrmetl/etl/documentation/LocalComposeLoopbackBindingTest.java @@ -0,0 +1,75 @@ +package com.xtrmetl.etl.documentation; + +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Verifies that the bundled local Docker Compose profile does not publish ports on all host + * interfaces by default. + * + *
Compose service-to-service traffic uses the internal network and service names. Published + * host ports are therefore a developer-access boundary and must be explicitly loopback-bound in + * the default local profile. This test does not claim that loopback binding is a production + * authentication or transport-security control.
+ */ +class LocalComposeLoopbackBindingTest { + + private static final Path PROJECT_ROOT = findProjectRoot(); + + @Test + void everyPublishedPortIsExplicitlyLoopbackBound() throws IOException { + List