mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
meteor update --release 3.6-rc.1 failed with "No version of shell-server satisfies all constraints" (and the same for dynamic-import, allow-deny, ddp-server, facebook-oauth and google-oauth): those six are WeKan's forks in packages/, made because Meteor 3.6-rc.0 lacked the 3.5.3 security fixes, and pinned to rc.0's versions. Meteor 3.6-rc.1 carries the security fixes of 3.5.3 and 3.5.4, but not what is WeKan's own in the forks: the Admin Panel / Problems reports of refused attempts, and the crypto-RNG keys of dynamic-import and meteor shell (rc.1 still makes them with Math.random()). So the forks are kept and rebased: each is rc.1's package with WeKan's changes over rc.0's package merged three-way onto it. The 3.5.3 hunks merged away, as rc.1 has them; what remains over rc.1 is only the hooks and the keys. The versions are rc.1's with a _1 wrap number. @meteorjs/rspack moves to 3.0.0-rc.2 with the release. The Dockerfile's METEOR_RELEASE and the snap description follow. The experimental Bun build's Meteor patch applies unchanged to 3.6-rc.1; prepare-meteor.sh now checks for rc.1's tag commit and applies meteor-3.6-rc.1.patch, and the rc.0 copy is removed. tests/meteor353SecurityFixes.test.cjs and meteorForkRandomKeys.test.cjs are moved to rc.1 with their assertions kept; meteor-353-security.e2e.js passes on rc.1 in Chromium and Firefox. Thanks to xet7 !
429 lines
13 KiB
JavaScript
429 lines
13 KiB
JavaScript
import isEmpty from 'lodash.isempty';
|
|
|
|
var newView = function(test) {
|
|
var results = [];
|
|
var view = new DDPServer._SessionCollectionView('test', {
|
|
added: function (collection, id, fields) {
|
|
results.push({fun: 'added', id: id, fields: fields});
|
|
},
|
|
changed: function (collection, id, changed) {
|
|
if (isEmpty(changed))
|
|
return;
|
|
results.push({fun: 'changed', id: id, changed: changed});
|
|
},
|
|
removed: function (collection, id) {
|
|
results.push({fun: 'removed', id: id});
|
|
}
|
|
});
|
|
var v = {
|
|
view: view,
|
|
results: results
|
|
};
|
|
["added", "changed", "removed"].forEach(function (it) {
|
|
v[it] = view[it].bind(view);
|
|
});
|
|
v.expectResult = function (result) {
|
|
test.equal(results.shift(), result);
|
|
};
|
|
v.expectNoResult = function () {
|
|
test.equal(results, []);
|
|
};
|
|
v.drain = function() {
|
|
var ret = results;
|
|
results = [];
|
|
return ret;
|
|
};
|
|
return v;
|
|
};
|
|
|
|
Tinytest.add('livedata - sessionview - exists reveal', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {}});
|
|
v.expectNoResult();
|
|
|
|
v.added("B", "A1", {});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectNoResult();
|
|
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - added a second field in another sub', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {a: "foo"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {a: "foo"}});
|
|
v.expectNoResult();
|
|
|
|
v.added("B", "A1", {a: "foo", b: "bar"});
|
|
v.expectResult({fun: 'changed', 'id': "A1", changed: {b: "bar"}});
|
|
|
|
v.removed("A", "A1");
|
|
v.expectNoResult();
|
|
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
|
|
Tinytest.add('livedata - sessionview - field reveal', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
v.added("B", "A1", {foo: "baz"});
|
|
v.removed("A", "A1");
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: "baz"}});
|
|
v.expectNoResult();
|
|
// Somewhere in here we must have changed foo to baz. Legal either on the
|
|
// added or on the removed, but only once.
|
|
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - field change', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
v.changed("A", "A1", {foo: "baz"}, []);
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: "baz"}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - field clear', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
v.changed("A", "A1", {foo: undefined});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: undefined}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - change makes a new field', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
v.changed("A", "A1", {baz:"quux"});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {baz: "quux"}});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - add, remove, add', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - field clear reveal', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
|
|
v.added("B", "A1", {foo: "baz"});
|
|
v.changed("A", "A1", {foo: undefined});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: "baz"}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectNoResult();
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - change to canonical value produces no change', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
|
|
v.added("B", "A1", {foo: "baz"});
|
|
var canon = "bar";
|
|
var maybeResults = v.drain();
|
|
if (!isEmpty(maybeResults)) {
|
|
// if something happened, it was a change message to baz.
|
|
// if nothing did, canon is still bar.
|
|
test.length(maybeResults, 1);
|
|
test.equal(maybeResults[0], {fun: 'changed', id: "A1", changed: {foo: "baz"}});
|
|
canon = "baz";
|
|
}
|
|
v.changed("B", "A1", {foo: canon});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectNoResult();
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - new field of canonical value produces no change', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
|
|
v.added("B", "A1", {});
|
|
|
|
v.changed("B", "A1", {foo: "bar"});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectNoResult();
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - clear all clears only once', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
v.added("B", "A1", {foo: "bar"});
|
|
v.added("C", "A1", {foo: "bar"});
|
|
v.changed("A", "A1", {foo: undefined});
|
|
v.changed("B", "A1", {foo: undefined});
|
|
v.changed("C", "A1", {foo: undefined});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: undefined}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectNoResult();
|
|
v.removed("B", "A1");
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - change all changes only once', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar"}});
|
|
v.expectNoResult();
|
|
|
|
v.added("B", "A1", {foo: "bar"});
|
|
v.added("C", "A1", {foo: "bar"});
|
|
v.changed("B", "A1", {foo: "baz"});
|
|
v.changed("A", "A1", {foo: "baz"});
|
|
v.changed("C", "A1", {foo: "baz"});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: "baz"}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectNoResult();
|
|
v.removed("B", "A1");
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - multiple operations at once in a change', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar", baz: "quux"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar", baz: "quux"}});
|
|
v.expectNoResult();
|
|
|
|
|
|
v.added("B", "A1", {foo: "baz"});
|
|
v.changed("A", "A1", {thing: "stuff", foo: undefined, baz: undefined});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: "baz", thing: "stuff", baz: undefined}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {thing: undefined}});
|
|
v.expectNoResult();
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - more than one document', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar", baz: "quux"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar", baz: "quux"}});
|
|
v.expectNoResult();
|
|
|
|
|
|
v.added("A", "A2", {foo: "baz"});
|
|
v.expectResult({fun: 'added', id: "A2", fields: {foo: "baz"}});
|
|
v.changed("A", "A1", {thing: "stuff", foo: undefined, baz: undefined});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {thing: "stuff", foo: undefined, baz: undefined}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
v.removed("A", "A2");
|
|
v.expectResult({fun: 'removed', id: "A2"});
|
|
v.expectNoResult();
|
|
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - multiple docs removed', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar", baz: "quux"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar", baz: "quux"}});
|
|
v.expectNoResult();
|
|
|
|
|
|
v.added("A", "A2", {foo: "baz"});
|
|
v.expectResult({fun: 'added', id: "A2", fields: {foo: "baz"}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.removed("A", "A2");
|
|
v.expectResult({fun: 'removed', id: "A2"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
|
|
Tinytest.add('livedata - sessionview - complicated sequence', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {foo: "bar", baz: "quux"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: "bar", baz: "quux"}});
|
|
v.expectNoResult();
|
|
|
|
v.added("A", "A2", {foo: "eats"});
|
|
v.expectResult({fun: 'added', id: "A2", fields: {foo: "eats"}});
|
|
|
|
v.added("B", "A1", {foo: "baz"});
|
|
v.changed("A", "A1", {thing: "stuff", foo: undefined, baz: undefined});
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {foo: "baz", thing: "stuff", baz: undefined}});
|
|
v.expectNoResult();
|
|
|
|
v.removed("A", "A1");
|
|
v.removed("A", "A2");
|
|
v.expectResult({fun: 'changed', id: "A1", changed: {thing: undefined}});
|
|
v.expectResult({fun: 'removed', id: "A2"});
|
|
v.expectNoResult();
|
|
v.removed("B", "A1");
|
|
v.expectResult({fun: 'removed', id: "A1"});
|
|
v.expectNoResult();
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - added becomes changed', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added('A', "A1", {foo: 'bar'});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {foo: 'bar'}});
|
|
|
|
v.added('B', "A1", {hi: 'there'});
|
|
v.expectResult({fun: 'changed', id: 'A1', changed: {hi: 'there'}});
|
|
|
|
v.removed('A', 'A1');
|
|
v.expectResult({fun: 'changed', id: 'A1', changed: {foo: undefined}});
|
|
|
|
v.removed('B', 'A1');
|
|
v.expectResult({fun: 'removed', id: 'A1'});
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - weird key names', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added('A', "A1", {});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {}});
|
|
|
|
v.changed('A', "A1", {constructor: 'bla'});
|
|
v.expectResult({fun: 'changed', id: 'A1', changed: {constructor: 'bla'}});
|
|
});
|
|
|
|
Tinytest.add('livedata - sessionview - clear undefined value', function (test) {
|
|
var v = newView(test);
|
|
|
|
v.added("A", "A1", {field: "value"});
|
|
v.expectResult({fun: 'added', id: "A1", fields: {field: "value"}});
|
|
v.expectNoResult();
|
|
|
|
v.changed("A", "A1", {field: undefined});
|
|
v.expectResult({fun: 'changed', id: 'A1', changed: {field: undefined}});
|
|
v.expectNoResult();
|
|
|
|
v.changed("A", "A1", {field: undefined});
|
|
v.expectNoResult();
|
|
|
|
});
|
|
Tinytest.add('livedata - sessionview - prototype fields survive publication changes', function (test) {
|
|
const own = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
|
|
const fields = value => JSON.parse('{"__proto__":' + JSON.stringify(value) + '}');
|
|
const expectField = (event, property, value) => {
|
|
test.isTrue(Boolean(event), 'publication event must be emitted');
|
|
if (!event) return;
|
|
test.isTrue(own(event[property], '__proto__'), 'field must be own data');
|
|
test.equal(event[property].__proto__, value);
|
|
};
|
|
const view = newView(test);
|
|
view.added('primary', 'record', fields({ value: 'primary' }));
|
|
expectField(view.drain()[0], 'fields', { value: 'primary' });
|
|
view.added('fallback', 'record', fields({ value: 'fallback' }));
|
|
view.expectNoResult();
|
|
const cleared = {};
|
|
Object.defineProperty(cleared, '__proto__', { value: undefined, enumerable: true });
|
|
view.changed('primary', 'record', cleared);
|
|
expectField(view.drain()[0], 'changed', { value: 'fallback' });
|
|
view.removed('fallback', 'record');
|
|
expectField(view.drain()[0], 'changed', undefined);
|
|
view.changed('primary', 'record', fields({ value: 'replacement' }));
|
|
expectField(view.drain()[0], 'changed', { value: 'replacement' });
|
|
|
|
const previous = newView(test);
|
|
previous.added('other', 'record', fields({ value: 'old' }));
|
|
previous.drain();
|
|
view.view.diff(previous.view);
|
|
expectField(view.drain()[0], 'changed', { value: 'replacement' });
|
|
const empty = newView(test);
|
|
view.view.diff(empty.view);
|
|
expectField(view.drain()[0], 'fields', { value: 'replacement' });
|
|
view.expectNoResult();
|
|
});
|