solid-server 5.8.8-cf5c6504 → 5.8.8-f929ff9d
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.
- package/common/js/auth-buttons.mjs +20 -20
- package/common/js/index-buttons.mjs +30 -30
- package/common/js/solid.mjs +11 -11
- package/config/defaults.mjs +1 -1
- package/coverage/tmp/coverage-2418-1767431307717-0.json +1 -0
- package/coverage/tmp/{coverage-2263-1766863823325-0.json → coverage-2419-1767431285701-0.json} +1 -1
- package/eslint.config.mjs +102 -0
- package/index.mjs +8 -8
- package/lib/acl-checker.mjs +0 -1
- package/lib/create-server.mjs +2 -2
- package/lib/handlers/copy.mjs +0 -2
- package/lib/handlers/cors-proxy.mjs +0 -2
- package/lib/handlers/get.mjs +15 -11
- package/lib/handlers/index.mjs +0 -2
- package/lib/handlers/options.mjs +0 -2
- package/lib/ldp.mjs +0 -2
- package/lib/models/account-manager.mjs +1 -1
- package/lib/models/oidc-manager.mjs +0 -1
- package/lib/resource-mapper.mjs +1 -3
- package/lib/utils.mjs +0 -2
- package/package.json +20 -18
- package/solid-server-5.8.8.tgz +0 -0
- package/test/integration/account-manager-test.mjs +2 -3
- package/test/integration/account-template-test.mjs +0 -1
- package/test/integration/acl-oidc-test.mjs +1 -1
- package/test/integration/authentication-oidc-test.mjs +3 -2
- package/test/integration/capability-discovery-test.mjs +0 -1
- package/test/integration/http-copy-test.mjs +2 -2
- package/test/integration/oidc-manager-test.mjs +95 -2
- package/test/integration/params-test.mjs +5 -5
- package/test/integration/quota-test.mjs +0 -1
- package/test/integration/www-account-creation-oidc-test.mjs +0 -1
- package/test/resources/accounts/db/oidc/op/clients/{_key_3f892a91ab2dac850570901929cc6a9c.json → _key_6f9636fdb5324b61b8ab50b4635a34a4.json} +1 -1
- package/test/resources/accounts/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A3457.json +1 -1
- package/test/resources/accounts-scenario/alice/db/oidc/op/clients/{_key_efaffd7535dd61bd581fbfe33713dfa9.json → _key_95aaf9d161680b0f090bb5a9a2cb33f0.json} +1 -1
- package/test/resources/accounts-scenario/alice/db/oidc/op/provider.json +538 -313
- package/test/resources/accounts-scenario/alice/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7000.json +1 -1
- package/test/resources/accounts-scenario/bob/db/oidc/op/clients/{_key_58c33ea4afe682387a8e2665092a8ba8.json → _key_81c70163ad6fd9787b53820b976d3097.json} +1 -1
- package/test/resources/accounts-scenario/bob/db/oidc/op/provider.json +538 -313
- package/test/resources/accounts-scenario/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7001.json +1 -1
- package/test/resources/accounts-scenario/charlie/db/oidc/op/clients/{_key_88014cc2f59908a10060f0916456aac6.json → _key_a519289bb1923e8be0443df427aa9180.json} +1 -1
- package/test/resources/accounts-scenario/charlie/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A5002.json +1 -1
- package/test/resources/accounts-strict-origin-off/alice/db/oidc/op/clients/{_key_f8e11854cb1e266a1587f32d263321b6.json → _key_ed5f17781defd41045ce9abd9fbbdc2f.json} +1 -1
- package/test/resources/accounts-strict-origin-off/alice/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7010.json +1 -1
- package/test/resources/accounts-strict-origin-off/bob/db/oidc/op/clients/{_key_315f6739a055308310c995d740690dd3.json → _key_ba9ed16c43ca78441f0ad76fc118bfaf.json} +1 -1
- package/test/resources/accounts-strict-origin-off/bob/db/oidc/rp/clients/_key_https%3A%2F%2Flocalhost%3A7011.json +1 -1
- package/test/unit/account-template-test.mjs +0 -1
- package/test/unit/add-cert-request-test.mjs +0 -1
- package/test/unit/create-account-request-test.mjs +1 -1
- package/test/unit/email-service-test.mjs +0 -1
- package/test/unit/email-welcome-test.mjs +0 -1
- package/test/unit/esm-imports.test.mjs +0 -1
- package/test/unit/oidc-manager-test.mjs +0 -1
- package/test/unit/solid-host-test.mjs +0 -1
- package/test/unit/user-account-test.mjs +0 -1
- package/test/utils.mjs +3 -3
- package/coverage/tmp/coverage-2262-1766863845657-0.json +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
{
|
|
7
|
+
languageOptions: {
|
|
8
|
+
ecmaVersion: 2022,
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
globals: {
|
|
11
|
+
...globals.node,
|
|
12
|
+
...globals.mocha,
|
|
13
|
+
fetch: 'readonly',
|
|
14
|
+
AbortController: 'readonly',
|
|
15
|
+
Headers: 'readonly',
|
|
16
|
+
Request: 'readonly',
|
|
17
|
+
Response: 'readonly',
|
|
18
|
+
URL: 'readonly',
|
|
19
|
+
URLSearchParams: 'readonly'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
// StandardJS-like rules
|
|
24
|
+
'no-unused-vars': ['warn', {
|
|
25
|
+
args: 'none',
|
|
26
|
+
caughtErrors: 'none',
|
|
27
|
+
ignoreRestSiblings: true,
|
|
28
|
+
vars: 'all'
|
|
29
|
+
}],
|
|
30
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
31
|
+
'no-var': 'error',
|
|
32
|
+
'prefer-const': ['error', { destructuring: 'all' }],
|
|
33
|
+
'quote-props': ['error', 'as-needed'],
|
|
34
|
+
semi: ['error', 'never'],
|
|
35
|
+
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
|
36
|
+
'comma-dangle': ['error', 'never'],
|
|
37
|
+
'space-before-function-paren': ['error', 'always'],
|
|
38
|
+
indent: ['error', 2, {
|
|
39
|
+
SwitchCase: 1,
|
|
40
|
+
VariableDeclarator: 1,
|
|
41
|
+
outerIIFEBody: 1,
|
|
42
|
+
MemberExpression: 1,
|
|
43
|
+
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
44
|
+
FunctionExpression: { parameters: 1, body: 1 },
|
|
45
|
+
CallExpression: { arguments: 1 },
|
|
46
|
+
ArrayExpression: 1,
|
|
47
|
+
ObjectExpression: 1,
|
|
48
|
+
ImportDeclaration: 1,
|
|
49
|
+
flatTernaryExpressions: false,
|
|
50
|
+
ignoreComments: false,
|
|
51
|
+
ignoredNodes: ['TemplateLiteral *', 'JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
|
|
52
|
+
offsetTernaryExpressions: true
|
|
53
|
+
}],
|
|
54
|
+
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
55
|
+
'keyword-spacing': ['error', { before: true, after: true }],
|
|
56
|
+
'object-curly-spacing': ['error', 'always'],
|
|
57
|
+
'array-bracket-spacing': ['error', 'never'],
|
|
58
|
+
'space-in-parens': ['error', 'never'],
|
|
59
|
+
'space-before-blocks': ['error', 'always'],
|
|
60
|
+
'space-infix-ops': 'error',
|
|
61
|
+
'eol-last': 'error',
|
|
62
|
+
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
63
|
+
'no-trailing-spaces': 'error',
|
|
64
|
+
'comma-spacing': ['error', { before: false, after: true }],
|
|
65
|
+
'no-multi-spaces': 'error',
|
|
66
|
+
'no-mixed-operators': ['error', {
|
|
67
|
+
groups: [
|
|
68
|
+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
|
|
69
|
+
['&&', '||'],
|
|
70
|
+
['in', 'instanceof']
|
|
71
|
+
],
|
|
72
|
+
allowSamePrecedence: true
|
|
73
|
+
}],
|
|
74
|
+
'operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before', '|>': 'before' } }],
|
|
75
|
+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
76
|
+
'arrow-spacing': ['error', { before: true, after: true }],
|
|
77
|
+
'padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
|
|
78
|
+
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
// Browser files (client-side code)
|
|
83
|
+
files: ['common/**/*.mjs'],
|
|
84
|
+
languageOptions: {
|
|
85
|
+
globals: {
|
|
86
|
+
...globals.browser,
|
|
87
|
+
solid: 'readonly',
|
|
88
|
+
UI: 'readonly',
|
|
89
|
+
owaspPasswordStrengthTest: 'readonly'
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
ignores: [
|
|
95
|
+
'node_modules/**',
|
|
96
|
+
'coverage/**',
|
|
97
|
+
'.db/**',
|
|
98
|
+
'data/**',
|
|
99
|
+
'resources/**'
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
]
|
package/index.mjs
CHANGED
|
@@ -8,15 +8,15 @@ import startCli from './bin/lib/cli.mjs'
|
|
|
8
8
|
let exported
|
|
9
9
|
const canAttach = (ldnode && (typeof ldnode === 'object' || typeof ldnode === 'function'))
|
|
10
10
|
if (canAttach) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
try {
|
|
12
|
+
if (!ldnode.createServer) ldnode.createServer = createServer
|
|
13
|
+
if (!ldnode.startCli) ldnode.startCli = startCli
|
|
14
|
+
exported = ldnode
|
|
15
|
+
} catch (e) {
|
|
16
|
+
exported = { default: ldnode, createServer, startCli }
|
|
17
|
+
}
|
|
18
18
|
} else {
|
|
19
|
-
|
|
19
|
+
exported = { default: ldnode, createServer, startCli }
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export default exported
|
package/lib/acl-checker.mjs
CHANGED
package/lib/create-server.mjs
CHANGED
package/lib/handlers/copy.mjs
CHANGED
package/lib/handlers/get.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { createRequire } from 'module'
|
|
4
4
|
import fs from 'fs'
|
|
5
|
-
import glob from 'glob'
|
|
5
|
+
import { glob, hasMagic } from 'glob'
|
|
6
6
|
import _path from 'path'
|
|
7
7
|
import $rdf from 'rdflib'
|
|
8
8
|
import Negotiator from 'negotiator'
|
|
@@ -37,7 +37,7 @@ export default async function handler (req, res, next) {
|
|
|
37
37
|
|
|
38
38
|
res.header('Accept-Patch', 'text/n3, application/sparql-update, application/sparql-update-single-match')
|
|
39
39
|
res.header('Accept-Post', '*/*')
|
|
40
|
-
if (!path.endsWith('/') && !
|
|
40
|
+
if (!path.endsWith('/') && !hasMagic(path)) res.header('Accept-Put', '*/*')
|
|
41
41
|
|
|
42
42
|
// Set live updates
|
|
43
43
|
if (ldp.live) {
|
|
@@ -48,9 +48,9 @@ export default async function handler (req, res, next) {
|
|
|
48
48
|
|
|
49
49
|
const options = {
|
|
50
50
|
hostname: req.hostname,
|
|
51
|
-
path,
|
|
52
|
-
includeBody,
|
|
53
|
-
possibleRDFType,
|
|
51
|
+
path: path,
|
|
52
|
+
includeBody: includeBody,
|
|
53
|
+
possibleRDFType: possibleRDFType,
|
|
54
54
|
range: req.headers.range,
|
|
55
55
|
contentType: req.headers.accept
|
|
56
56
|
}
|
|
@@ -62,7 +62,7 @@ export default async function handler (req, res, next) {
|
|
|
62
62
|
// set Accept-Put if container do not exist
|
|
63
63
|
if (err.status === 404 && path.endsWith('/')) res.header('Accept-Put', 'text/turtle')
|
|
64
64
|
// use globHandler if magic is detected
|
|
65
|
-
if (err.status === 404 &&
|
|
65
|
+
if (err.status === 404 && hasMagic(path)) {
|
|
66
66
|
debug('forwarding to glob request')
|
|
67
67
|
return globHandler(req, res, next)
|
|
68
68
|
} else {
|
|
@@ -188,8 +188,9 @@ async function globHandler (req, res, next) {
|
|
|
188
188
|
nodir: true
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
try {
|
|
192
|
+
const matches = await glob(`${folderPath}*`, globOptions)
|
|
193
|
+
if (matches.length === 0) {
|
|
193
194
|
debugGlob('No files matching the pattern')
|
|
194
195
|
return next(HTTPError(404, 'No files matching glob pattern'))
|
|
195
196
|
}
|
|
@@ -230,7 +231,10 @@ async function globHandler (req, res, next) {
|
|
|
230
231
|
|
|
231
232
|
res.send(data)
|
|
232
233
|
next()
|
|
233
|
-
})
|
|
234
|
+
} catch (err) {
|
|
235
|
+
debugGlob('Error during glob: ' + err)
|
|
236
|
+
return next(HTTPError(500, 'Error processing glob pattern'))
|
|
237
|
+
}
|
|
234
238
|
}
|
|
235
239
|
|
|
236
240
|
// TODO: get rid of this ugly hack that uses the Allow handler to check read permissions
|
|
@@ -240,7 +244,7 @@ function hasReadPermissions (file, req, res, callback) {
|
|
|
240
244
|
if (!ldp.webid) {
|
|
241
245
|
// FIXME: what is the rule that causes
|
|
242
246
|
// "Unexpected literal in error position of callback" in `npm run standard`?
|
|
243
|
-
|
|
247
|
+
|
|
244
248
|
return callback(true)
|
|
245
249
|
}
|
|
246
250
|
|
|
@@ -249,6 +253,6 @@ function hasReadPermissions (file, req, res, callback) {
|
|
|
249
253
|
res.locals.path = relativePath
|
|
250
254
|
// FIXME: what is the rule that causes
|
|
251
255
|
// "Unexpected literal in error position of callback" in `npm run standard`?
|
|
252
|
-
|
|
256
|
+
|
|
253
257
|
allow('Read')(req, res, err => callback(!err))
|
|
254
258
|
}
|
package/lib/handlers/index.mjs
CHANGED
package/lib/handlers/options.mjs
CHANGED
package/lib/ldp.mjs
CHANGED
package/lib/resource-mapper.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable n/no-deprecated-api, no-mixed-operators */
|
|
2
|
-
|
|
3
1
|
import fs from 'fs'
|
|
4
2
|
import URL from 'url'
|
|
5
3
|
import { promisify } from 'util'
|
|
@@ -196,7 +194,7 @@ class ResourceMapper {
|
|
|
196
194
|
_getContentTypeFromExtension (path) {
|
|
197
195
|
const defaultContentType = (path === '' || path.endsWith('/')) ? this._defaultContainerContentType : this._defaultContentType
|
|
198
196
|
const extension = /\.([^/.]+)$/.exec(path)
|
|
199
|
-
return extension && this._types[extension[1].toLowerCase()] || defaultContentType
|
|
197
|
+
return (extension && this._types[extension[1].toLowerCase()]) || defaultContentType
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
// Appends an extension for the specific content type, if needed
|
package/lib/utils.mjs
CHANGED
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.8.8-
|
|
4
|
+
"version": "5.8.8-f929ff9d",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Tim Berners-Lee",
|
|
7
7
|
"email": "timbl@w3.org"
|
|
@@ -59,12 +59,13 @@
|
|
|
59
59
|
"homepage": "https://github.com/solid/node-solid-server",
|
|
60
60
|
"bugs": "https://github.com/solid/node-solid-server/issues",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@fastify/busboy": "^
|
|
62
|
+
"@fastify/busboy": "^3.2.0",
|
|
63
63
|
"@fastify/pre-commit": "^2.2.1",
|
|
64
64
|
"@solid/acl-check": "^0.4.5",
|
|
65
|
-
"@solid/oidc-auth-manager": "^0.25.
|
|
66
|
-
"@solid/oidc-op": "^0.12.
|
|
67
|
-
"@solid/oidc-rp": "^0.12.
|
|
65
|
+
"@solid/oidc-auth-manager": "^0.25.2",
|
|
66
|
+
"@solid/oidc-op": "^0.12.1",
|
|
67
|
+
"@solid/oidc-rp": "^0.12.1",
|
|
68
|
+
"@solid/solid-multi-rp-client": "^0.7.2",
|
|
68
69
|
"async-lock": "^1.4.1",
|
|
69
70
|
"body-parser": "^1.20.4",
|
|
70
71
|
"bootstrap": "^3.4.1",
|
|
@@ -72,9 +73,10 @@
|
|
|
72
73
|
"camelize": "^1.0.1",
|
|
73
74
|
"cheerio": "^1.1.2",
|
|
74
75
|
"colorette": "^2.0.20",
|
|
75
|
-
"commander": "^
|
|
76
|
+
"commander": "^14.0.2",
|
|
76
77
|
"cors": "^2.8.5",
|
|
77
78
|
"debug": "^4.4.3",
|
|
79
|
+
"eslint": "^9.39.2",
|
|
78
80
|
"express": "^4.22.1",
|
|
79
81
|
"express-accept-events": "^0.3.0",
|
|
80
82
|
"express-handlebars": "^5.3.5",
|
|
@@ -83,18 +85,18 @@
|
|
|
83
85
|
"express-session": "^1.18.2",
|
|
84
86
|
"extend": "^3.0.2",
|
|
85
87
|
"from2": "^2.3.0",
|
|
86
|
-
"fs-extra": "^
|
|
88
|
+
"fs-extra": "^11.3.3",
|
|
87
89
|
"get-folder-size": "^2.0.1",
|
|
88
|
-
"glob": "^
|
|
90
|
+
"glob": "^13.0.0",
|
|
89
91
|
"global-tunnel-ng": "^2.7.1",
|
|
90
92
|
"handlebars": "^4.7.8",
|
|
91
93
|
"http-proxy-middleware": "^2.0.9",
|
|
92
94
|
"inquirer": "^8.2.7",
|
|
93
|
-
"into-stream": "^
|
|
95
|
+
"into-stream": "^9.0.0",
|
|
94
96
|
"ip-range-check": "0.2.0",
|
|
95
97
|
"is-ip": "^5.0.1",
|
|
96
98
|
"li": "^1.3.0",
|
|
97
|
-
"mashlib": "^
|
|
99
|
+
"mashlib": "^2.0.0",
|
|
98
100
|
"mime-types": "^3.0.2",
|
|
99
101
|
"negotiator": "^1.0.0",
|
|
100
102
|
"node-forge": "^1.3.3",
|
|
@@ -119,13 +121,14 @@
|
|
|
119
121
|
},
|
|
120
122
|
"devDependencies": {
|
|
121
123
|
"@cxres/structured-headers": "^2.0.0-nesting.0",
|
|
122
|
-
"@
|
|
124
|
+
"@eslint/js": "^9.39.2",
|
|
125
|
+
"@solid/solid-auth-oidc": "^0.6.1",
|
|
123
126
|
"c8": "^10.1.3",
|
|
124
127
|
"chai": "^4.5.0",
|
|
125
128
|
"chai-as-promised": "7.1.2",
|
|
126
|
-
"cross-env": "
|
|
129
|
+
"cross-env": "^10.1.0",
|
|
127
130
|
"dirty-chai": "2.0.1",
|
|
128
|
-
"
|
|
131
|
+
"globals": "^17.0.0",
|
|
129
132
|
"localstorage-memory": "1.0.3",
|
|
130
133
|
"mocha": "^11.7.5",
|
|
131
134
|
"nock": "^13.5.6",
|
|
@@ -135,13 +138,12 @@
|
|
|
135
138
|
"sinon": "12.0.1",
|
|
136
139
|
"sinon-chai": "3.7.0",
|
|
137
140
|
"snyk": "^1.1301.2",
|
|
138
|
-
"standard": "^17.1.2",
|
|
139
141
|
"supertest": "^7.1.4",
|
|
140
142
|
"turtle-validator": "1.1.1",
|
|
141
143
|
"whatwg-url": "^15.1.0"
|
|
142
144
|
},
|
|
143
145
|
"pre-commit": [
|
|
144
|
-
"
|
|
146
|
+
"lint"
|
|
145
147
|
],
|
|
146
148
|
"main": "index.mjs",
|
|
147
149
|
"exports": {
|
|
@@ -153,8 +155,8 @@
|
|
|
153
155
|
"scripts": {
|
|
154
156
|
"build": "echo nothing to build",
|
|
155
157
|
"solid": "node ./bin/solid",
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
+
"lint": "eslint \"**/*.mjs\"",
|
|
159
|
+
"lint-fix": "eslint --fix \"**/*.mjs\"",
|
|
158
160
|
"validate": "node ./test/validate-turtle.mjs",
|
|
159
161
|
"c8": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 c8 --reporter=text-summary mocha --recursive test/unit/ test/integration/",
|
|
160
162
|
"mocha": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/unit/ test/integration/",
|
|
@@ -168,7 +170,7 @@
|
|
|
168
170
|
"mocha-ldp": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/integration/ldp-test.mjs",
|
|
169
171
|
"ignore:prepublishOnly": "npm test",
|
|
170
172
|
"ignore:postpublish": "git push --follow-tags",
|
|
171
|
-
"test": "npm run
|
|
173
|
+
"test": "npm run lint && npm run validate && npm run c8",
|
|
172
174
|
"test-unit": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha test/unit/**/*.mjs --timeout 10000",
|
|
173
175
|
"test-integration": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha test/integration/**/*.mjs --timeout 15000",
|
|
174
176
|
"test-performance": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha test/performance/**/*.mjs --timeout 10000",
|
package/solid-server-5.8.8.tgz
CHANGED
|
Binary file
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-unused-expressions */
|
|
2
1
|
import path from 'path'
|
|
3
2
|
import { fileURLToPath } from 'url'
|
|
4
3
|
import fs from 'fs-extra'
|
|
@@ -52,7 +51,7 @@ describe('AccountManager', () => {
|
|
|
52
51
|
// Note: test/resources/accounts/tim.localhost/ exists in this repo
|
|
53
52
|
return accountManager.accountExists('tim')
|
|
54
53
|
.then(exists => {
|
|
55
|
-
console.log('DEBUG tim exists:', exists, typeof exists)
|
|
54
|
+
// console.log('DEBUG tim exists:', exists, typeof exists)
|
|
56
55
|
expect(exists).to.not.be.false
|
|
57
56
|
})
|
|
58
57
|
})
|
|
@@ -61,7 +60,7 @@ describe('AccountManager', () => {
|
|
|
61
60
|
// Note: test/resources/accounts/alice.localhost/ does NOT exist
|
|
62
61
|
return accountManager.accountExists('alice')
|
|
63
62
|
.then(exists => {
|
|
64
|
-
console.log('DEBUG alice exists:', exists, typeof exists)
|
|
63
|
+
// console.log('DEBUG alice exists:', exists, typeof exists)
|
|
65
64
|
expect(exists).to.not.be.false
|
|
66
65
|
})
|
|
67
66
|
})
|
|
@@ -25,7 +25,7 @@ const __dirname = path.dirname(__filename)
|
|
|
25
25
|
|
|
26
26
|
// FIXME #1502
|
|
27
27
|
describe('Authentication API (OIDC)', () => {
|
|
28
|
-
let alice, bob
|
|
28
|
+
let alice, bob
|
|
29
29
|
|
|
30
30
|
const aliceServerUri = 'https://localhost:7000'
|
|
31
31
|
const aliceWebId = 'https://localhost:7000/profile/card#me'
|
|
@@ -690,7 +690,6 @@ describe('Authentication API (OIDC)', () => {
|
|
|
690
690
|
// Native fetch: get first set-cookie header
|
|
691
691
|
const setCookieHeaders = res.headers.getSetCookie ? res.headers.getSetCookie() : [res.headers.get('set-cookie')]
|
|
692
692
|
cookie = setCookieHeaders[0]
|
|
693
|
-
|
|
694
693
|
// Successful login gets redirected back to /authorize and then
|
|
695
694
|
// back to app
|
|
696
695
|
expect(postLoginUri.startsWith(aliceServerUri + '/sharing'))
|
|
@@ -716,6 +715,7 @@ describe('Authentication API (OIDC)', () => {
|
|
|
716
715
|
expect(res.status).to.equal(302)
|
|
717
716
|
const location = res.headers.get('location')
|
|
718
717
|
postSharingUri = new URL(location, aliceServerUri).toString()
|
|
718
|
+
|
|
719
719
|
// cookie = res.headers.get('set-cookie')
|
|
720
720
|
|
|
721
721
|
// Successful login gets redirected back to /authorize and then
|
|
@@ -729,6 +729,7 @@ describe('Authentication API (OIDC)', () => {
|
|
|
729
729
|
expect(res.status).to.equal(302)
|
|
730
730
|
const location = res.headers.get('location')
|
|
731
731
|
callbackUri = location.startsWith('http') ? location : new URL(location, aliceServerUri).toString()
|
|
732
|
+
|
|
732
733
|
expect(callbackUri.startsWith('https://app.example.com#'))
|
|
733
734
|
})
|
|
734
735
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* eslint-disable no-unused-expressions */
|
|
2
1
|
import { fileURLToPath } from 'url'
|
|
3
2
|
import path from 'path'
|
|
3
|
+
import { URL } from 'url'
|
|
4
4
|
import chai from 'chai'
|
|
5
5
|
import fs from 'fs-extra'
|
|
6
6
|
import { fromServerConfig } from '../../lib/models/oidc-manager.mjs'
|
|
@@ -38,5 +38,98 @@ describe('OidcManager', () => {
|
|
|
38
38
|
expect(oidc.users.backend.path.endsWith('db/oidc/users'))
|
|
39
39
|
expect(oidc.users.saltRounds).to.equal(saltRounds)
|
|
40
40
|
})
|
|
41
|
+
|
|
42
|
+
it('should set the provider issuer which is used for iss claim in tokens', () => {
|
|
43
|
+
const providerUri = 'https://pivot-test.solidproject.org:8443'
|
|
44
|
+
const host = SolidHost.from({ serverUri: providerUri })
|
|
45
|
+
|
|
46
|
+
const saltRounds = 5
|
|
47
|
+
const argv = {
|
|
48
|
+
host,
|
|
49
|
+
dbPath,
|
|
50
|
+
saltRounds
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const oidc = fromServerConfig(argv)
|
|
54
|
+
|
|
55
|
+
// Verify the issuer is set correctly for RFC 9207 compliance
|
|
56
|
+
// The iss claim in tokens should match this issuer value
|
|
57
|
+
expect(oidc.provider.issuer).to.exist
|
|
58
|
+
expect(oidc.provider.issuer).to.not.be.null
|
|
59
|
+
expect(oidc.provider.issuer).to.equal(providerUri)
|
|
60
|
+
console.log('Provider issuer (used for iss claim):', oidc.provider.issuer)
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
describe('RFC 9207 - Authorization redirect with iss parameter', () => {
|
|
65
|
+
it('should include iss parameter when redirecting after authorization', async () => {
|
|
66
|
+
const providerUri = 'https://localhost:8443'
|
|
67
|
+
const host = SolidHost.from({ providerUri })
|
|
68
|
+
|
|
69
|
+
const argv = {
|
|
70
|
+
host,
|
|
71
|
+
dbPath,
|
|
72
|
+
saltRounds: 5
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const oidc = fromServerConfig(argv)
|
|
76
|
+
|
|
77
|
+
// Dynamically import BaseRequest from oidc-op
|
|
78
|
+
const { default: BaseRequest } = await import('@solid/oidc-op/src/handlers/BaseRequest.js')
|
|
79
|
+
|
|
80
|
+
// Create a mock request/response to test the redirect behavior
|
|
81
|
+
const mockReq = {
|
|
82
|
+
method: 'GET',
|
|
83
|
+
query: {
|
|
84
|
+
response_type: 'code',
|
|
85
|
+
redirect_uri: 'https://app.example.com/callback',
|
|
86
|
+
client_id: 'https://app.example.com',
|
|
87
|
+
state: 'test-state'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const mockRes = {
|
|
92
|
+
redirectCalled: false,
|
|
93
|
+
redirectUrl: '',
|
|
94
|
+
redirect (url) {
|
|
95
|
+
this.redirectCalled = true
|
|
96
|
+
this.redirectUrl = url
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const request = new BaseRequest(mockReq, mockRes, oidc.provider)
|
|
101
|
+
request.params = mockReq.query
|
|
102
|
+
|
|
103
|
+
// Simulate a successful authorization by calling redirect with auth data
|
|
104
|
+
try {
|
|
105
|
+
request.redirect({ code: 'test-auth-code' })
|
|
106
|
+
} catch (err) {
|
|
107
|
+
// The redirect throws a HandledError, which is expected behavior
|
|
108
|
+
// We just need to check that the redirect was called with the right URL
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
expect(mockRes.redirectCalled).to.be.true
|
|
112
|
+
expect(mockRes.redirectUrl).to.exist
|
|
113
|
+
|
|
114
|
+
// Parse the redirect URL to check for iss parameter
|
|
115
|
+
const redirectUrl = new URL(mockRes.redirectUrl)
|
|
116
|
+
|
|
117
|
+
// The iss parameter can be in either the query string or hash fragment
|
|
118
|
+
// depending on the response_mode (query or fragment)
|
|
119
|
+
let issParam = redirectUrl.searchParams.get('iss')
|
|
120
|
+
if (!issParam && redirectUrl.hash) {
|
|
121
|
+
// Check in the hash fragment
|
|
122
|
+
const hashParams = new URLSearchParams(redirectUrl.hash.substring(1))
|
|
123
|
+
issParam = hashParams.get('iss')
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
console.log('Redirect URL:', mockRes.redirectUrl)
|
|
127
|
+
console.log('RFC 9207 - iss parameter in redirect:', issParam)
|
|
128
|
+
|
|
129
|
+
// RFC 9207: The iss parameter MUST be present and match the provider issuer
|
|
130
|
+
expect(issParam, 'RFC 9207: iss parameter must be present in authorization response').to.exist
|
|
131
|
+
expect(issParam).to.not.be.null
|
|
132
|
+
expect(issParam).to.equal(providerUri)
|
|
133
|
+
})
|
|
41
134
|
})
|
|
42
|
-
})
|
|
135
|
+
})
|
|
@@ -11,7 +11,7 @@ import ldnode, { createServer } from '../../index.mjs'
|
|
|
11
11
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url)
|
|
13
13
|
const __dirname = path.dirname(__filename)
|
|
14
|
-
console.log(getTestRoot())
|
|
14
|
+
// console.log(getTestRoot())
|
|
15
15
|
|
|
16
16
|
describe('LDNODE params', function () {
|
|
17
17
|
describe('suffixMeta', function () {
|
|
@@ -46,7 +46,7 @@ describe('LDNODE params', function () {
|
|
|
46
46
|
|
|
47
47
|
it('should fallback on current working directory', function () {
|
|
48
48
|
assert.equal(path.normalize(ldp.locals.ldp.resourceMapper._rootPath), path.normalize(process.cwd()))
|
|
49
|
-
console.log('Root path is', ldp.locals.ldp.resourceMapper._rootPath)
|
|
49
|
+
// console.log('Root path is', ldp.locals.ldp.resourceMapper._rootPath)
|
|
50
50
|
})
|
|
51
51
|
|
|
52
52
|
it('new : should find resource in correct path', function (done) {
|
|
@@ -57,7 +57,7 @@ describe('LDNODE params', function () {
|
|
|
57
57
|
const fileContent = '<#current> <#temp> 123 .'
|
|
58
58
|
fs.mkdirSync(dirPath, { recursive: true })
|
|
59
59
|
fs.writeFileSync(filePath, fileContent)
|
|
60
|
-
console.log('Wrote file to', filePath)
|
|
60
|
+
// console.log('Wrote file to', filePath)
|
|
61
61
|
server.get('/sampleContainer/example.ttl')
|
|
62
62
|
.expect('Link', /http:\/\/www.w3.org\/ns\/ldp#Resource/)
|
|
63
63
|
.expect(200)
|
|
@@ -71,7 +71,7 @@ describe('LDNODE params', function () {
|
|
|
71
71
|
it.skip('initial : should find resource in correct path', function (done) {
|
|
72
72
|
// Write to the default resources directory, matching the server's root
|
|
73
73
|
const resourcePath = path.join('sampleContainer', 'example.ttl')
|
|
74
|
-
console.log('initial : Writing test resource to', resourcePath)
|
|
74
|
+
// console.log('initial : Writing test resource to', resourcePath)
|
|
75
75
|
setTestRoot(path.join(__dirname, '../resources/'))
|
|
76
76
|
write('<#current> <#temp> 123 .', resourcePath)
|
|
77
77
|
|
|
@@ -102,7 +102,7 @@ describe('LDNODE params', function () {
|
|
|
102
102
|
const fileContent = '<#current> <#temp> 123 .'
|
|
103
103
|
fs.mkdirSync(dirPath, { recursive: true })
|
|
104
104
|
fs.writeFileSync(filePath, fileContent)
|
|
105
|
-
console.log('Wrote file to', filePath)
|
|
105
|
+
// console.log('Wrote file to', filePath)
|
|
106
106
|
|
|
107
107
|
server.get('/sampleContainer/example.ttl')
|
|
108
108
|
.expect('Link', /http:\/\/www.w3.org\/ns\/ldp#Resource/)
|