You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2022/05/03 10:37:10 UTC
[GitHub] [jena] vtermanis opened a new pull request, #1291: jena-fuseki-access - Propagate request/service context
vtermanis opened a new pull request, #1291:
URL: https://github.com/apache/jena/pull/1291
### What
Process request/service context in `AccessControlledDataset` the same way as is done in (parent) query processor, i.e. honour the server => dataset => endpoint context value priority order.
### Why
Standard SPARQL queries honour the context of the endpoint ([see docs](https://jena.apache.org/documentation/fuseki2/fuseki-config-endpoint.html)) as well as setting of reuqest-specific timeout via the `timeout` URL parameter. These two features allow one to:
- Override context values specified at server and/or dataset level (e.g. disable access to text indexing or change the default timeout for the endpoint)
- Specify per-request timeouts
(See bottom of summary of example. See also [mailing list thread](https://markmail.org/message/n7tcbi3ihfzlvbdv#query:+page:1+mid:2mvx45a2avki4tvc+state:results).)
### How
- Use `QueryExec` to create the `QueryExecution` instead of `QueryExecutionFactory` (the latter does not consider `HTTPActions`'s context)
- Use same `timeout` parameter logic for pre-request timeouts as in base SPARQL query processor
---
**Note**: I am not convinced that the way I've updated `AccessControlledDataset` (and promoted a helper method from `SPARQLQueryProcessor.java` to public) is the right way to go. But I can confirm that the following use-case works:
1. Define a dataset `DS1` with `jena:text` indexing enabled
2. Define a dataset `DS2`, with `AccessControlledDataset` wrapping `DS1`. (The access actual rules are irrelevant here.)
3. Define service `A` exposing a query endpoint for `DS1`, with extended context: `ja:context [ ja:cxtName "http://jena.apache.org/text#index" ; ja:cxtValue false ] ;`
4. Define service `B` the same as `A`, but for `DS2`
Current behaviour (pre-patch):
- `jena:text` is exposed in queries against `A` & `B`
Expected behaviour (post patch):
- `jena:text` is exposed only with query endpoint of `A`. SPARQL queries against `B` do not match text-indexed properties.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] vtermanis commented on pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
vtermanis commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-1198570303
@afs thanks for the heads-up, do you mean:
- https://github.com/apache/jena/pull/1444
Is that the main one or other there others in particular? (Though it'll probably be clear when I rebase what's changed and look at the query servlet & processor code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] afs commented on pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
afs commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-1115986632
From users@ thread https://lists.apache.org/thread/h0c81qjl8oc83yl2xf7xvt4l0pw4grrf
It looks like there is an issue as to whether the text dataset should push down the context setting for the index or not. Requiring endpoint configuration isn't so user-friendly.
This PR may contain a change to make anyway but this jena-fuseki-access uses context settings `DataAccessCtl.symAuthorizationService` itself so allowing the endpoints to modify context may be a security risk. Needs investigation - it's been a long time since I looked at the code!
An outstanding question [from email](https://lists.apache.org/thread/1t6cd3chn75twm1w6wrfwp5wrow6mk2g):
* Doesn't that [setting the context to an illegal value] cause warnings in the Fuseki log?
It'll need some tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] vtermanis commented on pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
vtermanis commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-1117033891
(Changing to draft as suggested, since the best way to address this is still being debated.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] afs commented on pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
afs commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-1198982894
#1444 is about transactions.
#1375 and parts of some others around that time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
Re: [PR] jena-fuseki-access - Propagate request/service context [jena]
Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-2568415414
Closing due to age and the fact a lot has changed in Fuseki.
The context needs are possibly addressed by work that happened after this PR.
For the more general issues raised by [JENA-2339](https://issues.apache.org/jira/projects/JENA/issues/JENA-2339) / PR #1441 where control of security is made external to Fuseki, there is now a 3rd party system for Jena -- rdf-abac (https://github.com/telicent-oss/rdf-abac) which puts the policy control concern outside of the Fuseki engine that might be applicible to the use case.
It provides per-quad filtering of data coming out of a TDB2 database. A query operation only gets to see RDF data that it is permitted to see by policy. Each per gets a request specific dynamic view of the RDF data so query execution is only based on permitted data. The policy engine is accessed at request time.
For text query, either check for triples (and hence security permissions) after text index access or enhance the text search service to apply system-wide policies hared with the graph database.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] afs commented on pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
afs commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-1184458427
@vtermanis -- there has been a bug fixes for general context handling with queries and these are now on the main branch. I don't think it immediately relates to your report but I wanted to make sure you are working against the right state of the codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] vtermanis commented on pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
vtermanis commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-1116204354
> * Doesn't that [setting the context to an illegal value] cause warnings in the Fuseki log?
(copied from [thread reply](https://markmail.org/message/7xj7c3ybg5qushhs)):
Yes it does - three (expected) warnings from TextQueryPF:
1) `Context setting 'symbol:http://jena.apache.org/text#index'is not a
TextIndex`
2) `Failed to find the text index : tried context and as a text-enabled
dataset`
3) `No text index - no text search performed`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
Re: [PR] jena-fuseki-access - Propagate request/service context [jena]
Posted by "afs (via GitHub)" <gi...@apache.org>.
afs closed pull request #1291: jena-fuseki-access - Propagate request/service context
URL: https://github.com/apache/jena/pull/1291
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] vtermanis commented on a diff in pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
vtermanis commented on code in PR #1291:
URL: https://github.com/apache/jena/pull/1291#discussion_r863654301
##########
jena-fuseki2/jena-fuseki-access/src/main/java/org/apache/jena/fuseki/access/SecurityContext.java:
##########
@@ -78,11 +83,22 @@ public default Collection<String> visibleGraphNames() {
public boolean visableDefaultGraph();
- public default QueryExecution createQueryExecution(String queryString, DatasetGraph dsg) {
- return createQueryExecution(QueryFactory.create(queryString), dsg);
+ public default QueryExecution createQueryExecution(HttpAction action, String queryString, DatasetGraph dsg) {
+ return createQueryExecution(action, QueryFactory.create(queryString), dsg);
}
- public QueryExecution createQueryExecution(Query query, DatasetGraph dsg);
+ public default QueryExecution createQueryExecution(HttpAction action, Query query, DatasetGraph dsg) {
+ QueryExecDatasetBuilder builder = QueryExec.newBuilder()
+ .dataset(dsg)
+ .query(query)
+ .context(action.getContext())
+ ;
+ // Note: Instead of this call (and the above build), the equivalent code from
Review Comment:
Repeating the same step here for timeout seems not right (but I wasn't sure what a better / the right approach would be).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org
[GitHub] [jena] vtermanis commented on pull request #1291: jena-fuseki-access - Propagate request/service context
Posted by GitBox <gi...@apache.org>.
vtermanis commented on PR #1291:
URL: https://github.com/apache/jena/pull/1291#issuecomment-1116211500
Apologies - I updated the description since it had a mistake. The expected behaviour section has changed to:
> Current behaviour (pre-patch):
>
> - jena:text is exposed only with query endpoint of B. SPARQL queries against A do not match text-indexed properties.
>
> Expected behaviour (post patch):
> - **Neither A nor B** match text-indexed properties
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org