Skip to content

Commit e4cf1e2

Browse files
committed
Reverting changes to solid-host
Trying to limit the number of changes
1 parent 7b75a0b commit e4cf1e2

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

lib/models/solid-host.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ class SolidHost {
7777
const serverHost = getHostName(this.serverUri)
7878
if (originHost === serverHost) return true
7979
if (originHost.endsWith('.' + serverHost)) return true
80-
return !!trustedOrigins.includes(origin)
80+
// Allow the user's own domain
81+
const userHost = getHostName(userId)
82+
if (originHost === userHost) return true
83+
if (trustedOrigins.includes(origin)) return true
84+
return false
8185
}
8286

8387
/**

test/integration/acl-tls-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ describe('ACL with WebID+TLS', function () {
379379
' <http://www.w3.org/ns/auth/acl#agent> <' + user1 + '>;\n' +
380380
' <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read>, <http://www.w3.org/ns/auth/acl#Write>, <http://www.w3.org/ns/auth/acl#Control> .\n' +
381381
'<#Owner2> a <http://www.w3.org/ns/auth/acl#Authorization>;\n' +
382-
' <http://www.w3.org/ns/auth/acl#accessTo> <https://localhost:3456/test/acl-tls/origin/test-folder/>;\n' +
383-
' <http://www.w3.org/ns/auth/acl#origin> <' + origin1 + '>;\n' +
384-
' <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read>, <http://www.w3.org/ns/auth/acl#Write>, <http://www.w3.org/ns/auth/acl#Control> .\n' +
382+
' <http://www.w3.org/ns/auth/acl#accessTo> <https://localhost:3456/test/acl-tls/origin/test-folder/>;\n' +
383+
' <http://www.w3.org/ns/auth/acl#origin> <' + origin1 + '>;\n' +
384+
' <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read>, <http://www.w3.org/ns/auth/acl#Write>, <http://www.w3.org/ns/auth/acl#Control> .\n' +
385385
'<#Public> a <http://www.w3.org/ns/auth/acl#Authorization>;\n' +
386386
' <http://www.w3.org/ns/auth/acl#accessTo> <./>;\n' +
387387
' <http://www.w3.org/ns/auth/acl#agentClass> <http://www.w3.org/ns/auth/acl#AuthenticatedAgent>;\n' +

test/integration/authentication-oidc-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ describe('Authentication API (OIDC)', () => {
387387
describe('with that cookie and a non-matching origin', () => {
388388
let response
389389
before(done => {
390-
alice.get('/private-for-alice.txt')
390+
alice.get('/private-for-owner.txt')
391391
.set('Cookie', cookie)
392392
.set('Origin', bobServerUri)
393393
.end((err, res) => {

test/unit/solid-host-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ describe('SolidHost', () => {
5858
expect(host.allowsSessionFor('https://user.own/profile/card#me', '', [])).to.be.true
5959
})
6060

61+
it('should allow a userId with the user subdomain as origin', () => {
62+
expect(host.allowsSessionFor('https://user.own/profile/card#me', 'https://user.own', [])).to.be.true
63+
})
64+
6165
it('should allow a userId with the server domain as origin', () => {
6266
expect(host.allowsSessionFor('https://user.own/profile/card#me', 'https://test.local', [])).to.be.true
6367
})

0 commit comments

Comments
 (0)