Files
wekan/models/lib/cardCopyOverrides.js
T
Lauri Ojansivu 1e44a1ffc1 Restrict card-copy overrides to text and preserve the source
Prevent caller overrides from replacing the authorized card identity before
private children are loaded. Apply title and description strings to a
separate transformed card; refuse all other fields before copying.

Summarize extra-field attempts as CopyIdentityBleed while treating malformed
text as an ordinary input error. Add unit, source-scan and live browser
regressions, and document the reproduced disclosure and remaining review.
Update the shared-form regression for the existing multiline title editor.

Thanks to xet7 !
2026-09-29 00:04:16 +03:00

19 lines
981 B
JavaScript

'use strict';
// The copy dialog edits text, never the identity/placement used to load children
// or the transformed document's methods. Retain its prototype without mutating
// the source object returned by ReactiveCache.
function cardWithCopyOverrides(card, values) {
if (!values || Object.getPrototypeOf(values) !== Object.prototype ||
Object.keys(values).some(key => !['title', 'description'].includes(key) || typeof values[key] !== 'string')) {
const error = new Error('Invalid card copy overrides');
// Malformed title/description text can come from a mistaken bulk-copy form.
// Only attempts to supply fields outside that contract are security events.
error.securityAttempt = !!values && typeof values === 'object' &&
Object.keys(values).some(key => !['title', 'description'].includes(key));
throw error;
}
return Object.assign(Object.create(Object.getPrototypeOf(card)), card, values);
}
module.exports = { cardWithCopyOverrides };