- Foldable left panel (user profile) and right panel (task details) - Clicking a task in the list or graph node selects it and shows details - Both views (task list + graph) always mounted via absolute inset-0 for correct canvas dimensions; tabs toggle visibility with opacity - Graph node selection animation: other nodes repel outward (charge -600), then selected node smoothly slides to center (500ms cubic ease-out), then charge restores to -120 and graph stabilizes - Graph re-fits on tab switch and panel resize via ResizeObserver - Fix UUID string IDs throughout (backend returns UUIDs, not integers) - Add TaskDetailPanel, UserPanel components - Add CLAUDE.md project documentation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
70 lines
2.4 KiB
JavaScript
70 lines
2.4 KiB
JavaScript
import { extend } from '../utils';
|
|
import logger from '../logger';
|
|
|
|
const loggedProperties = Object.create(null);
|
|
|
|
export function createProtoAccessControl(runtimeOptions) {
|
|
// Create an object with "null"-prototype to avoid truthy results on
|
|
// prototype properties.
|
|
const propertyWhiteList = Object.create(null);
|
|
// eslint-disable-next-line no-proto
|
|
propertyWhiteList['__proto__'] = false;
|
|
extend(propertyWhiteList, runtimeOptions.allowedProtoProperties);
|
|
|
|
const methodWhiteList = Object.create(null);
|
|
methodWhiteList['constructor'] = false;
|
|
methodWhiteList['__defineGetter__'] = false;
|
|
methodWhiteList['__defineSetter__'] = false;
|
|
methodWhiteList['__lookupGetter__'] = false;
|
|
methodWhiteList['__lookupSetter__'] = false;
|
|
extend(methodWhiteList, runtimeOptions.allowedProtoMethods);
|
|
|
|
return {
|
|
properties: {
|
|
whitelist: propertyWhiteList,
|
|
defaultValue: runtimeOptions.allowProtoPropertiesByDefault
|
|
},
|
|
methods: {
|
|
whitelist: methodWhiteList,
|
|
defaultValue: runtimeOptions.allowProtoMethodsByDefault
|
|
}
|
|
};
|
|
}
|
|
|
|
export function resultIsAllowed(result, protoAccessControl, propertyName) {
|
|
if (typeof result === 'function') {
|
|
return checkWhiteList(protoAccessControl.methods, propertyName);
|
|
} else {
|
|
return checkWhiteList(protoAccessControl.properties, propertyName);
|
|
}
|
|
}
|
|
|
|
function checkWhiteList(protoAccessControlForType, propertyName) {
|
|
if (protoAccessControlForType.whitelist[propertyName] !== undefined) {
|
|
return protoAccessControlForType.whitelist[propertyName] === true;
|
|
}
|
|
if (protoAccessControlForType.defaultValue !== undefined) {
|
|
return protoAccessControlForType.defaultValue;
|
|
}
|
|
logUnexpecedPropertyAccessOnce(propertyName);
|
|
return false;
|
|
}
|
|
|
|
function logUnexpecedPropertyAccessOnce(propertyName) {
|
|
if (loggedProperties[propertyName] !== true) {
|
|
loggedProperties[propertyName] = true;
|
|
logger.log(
|
|
'error',
|
|
`Handlebars: Access has been denied to resolve the property "${propertyName}" because it is not an "own property" of its parent.\n` +
|
|
`You can add a runtime option to disable the check or this warning:\n` +
|
|
`See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`
|
|
);
|
|
}
|
|
}
|
|
|
|
export function resetLoggedProperties() {
|
|
Object.keys(loggedProperties).forEach(propertyName => {
|
|
delete loggedProperties[propertyName];
|
|
});
|
|
}
|