Runway 1.0.1
This commit is contained in:
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 <link …>}) 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
|
||||
|
||||
Reference in new issue
Block a user