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

@@ -43,7 +43,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
* <ul>
* <li><b>Downloading a FULL backup</b> — fresh or stored. A full backup is complete by design, so it carries every
* account's password hash and the site's {@code ENC(...)} plugin secrets; a delegated holder who could
* download one could take those off the server (since 1.0.0-rc1). The routes
* download one could take those off the server. The routes
* answer {@code 403}, and the screen hides their buttons.</li>
* <li><b>Restore</b>: it replaces the <em>entire</em> site, so it is an administrator's decision.</li>
* </ul>
@@ -145,7 +145,7 @@ public class PagesContentSource implements ContentSource {
* language switcher, footer), which the render replaces with the master's live seams; indexing it put the
* same navigation words into every page and into every result snippet.
*
* <p>Since 1.0.0-rc6 the slot is taken from the page <b>as rendered in {@code locale}</b>, so the strings the
* <p>The slot is taken from the page <b>as rendered in {@code locale}</b>, so the strings the
* render takes from the site's message bundles (decoupled {@code th:text="#{key}"}) are indexed in that
* language; a page that is unknown, unpublished or fails to render gives its file's slot instead.
*
@@ -220,9 +220,8 @@ public class EditorialService {
* <b>through the editorial level</b>, exactly as if the user had saved that body in the editor
* ({@link #save}): on a reviewed site a published page re-seeded by a user without {@code APPROVE_PAGES}
* becomes a pending revision (live untouched); a published page on an enforced or reviewed site passes the
* quality gate first; everything runs under the page lock. Before 0.5.0-beta14 a re-seed wrote the live
* files directly, past all three — and for a page without {@code .th.xml} seams that changes what
* visitors see.
* quality gate first; everything runs under the page lock. A re-seed that wrote the live files directly would
* bypass all three — and for a page without {@code .th.xml} seams that would change what visitors see.
*
* <p>When the re-seed will be a revision and one is already pending, the <em>revision's</em> body is re-seeded
* (and resubmitted), so the editor's pending work is refreshed rather than overwritten by the live page. A user
@@ -15,7 +15,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
/**
* Bounds the request body of a caller who is <b>not signed in</b>, on every kernel path, by the pre-authentication
* cap ({@code runway.endpoints.max-form-bytes}, 256 KiB by default), since 1.0.0-rc1.
* cap ({@code runway.endpoints.max-form-bytes}, 256 KiB by default).
*
* <h2>Why</h2>
* The container's own form limit is 16 MiB ({@code JettyFormLimitsConfig}: the Messages editor's no-JS fallback posts
@@ -50,7 +50,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
* This filter runs before authentication, CSRF and the suspended/maintenance gates, so whatever it buffers, any
* anonymous client can make it buffer. Using the 10 MiB raw-body cap here let one request hold 10 MiB of heap
* before any check — far more than a form of text fields needs. (The container's own form limit was no better: it
* is 16 MiB, raised by {@code JettyFormLimitsConfig} for the Messages editor; since rc1 a caller who is not signed in
* is 16 MiB, raised by {@code JettyFormLimitsConfig} for the Messages editor; a caller who is not signed in
* is held to this same cap on every other path too, by {@link PreAuthBodyLimitFilter}.) The capture is therefore
* bounded by {@code max-form-bytes} (default
* {@value #DEFAULT_MAX_FORM_BYTES} bytes — a form of text fields), or by {@code max-body-bytes} if that is smaller.
@@ -80,8 +80,7 @@ import mx.quest.runway.web.CspScriptAllowlist;
* same token boundary; a {@code <noscript>} or CDATA is checked always. Where the readings agree (every real page),
* nothing changes. Where they do not, the walk stops and says so: the stamp leaves every later script unstamped, and
* {@link ScriptPreloadStripper} reports the body hidden, so the edge withdraws the nonce and the page gets the
* host-allowlist policy (1.0.0-rc1: a {@code <?x <!-- y>} bogus comment used to be read as a
* comment that hid the rest of the page from the scan).
* host-allowlist policy.
*
* <h2>Known limits (documented, tested)</h2>
* <ul>
@@ -15,34 +15,36 @@ import mx.quest.runway.web.CspScriptAllowlist;
* <h2>Why</h2>
* Under {@code 'strict-dynamic'} a browser ignores {@code 'self'} and the host list for any request that is not
* "parser-inserted". A module preload is fetched as not-parser-inserted, so injected markup could make every
* visitor's browser contact any host — a beacon channel that beta13's {@code script-src 'self'} closed. Nothing runs
* (a preload never executes), but the visit, the visitor's address and the page it came from leak. The edge removes
* such a link, judged by <b>the same rule as a {@code <script src>}</b> ({@link CspScriptAllowlist#allowsUrl}:
* same-origin, or a host on the policy — {@code script-src}, {@code extra-hosts}, plugin {@code CspHostContributor}
* hosts), with the URL read as the browser reads it (character references, {@code //host}, {@code ///host},
* backslashes, the first same-origin {@code <base href>}). An allowed link is left exactly as written.
* visitor's browser contact any host — a beacon channel that the host-allowlist policy's {@code script-src 'self'}
* keeps closed. Nothing runs (a preload never executes), but the visit, the visitor's address and the page it came
* from leak. The edge removes such a link, judged by <b>the same rule as a {@code <script src>}</b>
* ({@link CspScriptAllowlist#allowsUrl}: same-origin, or a host on the policy — {@code script-src},
* {@code extra-hosts}, plugin {@code CspHostContributor} hosts), with the URL read as the browser reads it
* (character references, {@code //host}, {@code ///host}, backslashes, the first same-origin {@code <base href>}).
* An allowed link is left exactly as written.
*
* <h2>Which links are judged, and why each (CSP3 "effective directive" + measured in Chrome 155)</h2>
* Measured with a stand-in host counting requests, the same page under the public policy
* ({@code script-src 'nonce-…' 'strict-dynamic' 'self'}) and under beta13's ({@code script-src 'self'}), both with
* {@code default-src 'self'}:
* ({@code script-src 'nonce-…' 'strict-dynamic' 'self'}) and under the host-allowlist policy
* ({@code script-src 'self'}), both with {@code default-src 'self'}:
* <ul>
* <li><b>{@code rel} contains {@code modulepreload}</b> (any {@code as}) — judged. Destination "script" (or another
* script-like one), governed by {@code script-src}; the HTML spec fetches a module preload as
* not-parser-inserted, which {@code 'strict-dynamic'} lets through from any host. Measured: fetched under the
* public policy, refused under beta13's. {@code as=worker}/{@code sharedworker}/{@code serviceworker}/
* {@code audioworklet}/{@code paintworklet} are script-like too (worker destinations fall back from
* {@code worker-src} to {@code script-src}, which Runway does not split); Chrome 155 rejects those values
* without fetching, another engine may not — so they are judged too. A non-script {@code as}
* public policy, refused under the host-allowlist policy. {@code as=worker}/{@code sharedworker}/
* {@code serviceworker}/{@code audioworklet}/{@code paintworklet} are script-like too (worker destinations fall
* back from {@code worker-src} to {@code script-src}, which Runway does not split); Chrome 155 rejects those
* values without fetching, another engine may not — so they are judged too. A non-script {@code as}
* ({@code style}, {@code json}) is governed by its own directive and fetches nothing foreign; judging every
* module preload anyway keeps the rule simple and costs nothing.</li>
* <li><b>{@code rel} contains {@code prefetch}</b> (any {@code as}) — judged. CSP3 governs a prefetch by
* {@code default-src}, which carries no {@code 'strict-dynamic'}, but Chrome 155 fetches a foreign
* {@code <link rel=prefetch>} — with or without {@code as}, {@code as=script|style|image|document}, with
* {@code crossorigin} — whenever {@code script-src} has {@code 'strict-dynamic'} (even with an explicit
* {@code script-src-elem 'self'}), and refuses it under beta13's policy ({@code default-src 'self'}) and under a
* nonce without {@code 'strict-dynamic'}. So it is the same regression and gets the same rule (a prefetch to a
* host the operator trusts to run scripts reveals nothing more than the script itself would).</li>
* {@code script-src-elem 'self'}), and refuses it under the host-allowlist policy ({@code default-src 'self'})
* and under a nonce without {@code 'strict-dynamic'}. So it is the same regression and gets the same rule (a
* prefetch to a host the operator trusts to run scripts reveals nothing more than the script itself
* would).</li>
* <li><b>{@code rel} contains {@code preload} with a script-like {@code as}</b> ({@code script}, {@code worker},
* {@code sharedworker}, {@code serviceworker}, {@code audioworklet}, {@code paintworklet}, {@code xslt}; read
* ASCII case-insensitively, trimmed) — judged. CSP3 maps these to {@code script-src-elem}/{@code worker-src}.
@@ -54,8 +56,8 @@ import mx.quest.runway.web.CspScriptAllowlist;
* {@code icon}, {@code manifest}, {@code compression-dictionary} (their own directives — measured refused under
* both policies). {@code preconnect}, {@code dns-prefetch} and {@code prerender} reach the host under
* <em>both</em> policies (CSP governs no directive for the first two; Chrome's prerender/NoState-prefetch was
* fetched under beta13's policy too): not a regression of {@code 'strict-dynamic'}, so out of scope here
* (KNOWN-LIMITATIONS).</li>
* fetched under the host-allowlist policy too): not a regression of {@code 'strict-dynamic'}, so out of scope
* here (KNOWN-LIMITATIONS).</li>
* </ul>
* {@code rel} is a token list (ASCII whitespace separated, ASCII case-insensitive), so {@code rel="ModulePreload"}
* and {@code rel="nofollow modulepreload"} both count (measured: both fetched). Attribute values are decoded first,
@@ -81,7 +83,7 @@ import mx.quest.runway.web.CspScriptAllowlist;
* comment, in a bogus comment ({@code <?…>}, {@code <!…>}), in an ordinary attribute value or as escaped text
* ({@code &lt;link …&gt;}) is never markup to a browser and is ignored.
*
* <p><b>Where the scanner cannot be sure, the page is hidden too</b> (since 1.0.0-rc1). When the walk
* <p><b>Where the scanner cannot be sure, the page is hidden too</b>. When the walk
* reaches a stretch whose tokenization depends on the tree and its readings disagree — a raw-text element or a CDATA
* section after {@code <svg>}/{@code <math>}/{@code <select>}/{@code <template>}, a {@code <noscript>} whose
* scripting-on and scripting-off readings part, a {@code <base>} the tree builder may not honour — it stops
@@ -149,7 +149,7 @@ public class SiteHealthFilter extends OncePerRequestFilter {
/**
* Writes the body, honouring HEAD: no bytes, but the {@code Content-Length} the GET would have carried. The
* standing rule (paid for in 0.2.1-beta10) is that a body-less HEAD must still report the real length — here
* standing rule is that a body-less HEAD must still report the real length — here
* that is trivially correct because the filter computes the body either way and never buffers a response.
*/
private void write(HttpServletRequest request, HttpServletResponse response, String json) throws IOException {
@@ -61,10 +61,10 @@ import org.springframework.stereotype.Component;
* in a fresh source if anything changed, and returns the fingerprint the page validator folds into the ETag — so
* the ETag describes exactly the bundle the render then reads.
*
* <p><i>Why:</i> before rc1 the validator folded the files' bytes while the source re-read them only every
* {@code runway.i18n.cache-seconds} (and only when the file's millisecond timestamp moved). For that window after
* an edit the old text went out under the new ETag, and a client or CDN that stored it kept revalidating it to
* {@code 304}. Every other lookup — an error page, a plugin's off-request {@code Messages.site} — re-checks the
* <p><i>Why:</i> if the validator folded the files' bytes while the source re-read them only every
* {@code runway.i18n.cache-seconds} (and only when the file's millisecond timestamp moved), then for that window after
* an edit the old text would go out under the new ETag, and a client or CDN that stored it would keep revalidating
* it to {@code 304}. Every other lookup — an error page, a plugin's off-request {@code Messages.site} — re-checks the
* stamp at most once per {@code runway.i18n.cache-seconds} ({@code 0} = on every lookup), so a {@code #{}} key
* still costs a map read.
*/
@@ -269,9 +269,9 @@ public class SiteAwareMessageSource implements MessageSource {
/**
* Spring's bundle reader, also accepting a file named with the BCP 47 tag ({@code messages_pt-BR.properties}),
* which is how the Messages editor ({@link SiteMessagesStore}) names a region language's file. Spring itself only
* looks for {@code messages_pt_BR}, so before 1.0.0-rc2 a site offering {@code pt-BR} never saw its translations
* (they fell back to {@code messages_pt}, then the default language). The tag form is tried first, then Spring's
* own names, so a hand-made {@code messages_pt_BR.properties} keeps working.
* looks for {@code messages_pt_BR}, so on its own a site offering {@code pt-BR} would never see its translations
* (they would fall back to {@code messages_pt}, then the default language). The tag form is tried first, then
* Spring's own names, so a hand-made {@code messages_pt_BR.properties} keeps working.
*/
static final class LanguageTagBundles extends ReloadableResourceBundleMessageSource {
@Override
@@ -6,7 +6,7 @@ import java.time.OffsetDateTime;
* One parsed line of an audit journal — the application activity log ({@link AppActivityLog}) or a site's audit
* log ({@link SiteLogService}). Both share the line shape {@code time \t actor \t action \t detail}.
*
* @param time when it happened. For a line written with an offset (0.5.0-beta14 and later) this is exactly
* @param time when it happened. For a line written with an offset (the current format) this is exactly
* what was written; for an older offset-less line it is the written wall-clock time interpreted in
* the server's <em>current</em> zone — see {@code offsetKnown}
* @param offsetKnown {@code true} when the line carried its own UTC offset; {@code false} for a legacy line whose
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
* <h2>Time format</h2>
* Lines are written as ISO-8601 local date-time <b>with its UTC offset</b> and milliseconds
* ({@code 2026-10-17T08:10:03.123-06:00}), so an entry's instant is unambiguous across a DST change or a server
* time-zone move. Lines written before 0.5.0-beta14 carry {@code yyyy-MM-dd HH:mm:ss} with no offset; the reader
* time-zone move. Lines written by an older release carry {@code yyyy-MM-dd HH:mm:ss} with no offset; the reader
* still accepts them and interprets them in the server's current zone, flagging {@link AuditEntry#offsetKnown()}
* {@code false}. Both forms coexist in one file across the upgrade day.
*
@@ -50,7 +50,7 @@ public final class AuditJournal {
/** The on-disk time format for new lines: local date-time, milliseconds, and the offset ({@code Z} at UTC). */
static final DateTimeFormatter WRITE_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
/** The pre-beta14 offset-less form, still accepted on read. */
/** The older offset-less form, still accepted on read. */
private static final DateTimeFormatter LEGACY_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static final DateTimeFormatter DAY = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -107,7 +107,7 @@ public class LoadedSiteInputs {
/**
* The short form (no params, widget config or URL-map inputs — those fold nothing). Kept for tests and callers that
* predate 1.0.0-rc1.
* predate the longer form.
*/
public LoadedSiteInputs(SiteAwareMessageSource messages, SeoConfigService seoConfig, SiteIconService iconService,
SiteManifestService manifestService, SitePluginConfigService pluginConfig,
@@ -61,8 +61,8 @@ public class PageReseedService {
* <p><b>Writes nothing.</b> A re-seed is an edit of the page's {@code .html}, so where it goes is decided by the
* site's editorial level like any other save — {@code EditorialService#reseed} calls this under the page lock
* and saves the result through the editorial rules (a pending revision for a non-approver on a reviewed site,
* the quality gate on an enforced or reviewed one). An earlier version wrote the live files directly, past the
* review queue, the gate and the lock (before 0.5.0-beta14).
* the quality gate on an enforced or reviewed one). Writing the live files directly would bypass the
* review queue, the gate and the lock.
*
* @param page the page whose master supplies the chrome ({@link Page#template()})
* @param body the page body to re-seed — the live one, or a pending revision's
@@ -14,7 +14,7 @@ import jakarta.servlet.http.HttpServletRequest;
* {@code If-None-Match} header is present it alone decides, and a non-match forces a fresh render even
* if the date would have matched.
*
* <p>Public pages carry no modification time (since 1.0.0-rc1): {@link PageValidatorService} always yields
* <p>Public pages carry no modification time: {@link PageValidatorService} always yields
* {@code lastModified == 0}, so {@code If-Modified-Since} never answers {@code 304} for a page — most of what the ETag
* folds has no date that could move with it. The date path stays for a caller that can vouch for one.
*
@@ -311,8 +311,8 @@ public class PageWriteService {
*
* <p>The read-modify-write of the meta runs under the page's write monitor ({@link #withPageLock}), like every
* other mutation here: an unpublish that arrives while an approval (or a save) of the same page is in progress
* waits for it and then applies, instead of being silently overwritten by that operation's meta write — the
* page stayed live while the audit log said {@code page.unpublished} (before 0.5.0-beta14).
* waits for it and then applies, instead of being silently overwritten by that operation's meta write, which
* would leave the page live while the audit log said {@code page.unpublished}.
*
* @throws PageAuthoringException if the page is missing, or publishing would collide with a sibling route
*/
@@ -31,13 +31,13 @@ public final class EssentialAllowlist {
*
* <p>The paths are the installer's, relative to the Runway home ({@code /opt/runway} on a default install — the
* "current" symlink the service runs from, which is also the working directory the {@code external/} path is
* read against). The bundle carries the plugin under {@code seed/plugins/<id>/}, and from {@code 1.0.0-rc1} the
* installer keeps that folder in the release directory, so the repair needs no download: copy it over
* {@code external/plugins/<id>/}. After a rollback the symlink names the older release, whose {@code seed/} is the
* older plugin — the one that kernel needs, the same files as the {@code *.bak} pair the upgrade kept. The
* fallbacks cover the two cases where {@code seed/} is not the running release's copy: a release installed
* before {@code 1.0.0-rc1} has none, and a kernel jar replaced by hand left the earlier release's in place — then
* the operator extracts the running release's {@code .bin}.
* read against). The bundle carries the plugin under {@code seed/plugins/<id>/}, and the installer keeps that
* folder in the release directory, so the repair needs no download: copy it over {@code external/plugins/<id>/}.
* After a rollback the symlink names the older release, whose {@code seed/} is the older plugin — the one that
* kernel needs, the same files as the {@code *.bak} pair the upgrade kept. The fallbacks cover the two cases
* where {@code seed/} is not the running release's copy: a release whose installer did not keep {@code seed/} has
* none, and a kernel jar replaced by hand left the earlier release's in place — then the operator extracts the
* running release's {@code .bin}.
*
* @param pluginId an allowlisted essential plugin id
* @return one or more complete sentences, never {@code null}
@@ -48,7 +48,7 @@ public final class EssentialAllowlist {
+ "external/plugins/" + pluginId + "/, both in the Runway home (/opt/runway on a default install; "
+ "after a rollback its seed/ is the older release's copy, the one it needs), or re-run that "
+ "release's installer (sudo ./runway-<version>.bin -y — every upgrade refreshes it). If there is no "
+ "seed/ folder there (a release installed before 1.0.0-rc1) or you replaced the kernel jar by hand, "
+ "seed/ folder there (an older install) or you replaced the kernel jar by hand, "
+ "extract the running release (./runway-<version>.bin --extract DIR) and copy "
+ "DIR/runway-<version>/seed/plugins/" + pluginId + "/ instead; after a rollback to a release without "
+ "seed/, restore the plugin.yml.bak and *.jar.bak pair in external/plugins/" + pluginId + "/. Then "
@@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
* Reads the <b>constant pool</b> of every class on a plugin's class path — its top-level jars and {@code lib/*.jar},
* exactly the jars {@link PluginLoader#classLoaderFor} adds — without loading a single class —
* and reports how the plugin links the host. Every finding <b>blocks</b> the plugin before
* wiring (SPI 1.0.0; until rc1 the first and third only warned):
* wiring (SPI 1.0.0):
*
* <ol>
* <li><b>Host linkage</b>: a class reference, descriptor or signature naming {@code mx/quest/runway/…} outside
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
* signature — field and method descriptors, annotation types, {@code invokedynamic} types — matched as
* {@code L<name>;} or {@code L<name><}. A {@code CONSTANT_Utf8} used only as a string literal is skipped, so a
* plugin that merely <em>mentions</em> a host class name in a message is not flagged. {@code lib/} jars are scanned
* like the top-level ones (since 1.0.0-rc1): they are on the same class path, so a host-linking helper
* like the top-level ones: they are on the same class path, so a host-linking helper
* moved into {@code lib/} would otherwise pass the contract check. A third-party library links nothing of ours and
* passes; scanning it costs one read per jar per boot.
*
@@ -250,7 +250,7 @@ public class PluginAdminService {
* <p>An archive whose id is an <b>essential</b> one ({@link EssentialAllowlist}) is refused before anything is
* moved: the essential plugin's exemptions (no linkage scan or surface check, cannot be disabled or uninstalled,
* its failure takes every tenant page to 503) are claimed by id, so the only copy the platform treats as essential
* is the one the Runway installer/seed delivers (since 1.0.0-rc1).
* is the one the Runway installer/seed delivers.
*
* @throws IllegalArgumentException if the archive has no {@code plugin.yml}, the descriptor is invalid or names an
* essential plugin, or an entry path would escape the extraction root (zip-slip)
@@ -24,8 +24,7 @@ import org.springframework.stereotype.Component;
* {@code external/plugin-quarantine/<id>.yml} with the reason, logs an ERROR, and then fails the startup with
* {@link SurfaceViolationException}.
* {@code RunwayApplication.main} sees the marker and exits with the supervisor's relaunch code (42); the next boot
* blocks the plugin before wiring, with the reason on the plugins screen, and comes up without it. (Until 1.0.0-rc1
* these were warnings.)
* blocks the plugin before wiring, with the reason on the plugins screen, and comes up without it.
*
* <p>If the check itself cannot run (a defect in the kernel, not in a plugin) the boot continues: the failure is
* logged and kept as a compliance note for the plugins screen ({@link #warnings}), because failing every boot over a
@@ -151,8 +151,8 @@ public record PluginDescriptor(
* protection was a sentence in an upgrade note saying "kernel first, plugin second" — a rule enforced by an
* operator reading a paragraph at the exact moment they are busy doing an upgrade.
*
* <p>Against the <b>SPI level</b>, not the kernel release: a plugin does not care that the kernel is
* {@code 0.5.0-beta9}, it cares that a method exists. Kernel releases also move for reasons that have
* <p>Against the <b>SPI level</b>, not the kernel release: a plugin does not care which release the
* kernel is, it cares that a method exists. Kernel releases also move for reasons that have
* nothing to do with the plugin contract, so a version-number floor would go stale on its own.
*
* <p>Only a floor. The reverse direction is safe by the SPI evolution rule (old-arity constructors are
@@ -147,9 +147,9 @@ public final class PluginResolution {
}
// Pass 0b — no plugin may depend on an essential (security-floor) plugin. The essential plugin ships in
// lockstep with the kernel and its version line follows the kernel's (1.5.0 with 0.5.0-beta14, back to 1.0.0
// at rc1), so a `requires: protection >= 1.2` would silently start failing; consumers use the CaptchaService
// SPI instead.
// lockstep with the kernel and its version line follows the kernel's — renumbered with it, not with the
// plugin's own API — so a `requires: protection >= 1.2` would silently start failing; consumers use the
// CaptchaService SPI instead.
for (LoadedPlugin plugin : candidates) {
for (PluginRequirement requirement : plugin.descriptor().requirements()) {
if (EssentialAllowlist.contains(requirement.id()) && !EssentialAllowlist.contains(plugin.id())) {
@@ -32,10 +32,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* the {@code **} within the plugin's static dir, so a request can never traverse into another plugin or the
* external tree. {@code /__plugin} is a reserved prefix an {@code EndpointContributor} cannot claim.
*
* <h2>Caching (since 1.0.0-rc5)</h2>
* <h2>Caching</h2>
* A served file carries {@code runway.http-cache.plugin-assets} (default {@code public, max-age=3600}) and a strong
* ETag of its <b>content</b>; it carries no {@code Last-Modified}. Before 1.0.0-rc5 it carried neither rule nor ETag, so
* Spring Security's default {@code no-store} made a browser download a plugin's CSS or script again on every page
* ETag of its <b>content</b>; it carries no {@code Last-Modified}. Without a rule or an ETag,
* Spring Security's default {@code no-store} would make a browser download a plugin's CSS or script again on every page
* view. Why a content ETag and not the file date: plugin archives are built reproducibly, so every release stamps
* its files with the same fixed date, and a {@code Last-Modified} validator would answer {@code 304} to an upgraded
* file. The hash is computed once per file state (path, size, modification time) and remembered; an upgrade means
@@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
* every bean definition that belongs to the plugin (by the jar its declaring class came from), using the bean's
* real type. From SPI 1.0.0 a violation <b>blocks</b> the plugin: before refresh it is refused with the reason
* ({@code PluginContextInitializer}); after refresh it is quarantined and the boot ends with the relaunch code
* ({@link PluginCompliance}). (Until 1.0.0-rc1 both were warnings.)
* ({@link PluginCompliance}).
*
* <h2>The rules</h2>
* <ul>
@@ -67,7 +67,7 @@ public class SitePluginConfigService {
* <p><b>Why that was worth fixing rather than documenting:</b> it failed in the <i>permissive</i> direction
* with <i>false assurance</i>. The reload returned {@code {"reloaded":"<id>"}}, so an operator who had just
* added a {@code robots.extra-disallow} to keep crawlers off a path reasonably concluded it was in force. It
* was not, and nothing errored at any point. Found on a live deployment of {@code 0.5.0-beta6}, and reproduced
* was not, and nothing errored at any point. Found on a live deployment, and reproduced
* against a live tenant with a full restart as the control.
*
* <p>Scoped rather than {@link StoreCache#invalidateAll()} on purpose: {@code UPDATED} also fires on every
@@ -27,7 +27,7 @@ import org.springframework.context.ApplicationEventPublisher;
* content catalog, and the cluster relay that repeats it to peer nodes. (Until the follow-up that added
* {@code evictSite}, this sentence claimed template caches were cleared while {@code TemplateCacheService} acted
* only on delete/restore — a template file edited on disk kept rendering its old parse after a "successful"
* reload. Same lesson as below. Since 1.0.0-rc1 a template edited on disk also shows without any reload: a cached parse is
* reload. Same lesson as below. A template edited on disk also shows without any reload: a cached parse is
* valid only while its files are unchanged, {@code FileStampValidity}.) So "reload this site" is not a synonym for "evict
* SiteStore": it genuinely means re-read, and it covers the cases that actually bit — plugin config and icons —
* without this class knowing either of them exists.
@@ -37,8 +37,8 @@ import org.springframework.context.ApplicationEventPublisher;
* on a narrower condition silently drops out of the reload while this class still reports success.
* {@code SitePluginConfigService} did exactly that: it invalidated only on {@code isWholesaleReplacement()}
* (delete/restore), so per-site <i>plugin</i> config — named above as one of the two cases that motivated this
* feature — kept serving pre-edit YAML after a reload that returned {@code {"reloaded":"<id>"}}. Found in
* production on {@code 0.5.0-beta6}; fixed by scoping that listener's eviction to the changed site.
* feature — kept serving pre-edit YAML after a reload that returned {@code {"reloaded":"<id>"}}. Found on a
* live deployment; fixed by scoping that listener's eviction to the changed site.
*
* <p>The lesson for anyone adding a listener here or auditing this fan-out: <b>assert that the generated
* artefact changed</b> (fetch {@code /robots.txt}, the web manifest, the rendered page) — never that some
@@ -46,7 +46,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
* <p><b>Placement.</b> Each realm chain registers it before the CSRF check and before
* {@code PreAuthBodyLimitFilter}, so everything that asks "is this request signed in?" — the body budget first of all
* — sees the account as it is now: a suspended user's open session gets the pre-authentication body cap on its very
* next request, not the signed-in limit (since 1.0.0-rc1).
* next request, not the signed-in limit.
*
* <p>Only {@link RunwayUserDetails} principals are checked — the metrics bearer-token authentication and an
* anonymous request pass through untouched. Login itself needs no help: {@link RunwayUserDetails#isEnabled()}
@@ -27,7 +27,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
* <p>The login path is compared with both spellings of the request path ({@link RequestPaths#eitherMatches}):
* Spring Security processes a sign-in posted to {@code /app/%6Cogin} exactly like one posted to
* {@code /app/login}, so a raw-URI comparison would let an encoded spelling sign in past the lockout and the
* form guard (fixed in {@code rc4}).
* form guard.
*
* <p>Any other request passes straight through. One instance per realm, constructed with that realm's login path
* and {@link ProtectionScope.Realm}: the app-realm shell guards {@code /app/login} with an application scope, the
@@ -58,7 +58,7 @@ public final class SecurityHeaders {
* that response nothing writes {@code Cache-Control} at all. It is the cold, first-visit shape of every
* console entry point ({@code /__app}, {@code /__app/users}, {@code /__admin}), each a 302 to the login that
* also carries the new {@code Set-Cookie}. Reusing a session restores the header, which is what makes the
* defect invisible to any test that reuses a client session. (Found on a live deployment of {@code 0.5.0-beta2}.)
* defect invisible to any test that reuses a client session. (Found on a live deployment.)
*
* <p>Running <b>after</b> the default writer, this fills in {@code no-store} whenever the effective value does
* not already forbid storing — so Spring Security's own stronger
@@ -154,7 +154,7 @@ public class CspFilter extends OncePerRequestFilter {
// A per-request nonce is minted ONLY for the kernel surfaces whose templates actually carry
// nonce="${cspNonce}". A public tenant page never gets one: it would make an otherwise-identical
// SHARED-CACHEABLE response (`public, max-age=300`) vary per request, and a cache that stored header+body
// together would then serve one frozen nonce to everyone (raised from a live deployment against 0.5.0-beta1).
// together would then serve one frozen nonce to everyone (raised from a live deployment).
// Public pages get the ETag-DERIVED PublicPageNonce instead, picked up at commit — see the class Javadoc.
// Decided on the decoded path the dispatcher routes on (RequestPaths), so /app/%6Cogin gets the sign-in page's
// nonce and policy like /app/login: the page rendered is the same.
@@ -309,7 +309,7 @@ public class CspFilter extends OncePerRequestFilter {
// effective value doesn't already forbid storing. (Being merely conditional on "no Cache-Control
// present" was too weak — Spring Security's CacheControlHeadersWriter itself bails out when the
// response already carries an Expires/Pragma, which can leave a nonced page with no
// Cache-Control at all. Reported from a live deployment against 0.5.0-beta1.) An existing value that
// Cache-Control at all. Reported from a live deployment.) An existing value that
// already says no-store is left untouched, so a stronger handler-set policy is never downgraded.
if (nonce != null) {
String cacheControl = real.getHeader("Cache-Control");
@@ -20,12 +20,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* {@code /static/**}), which change rarely and land under a fresh URL when edited.</li>
* <li>{@link #getPluginAssets() pluginAssets} — a plugin's bundled files ({@code /__plugin/<id>/static/**},
* {@code PluginStaticResourceConfig}), which change only when the plugin is upgraded or an operator edits
* them on disk. Before 1.0.0-rc5 they carried no rule and Spring Security's default {@code no-store} made
* them on disk. Without a rule, Spring Security's default {@code no-store} would make
* every page view download them again.</li>
* </ul>
* The page-editor preview and error responses are always {@code no-store} and not configurable: a preview carries
* unsaved work and an error body must never be replayed, so there is no safe looser value. (A
* {@code runway.http-cache.no-store} key existed before 1.0 but was never read; it was removed in 1.0.0-rc2.)
* {@code runway.http-cache.no-store} key existed before 1.0 but was never read; it was removed, and a file that
* still sets it binds without error.)
*
* <p><b>Freshness vs. correctness.</b> The {@code publicPages} default carries a bounded {@code max-age}, but
* every public page still emits a strong ETag / {@code Last-Modified} (see {@code PageValidatorService}), so a
@@ -9,9 +9,9 @@ import java.util.List;
*
* <p>Tenant-band soft-block filters that short-circuit a site's <b>public</b> traffic (maintenance mode, the
* bandwidth quota) exempt this realm so the site manager is never locked out: they can always sign in, recover a
* forgotten password, and lift the block. It is the tenant parallel of {@link AppRealmPaths}. Before {@code 1.0.0-rc4}
* the recovery routes were missing here, so a site in maintenance answered {@code 503} on {@code /forgot-password}
* while {@code /login} worked.
* forgotten password, and lift the block. It is the tenant parallel of {@link AppRealmPaths}. The
* recovery routes belong here too: without them, a site in maintenance would answer {@code 503} on
* {@code /forgot-password} while {@code /login} worked.
*
* <p>Exact matches and real namespaces only, so a public page at {@code /__adminx} is not exempted. Like
* {@link AppRealmPaths}, the predicates take a <b>decoded</b> path ({@link RequestPaths#normalized}).
@@ -12,11 +12,12 @@ package mx.quest.runway.web;
* <p>The set: the application realm exactly as {@link AppRealmPaths#isAppRealm} defines it (the console, its
* sign-in and recovery routes, {@code /actuator}), the per-site {@code /__health} probe, and the operator
* {@code /__reload} endpoint. It takes a <b>decoded</b> path ({@link RequestPaths#normalized}): {@code /%5F%5Fapp}
* is console traffic, and was once charged to the site whose host it was sent to. Before {@code 1.0.0-rc4} the realm part
* was a loose prefix ({@code /__app…}, {@code /app/…}, {@code /actuator…}), which also left every other path under
* {@code /app/} unmetered (now only the four console routes are). Health is excluded because a monitoring system polls it continuously and by design:
* charging that to the tenant would let an operator's own probe consume the tenant's quota and eventually 503 the
* site it is meant to be watching, and it would bury real traffic in the per-site request timer.
* is console traffic, not traffic to charge to the site whose host it was sent to. The realm part is matched as
* {@link AppRealmPaths} matches it — real namespaces and exact routes, never a loose prefix ({@code /__app…},
* {@code /app/…}, {@code /actuator…}), which would also leave every other path under {@code /app/} unmetered (only
* the four console routes are unmetered). Health is excluded because a monitoring system polls it continuously and
* by design: charging that to the tenant would let an operator's own probe consume the tenant's quota and
* eventually 503 the site it is meant to be watching, and it would bury real traffic in the per-site request timer.
*
* <p><b>{@code /__health} matches EXACTLY, never by prefix.</b> The realm prefixes below are genuine namespaces
* whose whole subtree is platform traffic; {@code /__health} is one concrete route, so a hypothetical
@@ -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