Skip to content

Commit 8b9e646

Browse files
namedgraphclaude
andcommitted
Move proxy logic from ProxiedGraph into ProxyRequestFilter
Replace the JAX-RS sub-resource (ProxiedGraph) and Dispatcher routing with a @PreMatching ContainerRequestFilter (priority 4050) that intercepts all proxy requests — both explicit ?uri= params and lapp:Dataset matches — before AuthorizationFilter runs. ACL is no longer checked for proxy requests; access control is enforced by the target endpoint. Removes the proxy bypass hack from AuthorizationFilter and simplifies Dispatcher (no more getProxyClass()). ProxiedGraph is deleted entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 591db41 commit 8b9e646

File tree

6 files changed

+370
-750
lines changed

6 files changed

+370
-750
lines changed

http-tests/proxy/POST-proxied-query-no-writers.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/main/java/com/atomgraph/linkeddatahub/Application.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
import com.atomgraph.linkeddatahub.server.factory.OntologyFactory;
102102
import com.atomgraph.linkeddatahub.server.factory.ServiceFactory;
103103
import com.atomgraph.linkeddatahub.server.filter.request.OntologyFilter;
104+
import com.atomgraph.linkeddatahub.server.filter.request.ProxyRequestFilter;
104105
import com.atomgraph.linkeddatahub.server.filter.request.AuthorizationFilter;
105106
import com.atomgraph.linkeddatahub.server.filter.request.ContentLengthLimitFilter;
106107
import com.atomgraph.linkeddatahub.server.filter.request.auth.ProxiedWebIDFilter;
@@ -1098,6 +1099,7 @@ protected void registerContainerRequestFilters()
10981099
register(ApplicationFilter.class);
10991100
register(OntologyFilter.class);
11001101
register(ProxiedWebIDFilter.class);
1102+
register(ProxyRequestFilter.class);
11011103
register(AuthorizationFilter.class);
11021104
if (getMaxContentLength() != null) register(new ContentLengthLimitFilter(getMaxContentLength()));
11031105
register(new RDFPostMediaTypeInterceptor()); // for application/x-www-form-urlencoded

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package com.atomgraph.linkeddatahub.server.filter.request;
1818

19-
import com.atomgraph.client.vocabulary.AC;
2019
import com.atomgraph.linkeddatahub.apps.model.EndUserApplication;
2120
import com.atomgraph.linkeddatahub.client.SesameProtocolClient;
2221
import com.atomgraph.linkeddatahub.server.exception.auth.AuthorizationException;
@@ -106,18 +105,6 @@ public void filter(ContainerRequestContext request) throws IOException
106105
if (request == null) throw new IllegalArgumentException("ContainerRequestContext cannot be null");
107106
if (log.isDebugEnabled()) log.debug("Authorizing request URI: {}", request.getUriInfo().getRequestUri());
108107

109-
// allow proxied URIs - ACL is enforced by the target endpoint
110-
// SSRF protection is handled separately in ProxiedGraph via URLValidator
111-
// LDH's document-centric ACL (acl:accessTo <document>) is not meaningful for the proxy,
112-
// which is a global transport function, not a document. Requiring acl:Write on a local
113-
// document just to forward a DELETE to a remote target would be a security anti-pattern.
114-
if (request.getUriInfo().getQueryParameters().containsKey(AC.uri.getLocalName()))
115-
{
116-
String proxiedURI = request.getUriInfo().getQueryParameters().getFirst(AC.uri.getLocalName());
117-
if (getSystem().getDataManager().isMapped(proxiedURI)) return; // mapped local file
118-
return; // external URI — skip ACL, target enforces its own access control
119-
}
120-
121108
Resource accessMode = ACCESS_MODES.get(request.getMethod());
122109
if (log.isDebugEnabled()) log.debug("Request method: {} ACL access mode: {}", request.getMethod(), accessMode);
123110
if (accessMode == null)
@@ -135,8 +122,6 @@ public void filter(ContainerRequestContext request) throws IOException
135122
}
136123
}
137124

138-
if (getDataset().isPresent()) return; // skip proxied dataspaces
139-
140125
final Agent agent;
141126
if (request.getSecurityContext().getUserPrincipal() instanceof Agent) agent = ((Agent)(request.getSecurityContext().getUserPrincipal()));
142127
else agent = null; // public access
@@ -463,4 +448,4 @@ public ParameterizedSparqlString getOwnerACLQuery()
463448
return ownerAclQuery.copy();
464449
}
465450

466-
}
451+
}

0 commit comments

Comments
 (0)