solid-server 5.6.16 → 5.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,15 +87,27 @@ class ACLChecker {
87
87
  }
88
88
  let accessDenied = aclCheck.accessDenied(acl.graph, resource, directory, aclFile, agent, modes, agentOrigin, trustedOrigins, originTrustedModes)
89
89
 
90
+ function accessDeniedForAccessTo (mode) {
91
+ const accessDeniedAccessTo = aclCheck.accessDenied(acl.graph, directory, null, aclFile, agent, [ACL(mode)], agentOrigin, trustedOrigins, originTrustedModes)
92
+ const accessResult = !accessDenied && !accessDeniedAccessTo
93
+ accessDenied = accessResult ? false : accessDenied || accessDeniedAccessTo
94
+ // debugCache('accessDenied result ' + accessDenied)
95
+ }
90
96
  // For create and update HTTP methods
91
97
  if ((method === 'PUT' || method === 'PATCH' || method === 'COPY') && directory) {
92
98
  // if resource and acl have same parent container,
93
99
  // and resource does not exist, then accessTo Append from parent is required
94
100
  if (directory.value === dirname(aclFile.value) + '/' && !resourceExists) {
95
- const accessDeniedAccessTo = aclCheck.accessDenied(acl.graph, directory, null, aclFile, agent, [ACL('Append')], agentOrigin, trustedOrigins, originTrustedModes)
96
- const accessResult = !accessDenied && !accessDeniedAccessTo
97
- accessDenied = accessResult ? false : accessDenied || accessDeniedAccessTo
98
- // debugCache('accessDenied result ' + accessDenied)
101
+ accessDeniedForAccessTo('Append')
102
+ }
103
+ }
104
+
105
+ // For delete HTTP method
106
+ if ((method === 'DELETE') && directory) {
107
+ // if resource and acl have same parent container,
108
+ // then accessTo Write from parent is required
109
+ if (directory.value === dirname(aclFile.value) + '/') {
110
+ accessDeniedForAccessTo('Write')
99
111
  }
100
112
  }
101
113
  if (accessDenied && user) {
@@ -20,16 +20,26 @@ async function parsePatchDocument (targetURI, patchURI, patchText) {
20
20
 
21
21
  // Query the N3 document for insertions and deletions
22
22
  let firstResult
23
- try {
23
+ try { // solid/protocol v0.9.0
24
24
  firstResult = await queryForFirstResult(patchGraph, `${PREFIXES}
25
25
  SELECT ?insert ?delete ?where WHERE {
26
- ?patch solid:patches <${targetURI}>.
26
+ ?patch a solid:InsertDeletePatch.
27
27
  OPTIONAL { ?patch solid:inserts ?insert. }
28
28
  OPTIONAL { ?patch solid:deletes ?delete. }
29
29
  OPTIONAL { ?patch solid:where ?where. }
30
30
  }`)
31
31
  } catch (err) {
32
- throw error(400, `No patch for ${targetURI} found.`, err)
32
+ try { // deprecated, kept for compatibility
33
+ firstResult = await queryForFirstResult(patchGraph, `${PREFIXES}
34
+ SELECT ?insert ?delete ?where WHERE {
35
+ ?patch solid:patches <${targetURI}>.
36
+ OPTIONAL { ?patch solid:inserts ?insert. }
37
+ OPTIONAL { ?patch solid:deletes ?delete. }
38
+ OPTIONAL { ?patch solid:where ?where. }
39
+ }`)
40
+ } catch (err) {
41
+ throw error(400, 'No n3-patch found.', err)
42
+ }
33
43
  }
34
44
 
35
45
  // Return the insertions and deletions as an rdflib patch document
@@ -1,6 +1,6 @@
1
1
  module.exports = handler
2
2
 
3
- const Busboy = require('busboy')
3
+ const Busboy = require('@fastify/busboy')
4
4
  const debug = require('debug')('solid:post')
5
5
  const path = require('path')
6
6
  const header = require('../header')
package/lib/header.js CHANGED
@@ -66,7 +66,8 @@ async function linksHandler (req, res, next) {
66
66
  return next(error(404, 'Trying to access metadata file as regular file'))
67
67
  }
68
68
  const fileMetadata = new metadata.Metadata()
69
- if (filename.endsWith('/')) {
69
+ if (req.path.endsWith('/')) {
70
+ // do not add storage header in serverUri
70
71
  if (req.path === '/') fileMetadata.isStorage = true
71
72
  fileMetadata.isContainer = true
72
73
  fileMetadata.isBasicContainer = true
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-server",
3
3
  "description": "Solid server on top of the file-system",
4
- "version": "5.6.16",
4
+ "version": "5.6.17",
5
5
  "author": {
6
6
  "name": "Tim Berners-Lee",
7
7
  "email": "timbl@w3.org"
@@ -45,6 +45,10 @@
45
45
  "name": "Arne Hassel",
46
46
  "email": "arne.hassel@inrupt.com",
47
47
  "url": "https://icanhasweb.net/"
48
+ },
49
+ {
50
+ "name": "Alain Bourgeois",
51
+ "url": "https://github.com/bourgeoa/"
48
52
  }
49
53
  ],
50
54
  "license": "MIT",
@@ -55,21 +59,21 @@
55
59
  "homepage": "https://github.com/solid/node-solid-server",
56
60
  "bugs": "https://github.com/solid/node-solid-server/issues",
57
61
  "dependencies": {
62
+ "@fastify/busboy": "^1.0.0",
58
63
  "@solid/acl-check": "^0.4.5",
59
64
  "@solid/oidc-auth-manager": "^0.24.1",
60
65
  "@solid/oidc-op": "0.11.5",
61
66
  "async-lock": "^1.3.0",
62
- "body-parser": "^1.19.0",
67
+ "body-parser": "^1.19.1",
63
68
  "bootstrap": "^3.4.1",
64
- "busboy": "^0.3.1",
65
69
  "cached-path-relative": "^1.0.2",
66
70
  "camelize": "^1.0.0",
67
71
  "cheerio": "^1.0.0-rc.10",
68
72
  "colorette": "^2.0.16",
69
73
  "commander": "^8.3.0",
70
74
  "cors": "^2.8.5",
71
- "debug": "^4.3.2",
72
- "express": "^4.17.1",
75
+ "debug": "^4.3.3",
76
+ "express": "^4.17.2",
73
77
  "express-handlebars": "^5.3.4",
74
78
  "express-session": "^1.17.2",
75
79
  "extend": "^3.0.2",
@@ -85,15 +89,16 @@
85
89
  "ip-range-check": "0.2.0",
86
90
  "is-ip": "^3.1.0",
87
91
  "li": "^1.3.0",
88
- "mashlib": "^1.7.12",
92
+ "mashlib": "^1.7.14",
89
93
  "mime-types": "^2.1.34",
90
94
  "negotiator": "^0.6.2",
91
95
  "node-fetch": "^2.6.6",
92
96
  "node-forge": "^0.10.0",
93
- "nodemailer": "^6.7.0",
97
+ "node-mailer": "^0.1.1",
98
+ "nodemailer": "^6.7.2",
94
99
  "oidc-op-express": "^0.0.3",
95
100
  "owasp-password-strength-test": "^1.3.0",
96
- "rdflib": "^2.2.10",
101
+ "rdflib": "^2.2.15",
97
102
  "recursive-readdir": "^2.2.2",
98
103
  "request": "^2.88.2",
99
104
  "rimraf": "^3.0.2",
@@ -118,14 +123,14 @@
118
123
  "eslint": "^7.32.0",
119
124
  "localstorage-memory": "1.0.3",
120
125
  "mocha": "9.1.3",
121
- "nock": "13.1.4",
126
+ "nock": "^13.2.1",
122
127
  "node-mocks-http": "1.11.0",
123
128
  "nyc": "15.1.0",
124
129
  "pre-commit": "1.2.2",
125
130
  "randombytes": "2.1.0",
126
131
  "sinon": "12.0.1",
127
132
  "sinon-chai": "3.7.0",
128
- "snyk": "1.752.0",
133
+ "snyk": "^1.809.0",
129
134
  "standard": "16.0.4",
130
135
  "supertest": "6.1.6",
131
136
  "turtle-validator": "1.1.1",
@@ -1,134 +0,0 @@
1
- <div class="row">
2
- <div class="col-md-6">
3
- <div class="panel panel-default">
4
- <div class="panel-body">
5
- <form method="post" action="/api/accounts/new" id="RegisterForm">
6
- {{> shared/error}}
7
-
8
- <div class="form-group">
9
- <label class="control-label" for="username">Username*</label>
10
- <input type="text" class="form-control" name="username" id="username" placeholder="alice"
11
- required value="{{username}}"/>
12
-
13
- {{#if multiuser}}
14
- <p>Your username should be a lower-case word with only
15
- letters a-z and numbers 0-9 and without periods.</p>
16
- <p>Your public Solid POD URL will be:
17
- <tt>https://<span class="editable-username">alice</span>.<script type="text/javascript">
18
- document.write(window.location.host)
19
- </script></tt></p>
20
- <p>Your public Solid WebID will be:
21
- <tt>https://<span class="editable-username">alice</span>.<script type="text/javascript">
22
- document.write(window.location.host)
23
- </script>/profile/card#me</tt></p>
24
-
25
- <p>Your <em>POD URL</em> is like the homepage for your Solid
26
- pod. By default, it is readable by the public, but you can
27
- always change that if you like by changing the access
28
- control.</p>
29
-
30
- <p>Your <em>Solid WebID</em> is your globally unique name
31
- that you can use to identify and authenticate yourself with
32
- other PODs across the world.</p>
33
- {{/if}}
34
-
35
- </div>
36
-
37
- <div class="form-group has-feedback">
38
- <label class="control-label" for="password">Password*</label>
39
- <input type="password" class="form-control control-progress{{#if disablePasswordStrengthCheck}} disable-password-strength-check{{/if}}" name="password" id="password" required/>
40
- <span class="glyphicon glyphicon-remove form-control-feedback hidden" aria-hidden="true"></span>
41
- <div class="progress">
42
- <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="4"></div>
43
- </div>
44
- <div class="help-block"></div>
45
- </div>
46
-
47
-
48
- <div class="form-group has-feedback">
49
- <label class="control-label" for="repeat_password">Repeat password*</label>
50
- <input type="password" class="form-control" name="repeat_password" id="repeat_password" required/>
51
- <span class="glyphicon glyphicon-remove form-control-feedback hidden"></span>
52
- </div>
53
-
54
-
55
- <div class="form-group">
56
- <label class="control-label" for="name">Name*</label>
57
- <input type="text" class="form-control" name="name" id="name" required value="{{name}}"/>
58
- </div>
59
-
60
- <div class="form-group">
61
- <label class="control-label" for="email">Email*</label>
62
- <input type="email" class="form-control" name="email" id="email" value="{{email}}"/>
63
- <span class="help-block">Your email will only be used for account recovery</span>
64
- </div>
65
-
66
- {{#if enforceToc}}
67
- {{#if tocUri}}
68
- <div class="checkbox">
69
- <label>
70
- <input type="checkbox" name="acceptToc" value="true" {{#if acceptToc}}checked{{/if}}>
71
- I agree to the <a href="{{tocUri}}" target="_blank">Terms &amp; Conditions</a> of this service
72
- </label>
73
- </div>
74
- {{/if}}
75
- {{/if}}
76
-
77
-
78
- <button type="submit" class="btn btn-primary" id="register">Register</button>
79
-
80
- <input type="hidden" name="returnToUrl" value="{{returnToUrl}}"/>
81
- {{> auth/auth-hidden-fields}}
82
-
83
- </form>
84
- </div>
85
- </div>
86
- </div>
87
-
88
- <!-- deprecated with inrupt/solid-client-auth
89
- <div class="col-md-6">
90
- <div class="panel panel-default panel-already-registered">
91
- <div class="panel-body">
92
- <h2>Already have an account?</h2>
93
- <p>
94
- <a class="btn btn-lg btn-success" href="{{{loginUrl}}}">
95
- Please Log In
96
- </a>
97
- </p>
98
- </div>
99
- </div>
100
- </div>
101
- --->
102
- </div>
103
-
104
- <script src="/common/js/owasp-password-strength-test.js" defer></script>
105
- <script src="/common/js/text-encoder-lite.min.js" defer></script>
106
- <script src="/common/js/solid.js" defer></script>
107
-
108
- <script>
109
- var username = document.getElementById('username');
110
- username.onkeyup = function() {
111
- var list = document.getElementsByClassName('editable-username');
112
- for (let item of list) {
113
- item.innerHTML = username.value.toLowerCase()
114
- }
115
- }
116
-
117
- window.addEventListener('DOMContentLoaded', function () {
118
- var connect = document.getElementById('ConnectExternalWebId')
119
- var container = document.getElementById('ExternalWebId')
120
- container.classList.toggle('hidden', !connect.checked)
121
- connect.addEventListener('change', function () {
122
- container.classList.toggle('hidden', !connect.checked)
123
- })
124
-
125
- var form = document.getElementById('RegisterForm')
126
- var externalWebIdField = document.getElementById('externalWebId')
127
- form.addEventListener('submit', function () {
128
- if (!connect.checked) {
129
- externalWebIdField.value = ''
130
- }
131
- })
132
- })
133
- </script>
134
-