Skip to content

Commit 845ce0d

Browse files
namedgraphclaude
andcommitted
ProxyRequestFilter: clarify HTML bypass as resource exhaustion defence
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 51c4bb7 commit 845ce0d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/main/java/com/atomgraph/linkeddatahub/server/filter/request/ProxyRequestFilter.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@
8383
* ACL is not checked for proxy requests: the proxy is a global transport function, not a document
8484
* operation. Access control is enforced by the target endpoint.
8585
* <p>
86-
* This filter intentionally does <em>not</em> proxy (X)HTML responses. When the client accepts only
87-
* (X)HTML (e.g. a browser navigating directly), it would receive the same LDH application shell it
88-
* already has — an unnecessary round-trip with no benefit. Instead those requests fall through to the
89-
* downstream handler, which serves the shell; the client-side Saxon-JS layer then fetches RDF via a
90-
* second request that <em>does</em> hit this filter. The bypass is implemented by building the
91-
* candidate variant list from Core's {@link MediaTypes} (RDF/SPARQL types only, no HTML) and treating
92-
* a {@code null} result from {@link Request#selectVariant} as the bypass signal.
86+
* This filter intentionally does <em>not</em> proxy (X)HTML responses. Rendering arbitrary external
87+
* URIs as (X)HTML through the full server-side pipeline (SPARQL DESCRIBE + XSLT) for every
88+
* browser-originated proxy request would cause unbounded resource exhaustion — a connection-pool and
89+
* CPU amplification attack vector. Instead, HTML-only requests fall through to the downstream handler,
90+
* which serves the LDH application shell; the client-side Saxon-JS layer then issues a second,
91+
* RDF-typed request that <em>does</em> hit this filter and is handled cheaply. The bypass is
92+
* implemented by building the candidate variant list from Core's {@link MediaTypes} (RDF/SPARQL types
93+
* only, no HTML) and treating a {@code null} result from {@link Request#selectVariant} as the signal
94+
* to skip proxying.
9395
*
9496
* @author Martynas Jusevičius {@literal <martynas@atomgraph.com>}
9597
*/

0 commit comments

Comments
 (0)