mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Fix SECURITY ISSUE 3: Unauthenticated (or any) user can update board sort.
Thanks to Siam Thanat Hack (STH) !
This commit is contained in:
parent
0a2e6a0c38
commit
ea310d7508
6 changed files with 119 additions and 23 deletions
50
server/lib/tests/boards.security.tests.js
Normal file
50
server/lib/tests/boards.security.tests.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* eslint-env mocha */
|
||||
import { expect } from 'chai';
|
||||
import { Random } from 'meteor/random';
|
||||
import '../utils';
|
||||
|
||||
// Unit tests for canUpdateBoardSort policy
|
||||
|
||||
describe('boards security', function() {
|
||||
describe(canUpdateBoardSort.name, function() {
|
||||
it('denies anonymous updates even if fieldNames include sort', function() {
|
||||
const userId = null;
|
||||
const board = {
|
||||
hasMember: () => true,
|
||||
};
|
||||
const fieldNames = ['sort'];
|
||||
|
||||
expect(canUpdateBoardSort(userId, board, fieldNames)).to.equal(false);
|
||||
});
|
||||
|
||||
it('denies updates by non-members', function() {
|
||||
const userId = Random.id();
|
||||
const board = {
|
||||
hasMember: (id) => id === 'someone-else',
|
||||
};
|
||||
const fieldNames = ['sort'];
|
||||
|
||||
expect(canUpdateBoardSort(userId, board, fieldNames)).to.equal(false);
|
||||
});
|
||||
|
||||
it('allows updates when user is a member and updating sort', function() {
|
||||
const userId = Random.id();
|
||||
const board = {
|
||||
hasMember: (id) => id === userId,
|
||||
};
|
||||
const fieldNames = ['sort'];
|
||||
|
||||
expect(canUpdateBoardSort(userId, board, fieldNames)).to.equal(true);
|
||||
});
|
||||
|
||||
it('denies updates when not updating sort', function() {
|
||||
const userId = Random.id();
|
||||
const board = {
|
||||
hasMember: (id) => id === userId,
|
||||
};
|
||||
const fieldNames = ['title'];
|
||||
|
||||
expect(canUpdateBoardSort(userId, board, fieldNames)).to.equal(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue