const enclave = new Enclave({
doubleVm: {
parentValidation: {
suspiciousPatterns: [
{
id: 'CUSTOM_PATTERN',
description: 'Custom detection logic',
detect: (operationName, args, history) => {
// Check if operation is suspicious based on context
if (operationName.includes('dangerous')) {
return true;
}
// Check operation history
const recentOps = history.slice(-5);
if (recentOps.some(op => op.name === 'sensitive:read')) {
return operationName.includes('send');
}
return false;
},
},
{
id: 'RATE_SPIKE',
description: 'Sudden increase in operation rate',
detect: (operationName, args, history) => {
const last10 = history.slice(-10);
const timeSpan = Date.now() - (last10[0]?.timestamp || 0);
return timeSpan < 1000; // 10 ops in <1s
},
},
],
},
},
});