mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
tests: Test access bypass via read-only pad ID
This commit is contained in:
parent
3c71e8983b
commit
f63610bb12
1 changed files with 18 additions and 0 deletions
|
@ -231,6 +231,24 @@ describe(__filename, function () {
|
||||||
const message = await handshake(socket, 'pad');
|
const message = await handshake(socket, 'pad');
|
||||||
assert.equal(message.accessStatus, 'deny');
|
assert.equal(message.accessStatus, 'deny');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('authn anonymous read-only /p/pad -> 401, error', async function () {
|
||||||
|
this.timeout(400);
|
||||||
|
settings.requireAuthentication = true;
|
||||||
|
let res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
|
||||||
|
socket = await connect(res);
|
||||||
|
const clientVars = await handshake(socket, 'pad');
|
||||||
|
assert.equal(clientVars.type, 'CLIENT_VARS');
|
||||||
|
const readOnlyId = clientVars.data.readOnlyId;
|
||||||
|
assert(readOnlyManager.isReadOnlyId(readOnlyId));
|
||||||
|
socket.close();
|
||||||
|
res = await agent.get(`/p/${readOnlyId}`).expect(401);
|
||||||
|
// Despite the 401, try to read the pad via a socket.io connection anyway.
|
||||||
|
socket = await connect(res);
|
||||||
|
const message = await handshake(socket, readOnlyId);
|
||||||
|
assert.equal(message.accessStatus, 'deny');
|
||||||
|
});
|
||||||
|
|
||||||
it('authn !cookie -> error', async function () {
|
it('authn !cookie -> error', async function () {
|
||||||
this.timeout(400);
|
this.timeout(400);
|
||||||
settings.requireAuthentication = true;
|
settings.requireAuthentication = true;
|
||||||
|
|
Loading…
Reference in a new issue