Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions config/dataspaces.trig
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
@prefix lapp: <https://w3id.org/atomgraph/linkeddatahub/apps#> .
@prefix ldh: <https://w3id.org/atomgraph/linkeddatahub#> .
@prefix ac: <https://w3id.org/atomgraph/client#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ldt: <https://www.w3.org/ns/ldt#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

### do not use blank nodes to identify resources! ###
### urn: URI scheme is used because applications are not accessible in their own dataspace (under $BASE_URI) ###
Expand Down
1 change: 0 additions & 1 deletion config/system.trig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@prefix lapp: <https://w3id.org/atomgraph/linkeddatahub/apps#> .
@prefix a: <https://w3id.org/atomgraph/core#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ldt: <https://www.w3.org/ns/ldt#> .
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
@prefix dct: <http://purl.org/dc/terms/> .
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ secrets:
# file: ./secrets/credentials.trig
volumes:
varnish_frontend_cache:
varnish_end_user_cache:
services:
nginx:
image: nginx:1.23.3
Expand Down Expand Up @@ -153,8 +154,10 @@ services:
depends_on:
- linkeddatahub
tmpfs: /var/lib/varnish/varnishd:exec
volumes:
- varnish_end_user_cache:/var/lib/varnish
entrypoint: varnishd
command: [ "-F", "-f", "/etc/varnish/default.vcl", "-a", "http=:80,HTTP", "-a", "proxy=:8443,PROXY", "-p", "feature=+http2", "-s", "malloc,1G", "-t", "86400", "-p", "timeout_idle=60s" ] # -F: foreground, -f: config, -a: listeners, -p: http2 + idle timeout, -s: storage, -t: TTL
command: [ "-F", "-f", "/etc/varnish/default.vcl", "-a", "http=:80,HTTP", "-a", "proxy=:8443,PROXY", "-p", "feature=+http2", "-s", "file,/var/lib/varnish/storage.bin,3G", "-t", "86400", "-p", "timeout_idle=60s" ] # -F: foreground, -f: config, -a: listeners, -p: http2 + idle timeout, -s: storage, -t: TTL
email-server:
image: namshi/smtp
environment:
Expand Down
16 changes: 16 additions & 0 deletions http-tests/dataspaces/non-existent-dataspace-xhtml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail

# Test that accessing a non-configured dataspace returns 404, not 500

# Try to access admin on non-existent test.localhost dataspace
curl -k -w "%{http_code}\n" -o /dev/null -s \
-H "Accept: application/xhtml+xml" \
"https://admin.non-existing.localhost:4443/" \
| grep -q "$STATUS_NOT_FOUND"

# Try to access end-user on non-existent test.localhost dataspace
curl -k -w "%{http_code}\n" -o /dev/null -s \
-H "Accept: application/xhtml+xml" \
"https://non-existing.localhost:4443/" \
| grep -q "$STATUS_NOT_FOUND"
23 changes: 23 additions & 0 deletions http-tests/imports/GET-file-404.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail

initialize_dataset "$END_USER_BASE_URL" "$TMP_END_USER_DATASET" "$END_USER_ENDPOINT_URL"
initialize_dataset "$ADMIN_BASE_URL" "$TMP_ADMIN_DATASET" "$ADMIN_ENDPOINT_URL"
purge_cache "$END_USER_VARNISH_SERVICE"
purge_cache "$ADMIN_VARNISH_SERVICE"
purge_cache "$FRONTEND_VARNISH_SERVICE"

# add agent to the writers group
add-agent-to-group.sh \
-f "$OWNER_CERT_FILE" \
-p "$OWNER_CERT_PWD" \
--agent "$AGENT_URI" \
"${ADMIN_BASE_URL}acl/groups/writers/"

# Attempt to GET a non-existent upload file using a fake SHA1 hash
file="${END_USER_BASE_URL}uploads/0000000000000000000000000000000000000000"

curl -k -w "%{http_code}\n" -o /dev/null -s -G \
-E "$AGENT_CERT_FILE":"$AGENT_CERT_PWD" \
"$file" \
| grep -q "$STATUS_NOT_FOUND"
7 changes: 3 additions & 4 deletions platform/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ SECRETARY_URI="${SECRETARY_URI:-${ADMIN_BASE_URI}acl/agents/${SECRETARY_UUID}/#t

OWNER_DATASET_PATH="/var/linkeddatahub/datasets/owner/${OWNER_CERT_ALIAS}.trig"

printf "\n### Owner's WebID URI: %s\n" "$OWNER_URI"

# generate owner's keystore, cert, and public key if the public key does not exist
# store owner's metadata in an RDF dataset
if [ ! -f "$OWNER_PUBLIC_KEY" ]; then
Expand Down Expand Up @@ -560,8 +558,6 @@ fi

SECRETARY_DATASET_PATH="/var/linkeddatahub/datasets/secretary/${SECRETARY_CERT_ALIAS}.trig"

printf "\n### Secretary's WebID URI: %s\n" "$SECRETARY_URI"

# generate secretary's keystore, cert, and public key if the public key does not exist
# store secretary's metadata in an RDF dataset
if [ ! -f "$SECRETARY_PUBLIC_KEY" ]; then
Expand Down Expand Up @@ -624,6 +620,9 @@ SECRETARY_KEY_URI=$(echo "$secretary_metadata" | xmlstarlet sel -N srx="http://w
SECRETARY_KEY_DOC_URI=$(echo "$SECRETARY_KEY_URI" | sed 's|#this$||')
SECRETARY_KEY_URI="${SECRETARY_KEY_DOC_URI}#this"

printf "\n### Owner's WebID URI: %s\n" "$OWNER_URI"
printf "\n### Secretary's WebID URI: %s\n" "$SECRETARY_URI"

# Note: LOAD_DATASETS check is now done per-app inside the loop

# base the $CONTEXT_DATASET
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.atomgraph</groupId>
<artifactId>linkeddatahub</artifactId>
<version>5.3.2</version>
<version>5.3.3-SNAPSHOT</version>
<packaging>${packaging.type}</packaging>

<name>AtomGraph LinkedDataHub</name>
Expand Down Expand Up @@ -46,7 +46,7 @@
<url>https://github.com/AtomGraph/LinkedDataHub</url>
<connection>scm:git:git://github.com/AtomGraph/LinkedDataHub.git</connection>
<developerConnection>scm:git:git@github.com:AtomGraph/LinkedDataHub.git</developerConnection>
<tag>linkeddatahub-5.3.2</tag>
<tag>linkeddatahub-2.1.1</tag>
</scm>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public Item(@Context Request request, @Context UriInfo uriInfo, MediaTypes media
public void init()
{
getResource().getModel().add(describe());

if (getResource().getModel().isEmpty()) throw new NotFoundException("File not found");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public class CacheInvalidationFilter implements ContainerResponseFilter
@Override
public void filter(ContainerRequestContext req, ContainerResponseContext resp) throws IOException
{
// If no application was matched (e.g., non-existent dataspace), skip cache invalidation
if (!getApplication().isPresent()) return;
// If no application was matched (e.g., non-existent dataspace or request scope unavailable), skip cache invalidation
Optional<com.atomgraph.linkeddatahub.apps.model.Application> application = getApplication();
if (application == null || !application.isPresent()) return;

if (req.getMethod().equals(HttpMethod.POST) && resp.getHeaderString(HttpHeaders.LOCATION) != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public Source getSource(String url) throws IOException
try (Response cr = builder.accept(MediaType.TEXT_XSL_TYPE).get())
{
if (!cr.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL))
throw new IOException("XSLT stylesheet could not be successfully loaded over HTTP");
throw new IOException("XSLT stylesheet could not be successfully loaded over HTTP. URL: " + uri);

// buffer the stylesheet stream so we can close Response
try (InputStream is = cr.readEntity(InputStream.class))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,18 @@ public <T extends XdmValue> Map<QName, XdmValue> getParameters(MultivaluedMap<St
try
{
params.put(new QName("ldh", LDH.requestUri.getNameSpace(), LDH.requestUri.getLocalName()), new XdmAtomicValue(getRequestURI()));
params.put(new QName("lapp", LAPP.Context.getNameSpace(), LAPP.Context.getLocalName()),
getXsltExecutable().getProcessor().newDocumentBuilder().build(getSource(getSystem().getContextModel())));

Optional<com.atomgraph.linkeddatahub.apps.model.Application> appOpt = getApplication().get();
if (!appOpt.isPresent())
if (appOpt.isPresent())
{
if (log.isWarnEnabled()) log.warn("Application not present in XSLTWriterBase.getParameters()");
return params; // return early if no application
com.atomgraph.linkeddatahub.apps.model.Application app = appOpt.get();
if (log.isDebugEnabled()) log.debug("Passing $lapp:Application to XSLT: <{}>", app);
params.put(new QName("ldt", LDT.base.getNameSpace(), LDT.base.getLocalName()), new XdmAtomicValue(app.getBaseURI()));
params.put(new QName("lapp", LAPP.origin.getNameSpace(), LAPP.origin.getLocalName()), new XdmAtomicValue(app.getOriginURI()));
params.put(new QName("ldt", LDT.ontology.getNameSpace(), LDT.ontology.getLocalName()), new XdmAtomicValue(URI.create(app.getOntology().getURI())));
}

com.atomgraph.linkeddatahub.apps.model.Application app = appOpt.get();
if (log.isDebugEnabled()) log.debug("Passing $lapp:Application to XSLT: <{}>", app);
params.put(new QName("ldt", LDT.base.getNameSpace(), LDT.base.getLocalName()), new XdmAtomicValue(app.getBaseURI()));
params.put(new QName("lapp", LAPP.origin.getNameSpace(), LAPP.origin.getLocalName()), new XdmAtomicValue(app.getOriginURI()));
params.put(new QName("ldt", LDT.ontology.getNameSpace(), LDT.ontology.getLocalName()), new XdmAtomicValue(URI.create(app.getOntology().getURI())));
params.put(new QName("lapp", LAPP.Context.getNameSpace(), LAPP.Context.getLocalName()),
getXsltExecutable().getProcessor().newDocumentBuilder().build(getSource(app.getModel())));

URI endpointURI = getLinkURI(headerMap, SD.endpoint);
if (endpointURI != null) params.put(new QName("sd", SD.endpoint.getNameSpace(), SD.endpoint.getLocalName()), new XdmAtomicValue(endpointURI));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ button.add-typeahead { width: 219px; }
div[typeof="https://w3id.org/atomgraph/linkeddatahub#XHTML"] .main { font-size: larger; line-height: 25px; }
div[typeof="https://w3id.org/atomgraph/linkeddatahub#XHTML"] .form-horizontal .control-label { display: none; }
div[typeof="https://w3id.org/atomgraph/linkeddatahub#XHTML"] .form-horizontal .controls { margin-left: 0; }
.span12.progress > div:first-child { background-color: #e9ecef; }
.span12.progress .row-block-controls { background-color: #e9ecef; }
.span12.progress .bar { height: 20px; }
/* .content .btn.add-typeahead { margin-top: -10px; } */
object { display: block; margin: auto; max-height: 400px; overflow: hidden; width: 100%; }
.chart-canvas { width: 100%; height: 400px; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ exclude-result-prefixes="#all"
</xsl:if>
</xsl:template>

<!-- show drag handle on left edge hover -->
<xsl:template match="div[ac:mode() = '&ldh;ContentMode'][contains-token(@class, 'block')][key('elements-by-class', 'drag-handle', .)][acl:mode() = '&acl;Write']" mode="ixsl:onmousemove" priority="2">
<!-- show drag handle on left edge hover, but not when left sidebar is active -->

<xsl:template match="div[ac:mode() = '&ldh;ContentMode'][contains-token(@class, 'block')][key('elements-by-class', 'drag-handle', .)][acl:mode() = '&acl;Write'][not(ixsl:style(id('left-sidebar', ixsl:page()))?display = 'block')]" mode="ixsl:onmousemove" priority="2">
<xsl:variable name="dom-x" select="ixsl:get(ixsl:event(), 'clientX')" as="xs:double"/>
<xsl:variable name="rect" select="ixsl:call(., 'getBoundingClientRect', [])"/>
<xsl:variable name="offset-x" select="$dom-x - ixsl:get($rect, 'x')" as="xs:double"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ exclude-result-prefixes="#all"

<!-- Initialize progress counters -->
<xsl:variable name="cache" select="ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block/@about || '`')"/>
<xsl:sequence select="ldh:update-progress-counter($cache, map{'container': $container}, 'init', ())"/>

<xsl:sequence select="ldh:update-progress-counter($cache, map{'container': $container}, 'init', 3)"/>

<xsl:variable name="request-uri" select="ldh:href(ac:document-uri($query-uri), map{})" as="xs:anyURI"/>
<xsl:variable name="request" select="map{ 'method': 'GET', 'href': $request-uri, 'headers': map{ 'Accept': 'application/rdf+xml' } }" as="map(*)"/>
Expand All @@ -94,9 +95,6 @@ exclude-result-prefixes="#all"
'cache': ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block/@about || '`')
}"/>

<!-- Track HTTP request start -->
<xsl:sequence select="ldh:update-progress-counter($cache, map{'container': $container}, 'start', ())"/>

<xsl:sequence select="
ldh:load-block#3(
$context,
Expand Down Expand Up @@ -136,9 +134,6 @@ exclude-result-prefixes="#all"

<xsl:message>ldh:view-results-thunk</xsl:message>

<!-- Track HTTP request start -->
<xsl:sequence select="ldh:update-progress-counter($context('cache'), $context, 'start', ())"/>

<xsl:sequence select="
ixsl:http-request($context('request')) =>
ixsl:then(ldh:rethread-response($context, ?)) =>
Expand Down Expand Up @@ -170,9 +165,6 @@ exclude-result-prefixes="#all"
<xsl:variable name="query-string" select="$object-metadata-query || ' VALUES $this { ' || string-join(for $uri in $object-uris return '&lt;' || $uri || '&gt;', ' ') || ' }'" as="xs:string"/>
<xsl:variable name="request" select="map{ 'method': 'POST', 'href': ldh:href($endpoint), 'media-type': 'application/sparql-query', 'body': $query-string, 'headers': map{ 'Accept': 'application/rdf+xml' } }" as="map(*)"/>

<!-- Track HTTP request start -->
<xsl:sequence select="ldh:update-progress-counter($context('cache'), $context, 'start', ())"/>

<xsl:sequence select="map:merge(($context, map{ 'request': $request , 'response': () , 'results': $results }), map{ 'duplicates': 'use-last' })"/>
</xsl:when>
<xsl:otherwise>
Expand Down Expand Up @@ -390,9 +382,6 @@ exclude-result-prefixes="#all"
'cache': $cache
}"/>

<!-- Track HTTP request start -->
<xsl:sequence select="ldh:update-progress-counter($cache, $context, 'start', ())"/>

<ixsl:promise select="ixsl:http-request($context('request')) =>
ixsl:then(ldh:rethread-response($context, ?)) =>
ixsl:then(ldh:handle-response#1) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ xmlns:bs2="http://graphity.org/xsl/bootstrap/2.3.2"
exclude-result-prefixes="#all">

<!-- show "Actions" dropdown with Install/Uninstall options for packages -->
<xsl:template match="*[rdf:type/@rdf:resource = '&lapp;Package']" mode="bs2:Actions">
<xsl:template match="*[rdf:type/@rdf:resource = '&lapp;Package'][$lapp:origin]" mode="bs2:Actions">
<xsl:variable name="admin-origin" select="xs:anyURI(replace(string($lapp:origin), '^(https?://)', '$1admin.'))" as="xs:anyURI"/>

<div class="btn-group pull-right">
Expand Down
Loading
Loading