Runway 1.0.1

This commit is contained in:
Runway committed 2026-10-21 13:49:47 -06:00
1 parent dcf819146b
commit ce217fc952
259 files changed
+22226 -206

No files matched your search

@@ -34,7 +34,7 @@ import org.junit.jupiter.api.io.TempDir;
*/
class BackupFormatVersionTest {
/** A manifest exactly as 0.5.0-beta13 wrote it — before {@code formatVersion} existed. */
/** A manifest exactly as an older release wrote it — before {@code formatVersion} existed. */
private static final String PRE_FIELD_MANIFEST = """
siteId: "demo"
spiVersion: "0.3.4"
@@ -62,7 +62,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
/**
* "Use the file's value" on a locked Server settings field (1.0.0-rc4): moving a key from the host's
* "Use the file's value" on a locked Server settings field: moving a key from the host's
* {@code application.yml} to the console used to cost two restarts and a start on the default, because the console
* could not hold a value while the host's line was there. The action copies the value the server runs with into the
* console's store, through the checks a save applies, so the line can be removed and the server restarted once with
@@ -274,7 +274,7 @@ class KernelSettingsScreenTest {
/**
* A catch-all trusted proxy lets any client fake its address; the form refuses it. So do
* ranges that add up to one (two /1 halves, the IPv4-mapped form), which releases before 1.0.0-rc3 accepted.
* ranges that add up to one (two /1 halves, the IPv4-mapped form), which a looser check would accept.
*/
@Test
void aCatchAllTrustedProxyIsRefused() throws Exception {
@@ -19,7 +19,7 @@ import org.junit.jupiter.params.provider.ValueSource;
* <h2>Why</h2>
* Spring's message source runs a message through {@link java.text.MessageFormat} only when it is given arguments
* ({@code alwaysUseMessageFormat} is off). In a message with {@code {0}}, {@code ''} is a literal apostrophe; in one
* without, it reaches the page as two. The manifest hint showed "the site''s manifest" until 1.0.0-rc1.
* without, it reaches the page as two. The manifest hint once showed "the site''s manifest".
*/
class MessageApostropheTest {
@@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test;
*
* <h2>Why</h2>
* The console is a professional tool used by operators and site managers the product has never met, so it speaks
* formally: "Elija un archivo", "su sitio", "puede". Strings written before 1.0.0-rc3 mixed in "tú" ("Elige",
* "tu sitio", "puedes"). A review listed 35 of them; 1.0.0-rc3 rewrote 61 values in usted. This test
* formally: "Elija un archivo", "su sitio", "puede". Earlier strings mixed in "tú" ("Elige",
* "tu sitio", "puedes") and were rewritten in usted. This test
* keeps new ones out.
*
* <h2>What it checks, and what it cannot</h2>
@@ -53,9 +53,10 @@ import org.springframework.test.context.DynamicPropertySource;
* the server read at most the pre-authentication budget ({@code runway.endpoints.max-form-bytes}, here 2 KiB) of a
* request body, on every path — the sign-in and password-recovery forms of both realms, a console path that would
* answer {@code 403} only afterwards, the CSRF-exempt CSP report endpoint, a {@code PUT} form, and a plugin route
* whose handler decides access itself. Before 1.0.0-rc1 the container parsed a form of up to 16 MiB for anyone (the CSRF
* check asks for {@code _csrf} before authorization), and a plugin route read 10 MiB. A signed-in caller keeps the
* larger limits: the container's for a console form, {@code max-body-bytes} (here 64 KiB) for a route.
* whose handler decides access itself. Without this cap the container would parse a form of up to 16 MiB for anyone
* (the CSRF check asks for {@code _csrf} before authorization), and a plugin route would read 10 MiB. A signed-in
* caller keeps the larger limits: the container's for a console form, {@code max-body-bytes} (here 64 KiB) for a
* route.
*
* <p>Each limit is shown at its boundary (exactly the cap passes, one byte more is {@code 413}), chunked (no declared
* length), and with a huge declared {@code Content-Length} answered before any of the body arrives.
@@ -52,7 +52,7 @@ import org.springframework.test.context.DynamicPropertySource;
* Through a REAL Jetty and the full production filter chain: the form body a plugin route receives
* is read <b>before authentication and CSRF</b>, so it is bounded by the small {@code runway.endpoints.max-form-bytes}
* — here 1 KiB — while {@code runway.endpoints.max-body-bytes} (64 KiB) still governs every other body of a signed-in
* caller, read after security (a caller who is not signed in is held to the 1 KiB for any body since 1.0.0-rc1). An
* caller, read after security (a caller who is not signed in is held to the 1 KiB for any body). An
* oversized form is refused {@code 413} before the CSRF check could answer {@code 403}, whether it
* declares its length, streams it chunked, or declares a huge length and sends nothing.
*/
@@ -195,8 +195,8 @@ class RouteFormCapE2ETest {
}
/**
* max-body-bytes still governs a raw (non-form) body from a SIGNED-IN caller: 20 KB is fine, 70 KB is not. Since
* 1.0.0-rc1 a caller who is not signed in — even one holding a valid CSRF token from an anonymous session — is held
* max-body-bytes still governs a raw (non-form) body from a SIGNED-IN caller: 20 KB is fine, 70 KB is not.
* A caller who is not signed in — even one holding a valid CSRF token from an anonymous session — is held
* to the 1 KiB pre-authentication cap whatever the body's type, before the CSRF check.
*/
@Test
@@ -346,7 +346,7 @@ class HeadInjectionFilterTest {
assertEquals(js, run(filter, request, js, "application/javascript").getContentAsString(StandardCharsets.UTF_8));
}
/** HEAD keeps bypassing buffering (the beta10 rule), nonce feature or not. */
/** HEAD keeps bypassing buffering (buffering a HEAD zeroes its Content-Length), nonce feature or not. */
@Test
void headStillBypassesBufferingWithTheNonceFeatureOn() throws Exception {
HeadInjectionFilter filter = new HeadInjectionFilter(new HeadContributorRegistry(List.of()),
@@ -373,7 +373,7 @@ class ScriptPreloadStripperTest {
assertTrue(strip(deeper).hidden(), "srcdoc nested past the bound: refuse to vouch for it");
}
// ---- the tokenizer's corners (1.0.0-rc1) ---------------------------------------------
// ---- the tokenizer's corners ----------------------------------------------------------
private static final String EVIL_LINK = "<link rel=\"modulepreload\" href=\"https://evil.example/x.mjs\">";
private static final String OK_SCRIPT = "<script src=\"/ok.js\"></script>";
@@ -41,7 +41,7 @@ import org.springframework.test.context.DynamicPropertySource;
* at {@link mx.quest.runway.web.FilterOrder#CORE_SITE_HEALTH} (55) — OUTER of the gates it must describe. If the
* endpoint ever drifts inside order 60 it would be short-circuited by those same gates and start reporting
* nothing in exactly the states worth reporting; a mocked single-filter unit test cannot see that (the standing
* lesson from the 0.2.1-beta10 HEAD defect: test the real path).
* lesson from a HEAD defect: test the real path).
*/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class SiteHealthEndToEndTest {
@@ -187,7 +187,7 @@ class SiteHealthEndToEndTest {
assertEquals("", head.body(), "a HEAD carries no body");
long declared = head.headers().firstValueAsLong("Content-Length").orElse(-1L);
assertEquals(get.body().getBytes(StandardCharsets.UTF_8).length, declared,
"HEAD must report the length the GET would have carried (the beta10 rule)");
"HEAD must report the length the GET would have carried");
}
@Test
@@ -11,7 +11,7 @@ import org.junit.jupiter.api.io.TempDir;
/**
* A site's region-language bundle as the Messages editor names it ({@code messages_pt-BR.properties}) is found;
* Spring alone looks only for {@code messages_pt_BR}, so before 1.0.0-rc2 those translations never showed.
* Spring alone looks only for {@code messages_pt_BR}, so on its own those translations would never show.
*/
class LanguageTagBundlesTest {
@@ -264,7 +264,7 @@ class LoadedSiteInputsTest {
/**
* App-level settings ({@code runway.plugin.<id>.*}, bound once through {@code @ConfigurationProperties}) shape a
* plugin's output — the demo's analytics key adds a head script — so two runs with different values must not
* share an ETag. Before 1.0.0-rc1 only the plugin's id/version were folded.
* share an ETag. Folding only the plugin's id/version would not tell them apart.
*/
@Test
void appLevelPluginSettingsMoveTheEtag(@TempDir Path tmp) throws IOException {
@@ -348,7 +348,7 @@ class LoadedSiteInputsTest {
assertEquals(CanonicalFingerprint.of(ACME), CanonicalFingerprint.of(site("acme")));
}
// ---- 1.0.0-rc1: template params, widget-instance config, the URL map ------------------------------------------
// ---- template params, widget-instance config, the URL map -------------------------------------------------------
/** A content source whose enumeration a test swaps, standing in for a plugin's cached index. */
private static final class Source implements mx.quest.runway.spi.ContentSource {
@@ -111,7 +111,7 @@ class PageValidatorServiceTest {
"https://acme.test", SiteStatus.ACTIVE), PAGE, EN).etag(), "an equal record folds equally");
}
// ---- 1.0.0-rc1: the site's chrome templates — every template that is not a page ----------------------------
// ---- the site's chrome templates — every template that is not a page -----------------------------------------
/** A template a master or page may pull in by name: the ETag of every page of the site must move with it. */
@Test
@@ -22,7 +22,7 @@ import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.env.MapPropertySource;
/**
* A refused essential plugin tells the operator what to do (since 1.0.0-rc1). With SPI 1.0.0 an old protection
* A refused essential plugin tells the operator what to do. With SPI 1.0.0 an old protection
* descriptor (no {@code requiresSpi}) is blocked, and a blocked essential plugin puts every tenant page in fail-closed
* mode ({@code 503}). The operator meets that in two places — the plugins screen's row (the resolution reason) and
* the boot log's fail-closed line — so both must name the fix: the copy of the plugin bundled with the running
@@ -55,7 +55,7 @@ class EssentialRepairAdviceTest {
assertTrue(advice.contains("after a rollback its seed/ is the older release's copy"), advice);
assertTrue(advice.contains("re-run that release's installer"), advice);
assertTrue(advice.contains("every upgrade refreshes it"), advice);
assertTrue(advice.contains("no seed/ folder there (a release installed before 1.0.0-rc1) or you replaced the "
assertTrue(advice.contains("no seed/ folder there (an older install) or you replaced the "
+ "kernel jar by hand"), "when seed/ is not the running release's copy: " + advice);
assertTrue(advice.contains("./runway-<version>.bin --extract DIR"), advice);
assertTrue(advice.contains("DIR/runway-<version>/seed/plugins/protection/ instead"), advice);
@@ -66,7 +66,7 @@ class EssentialRepairAdviceTest {
assertFalse(advice.contains("not copied"), "the old 'no seed/ on the host' claim is gone: " + advice);
}
/** The 1.0.0-rc1 blocker's exact shape: an old protection with no floor, on SPI 1.0.0. */
/** The exact shape that blocks: an old protection with no floor, on SPI 1.0.0. */
@Test
void aPreContractEssentialPluginIsToldToTakeTheBundledCopyNotToRemoveIt() {
String reason = PluginResolution.resolve(List.of(coded("protection", null)), SPI_ONE).blocked().get("protection");
@@ -11,7 +11,7 @@ import org.junit.jupiter.api.io.TempDir;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
import org.springframework.core.io.FileSystemResource;
/** The plugin-asset {@code Cache-Control} parser and the content ETag (1.0.0-rc5). */
/** The plugin-asset {@code Cache-Control} parser and the content ETag. */
class PluginAssetCacheControlTest {
private static String header(String configured) {
@@ -39,15 +39,16 @@ import org.springframework.boot.web.server.context.WebServerApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
/**
* End to end (since 1.0.0-rc1), over real boots and a real Jetty: a plugin's <b>settings</b> shape what it renders
* End to end, over real boots and a real Jetty: a plugin's <b>settings</b> shape what it renders
* into a page,
* so they move the page ETag — and they move it exactly when they take effect, with the body.
*
* <p>The fixture plugin {@code fx} mirrors the demo plugin's {@code analytics.write-key}: an app-level setting
* ({@code external/plugin-settings/fx.yml}, bound once, applied by a restart) that adds a head script, and a per-site
* setting ({@code sites/<id>/plugins/fx.yml}, read through {@code PluginSettings}) rendered into a head meta tag. The
* plugin declares no {@code headInputs} — it needs none. Before 1.0.0-rc1 the ETag folded only the plugin's id and version,
* so the restart with a key served the new script under the old ETag, and a client holding that ETag got {@code 304}.
* plugin declares no {@code headInputs} — it needs none. An ETag folding only the plugin's id and version
* would serve the new script under the old ETag after the restart with a key, and a client holding that ETag would
* get {@code 304}.
*/
class PluginSettingsEtagIntegrationTest {
@@ -75,8 +75,8 @@ class PluginStaticResourceTest {
}
/**
* Since 1.0.0-rc5 a plugin file is cacheable (an hour by default) with a content ETag and no Last-Modified, instead of
* Spring Security's no-store that made every page view download it again.
* A plugin file is cacheable (an hour by default) with a content ETag and no Last-Modified, instead of
* Spring Security's no-store, which would make every page view download it again.
*/
@Test
void aBundledAssetIsCacheableAndRevalidatesByItsContentEtag() throws Exception {
@@ -139,7 +139,7 @@ class SiteReloadEndToEndTest {
}
/**
* The defect found on a live deployment of {@code 0.5.0-beta6}: a reload reported success while per-site
* The defect found on a live deployment: a reload reported success while per-site
* <b>plugin</b> config
* kept serving the pre-edit file, because {@code SitePluginConfigService} invalidated only on
* {@code isWholesaleReplacement()} (delete/restore) and reload publishes {@code UPDATED}.
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
* disappearance detector fires on what looks like an outage. Nothing catches it: not the compiler, not any
* behavioural test, and not code review, because the rename looks entirely local.
*
* <p>Reported from a live deployment on {@code 0.5.0-beta8}, whose monitoring stack had to
* <p>Reported from a live deployment whose monitoring stack had to
* exclude the whole {@code spring_security_filterchains_*} family to stop it firing.
*
* <h2>Why this test is written with string literals</h2>
@@ -159,7 +159,7 @@ class UsernameUniquenessTest {
Wiring w = wire(tmp);
w.masters().save(master("owner-id", "owner", "acme"));
Path file = w.layout().siteDir("acme").resolve("users.yml");
new YamlStore().write(file, new UserFile(List.of(siteUser("s1", "Owner")))); // the beta13-era squat
new YamlStore().write(file, new UserFile(List.of(siteUser("s1", "Owner")))); // a squat an older release allowed
w.users().evict(file);
assertDoesNotThrow(() -> w.masters().save(master("owner-id", "owner", "acme").withPasswordHash("$fresh")));
assertDoesNotThrow(() -> w.masters().save(master("owner-id", "owner", "acme", "beta")),
@@ -186,7 +186,7 @@ class FileStampTest {
assertTrue(stamp(f).isCurrent(), "a settled large file is checked by attributes alone");
}
// ---- directories (since 1.0.0-rc1: a bundle folder where a new locale file must be noticed) -------------------
// ---- directories (a bundle folder where a new locale file must be noticed) -----------------------------------
@Test
void aFileAppearingInASettledDirectoryIsAChange(@TempDir Path dir) throws IOException {
@@ -36,7 +36,7 @@ import org.springframework.test.context.DynamicPropertySource;
* Spring Security's {@code CacheControlHeadersWriter} <b>bails out entirely</b> when the response already carries
* an {@code Expires}/{@code Pragma} (verified in its bytecode) — so nothing wrote {@code Cache-Control} at all.
* Reusing an existing session restores it, which is why only a cold, cookie-less request reproduces it. Reported
* from a live deployment against {@code 0.5.0-beta2}, where a browser's first cold visit hit exactly this shape.
* from a live deployment, where a browser's first cold visit hit exactly this shape.
*
* <p><b>Do NOT "simplify" these to a HEAD.</b> A {@code HEAD} does <b>not</b> mint a session, so it never walks
* the failing path: measured on a live deployment, {@code HEAD /__app} returned the full
@@ -267,7 +267,7 @@ class CspFilterTest {
@Test
void aNoncedKernelPageIsForcedNoStoreEvenWhenAWeakerCacheControlWasSet() throws Exception {
// Reported from a live deployment against 0.5.0-beta1: a nonced login page reached the wire with NO Cache-Control.
// Reported from a live deployment: a nonced login page reached the wire with NO Cache-Control.
// "Never stored" is an invariant for a nonced page, so enforce it over any value that doesn't say no-store.
CspFilter filter = filter(RunwayCspProperties.Mode.REPORT);
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/app/login");
@@ -15,7 +15,7 @@ import org.springframework.core.io.ClassPathResource;
/**
* Binds the SHIPPED classpath {@code application.yml} to {@link RunwayCspProperties} — exactly the way
* {@code @ConfigurationProperties} does at boot — and asserts the emitted policy. This closes the drift that
* caused the beta7 regression: {@link RunwayCspPropertiesTest} tests the Java <b>field defaults</b> (so it saw
* caused a shipped regression: {@link RunwayCspPropertiesTest} tests the Java <b>field defaults</b> (so it saw
* {@code script-src 'self'} and passed), while the bundled {@code application.yml} still set
* {@code script-src: "'self' 'unsafe-inline'"}, which binds <b>over</b> the field default — so the shipped header
* kept {@code 'unsafe-inline'}. Testing the actual bound value keeps config and code from disagreeing again.
@@ -38,7 +38,8 @@ class CspHeaderBindingTest {
String policy = props.buildPolicy();
String lead = RunwayCspProperties.NONCE_PLACEHOLDER + RunwayCspProperties.STRICT_DYNAMIC_PLACEHOLDER;
assertThat(policy)
.as("the bundled application.yml must not re-add 'unsafe-inline' to script-src (beta7 regression)")
.as("the bundled application.yml must not re-add 'unsafe-inline' to script-src"
+ " (the shipped-config regression)")
.contains("script-src " + lead + "'self';") // nonce + strict-dynamic placeholder + 'self'
.doesNotContain(lead + "'self' 'unsafe-inline'"); // still no 'unsafe-inline' on script-src
// The shipped yml keeps strict-dynamic on, so the bound policy carries the SD placeholder (CspFilter emits
@@ -33,7 +33,7 @@ import org.springframework.test.context.DynamicPropertySource;
* The decisive strict-dynamic test: end-to-end against a REAL Jetty + the full egress filter chain + the real Thymeleaf
* render of a kernel login page — the ONLY layer that proves the CSP header's nonce equals the nonce on every
* rendered {@code <script>} across the {@code CspFilter}↔Thymeleaf boundary. (A mocked single-filter unit can't;
* the beta10 HEAD bug is the standing reminder.) It asserts: {@code /app/login}'s {@code script-src} carries a
* an earlier HEAD bug is the standing reminder.) It asserts: {@code /app/login}'s {@code script-src} carries a
* nonce + {@code 'strict-dynamic'} + the {@code 'self'} fallback; every {@code <script>} in the body carries that
* exact nonce; the page is {@code no-store}; and a second request mints a different nonce.
*/
@@ -1,6 +1,6 @@
# Chrome verdicts for ScriptPreloadStripperTest.corpus(CORPUS_SEED, 3000): per page, 1 = Google Chrome 155.0.8059.79 put the
# page's foreign x.mjs <link rel=modulepreload> in the DOM (iframe srcdoc, scripting on), 0 = it did not.
# Produced by the Chrome oracle harness (1.0.0-rc1); regenerate it when corpus() changes.
# Produced by the Chrome oracle harness; regenerate it when corpus() changes.
1100011010101011111111001011010111110010111111001010010001011011111001011111100100101110111001111100
0011110000101100010101010011001111101001111111100110101111000110011110110110011001011101111011111010
0111101111101101111010010000011100000110100110101101101001111111101111101101110111011111111001000110