Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append patch new document #1745

Merged
merged 29 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d58fee0
Append allowed for non existing document
bourgeoa Nov 28, 2023
7196543
Append allowed
bourgeoa Nov 28, 2023
f29a258
add test
bourgeoa Nov 30, 2023
594f37a
removed check on resourceExists
bourgeoa Nov 30, 2023
e14e5f0
Update test/integration/acl-oidc-test.js
bourgeoa Nov 30, 2023
173ecb7
Update test/integration/acl-oidc-test.js
bourgeoa Nov 30, 2023
6129eb9
node14 & 16
bourgeoa Nov 30, 2023
c71eb27
Merge branch 'appendPatchNewDocument' of https://github.com/solid/nod…
bourgeoa Nov 30, 2023
44bfd13
update test-suite
bourgeoa Dec 15, 2023
f243c66
Merge branch 'main' into appendPatchNewDocument
bourgeoa Dec 15, 2023
ae9cfd8
node 18 defaults to ipv6
bourgeoa Dec 15, 2023
649901c
Merge branch 'appendPatchNewDocument' of https://github.com/solid/nod…
bourgeoa Dec 15, 2023
b71c107
clean runTests line
bourgeoa Dec 16, 2023
5080f6f
test branch
bourgeoa Dec 16, 2023
dfcf617
nss-skips
bourgeoa Dec 16, 2023
c5ccf90
use test branch
bourgeoa Dec 16, 2023
94bb321
use https
bourgeoa Dec 16, 2023
59b22da
remove ftech branch
bourgeoa Dec 16, 2023
6c5edcd
add git pull
bourgeoa Dec 16, 2023
65ebc1c
git pull https
bourgeoa Dec 16, 2023
c200a01
git stash
bourgeoa Dec 16, 2023
53a6681
git stash
bourgeoa Dec 17, 2023
897f2a1
git stash
bourgeoa Dec 17, 2023
3b5afe1
git stash
bourgeoa Dec 17, 2023
313f0f8
git
bourgeoa Dec 17, 2023
eb4fd60
git
bourgeoa Dec 17, 2023
e76d5ce
git
bourgeoa Dec 17, 2023
a49404d
build git
bourgeoa Dec 17, 2023
b985182
runTestsFromGit
bourgeoa Dec 17, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x]
node-version: [16.x, 18.x]
os: [ubuntu-latest]

steps:
Expand Down
2 changes: 0 additions & 2 deletions lib/handlers/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ async function checkPermission (request, patchObject, resourceExists) {
// Now that we know the details of the patch,
// we might need to perform additional checks.
let modes = []
// acl:default Write is required for create
if (!resourceExists) modes = ['Write']
const { acl, session: { userId } } = request
// Read access is required for DELETE and WHERE.
// If we would allows users without read access,
Expand Down
4,570 changes: 3,424 additions & 1,146 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"ip-range-check": "0.2.0",
"is-ip": "^3.1.0",
"li": "^1.3.0",
"mashlib": "^1.8.8",
"mashlib": "^1.8.9",
"mime-types": "^2.1.35",
"negotiator": "^0.6.3",
"node-fetch": "^2.6.9",
Expand Down
13 changes: 12 additions & 1 deletion test/integration/acl-oidc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
done()
})
})
it.skip('user1 should be able to PATCH a resource', function (done) {
it('user1 should be able to PATCH (which CREATEs) a nonexistent resource', function (done) {
const options = createOptions('/append-inherited/test.ttl', 'user1')
options.body = 'INSERT DATA { :test :hello 456 .}'
options.headers['content-type'] = 'application/sparql-update'
Expand Down Expand Up @@ -589,6 +589,16 @@ describe('ACL with WebID+OIDC over HTTP', function () {
done()
})
})
it('user2 should be able to PATCH INSERT to (which CREATEs) a nonexistent resource', function (done) {
const options = createOptions('/append-inherited/new.ttl', 'user2')
options.body = 'INSERT DATA { :test :hello 789 .}'
options.headers['content-type'] = 'application/sparql-update'
request.patch(options, function (error, response, body) {
assert.equal(error, null)
assert.equal(response.statusCode, 200)
done()
})
})
it('user2 should not be able to access test file\'s ACL file', function (done) {
const options = createOptions('/append-acl/abc.ttl.acl', 'user2', 'text/turtle')
request.head(options, function (error, response, body) {
Expand Down Expand Up @@ -648,6 +658,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
})
after(function () {
rm('/accounts-acl/tim.localhost/append-inherited/test.ttl')
rm('/accounts-acl/tim.localhost/append-inherited/new.ttl')
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@

acl:default <./>.

<#AppendOnly>
a <http://www.w3.org/ns/auth/acl#Authorization>;
<http://www.w3.org/ns/auth/acl#accessTo> <./>;
acl:default <./>;
<http://www.w3.org/ns/auth/acl#agentClass> <http://xmlns.com/foaf/0.1/Agent>;
<http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read>, <http://www.w3.org/ns/auth/acl#Append> .
14 changes: 13 additions & 1 deletion test/surface/run-solid-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,26 @@ function runTests {
--env-file test/surface/$1-env.list solidtestsuite/$1:$2
}

function runTestsFromGit {
docker build https://github.com/solid-contrib/$1.git#$2 -t $1

echo "Running web-access-control-tests against server with cookie $COOKIE_server"
docker run --rm --network=testnet \
--env COOKIE="$COOKIE_server" \
--env COOKIE_ALICE="$COOKIE_server" \
--env COOKIE_BOB="$COOKIE_thirdparty" \
--env-file test/surface/$1-env.list $1
}

# ...
teardown || true
setup $1
waitForNss server
runTests webid-provider-tests v2.0.3
runTests solid-crud-tests v6.0.0
waitForNss thirdparty
runTests web-access-control-tests v7.1.0
# runTests web-access-control-tests v7.1.0
runTestsFromGit web-access-control-tests patchAppendNewDocument
teardown

# To debug, e.g. running web-access-control-tests jest interactively,
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports.checkDnsSettings = function () {
return Promise.all(TEST_HOSTS.map(hostname => {
return new Promise((resolve, reject) => {
dns.lookup(hostname, (error, ip) => {
if (error || ip !== '127.0.0.1') {
if (error || (ip !== '127.0.0.1' && ip !== '::1')) {
reject(error)
} else {
resolve(true)
Expand Down
Loading