Proteção XSS, assinatura de webhook, limite de execuções e data no histórico
- Utilitário centralizado Utils.escapeHtml() substituindo duplicações locais - Escaping completo em todos os componentes (agents, tasks, schedules, pipelines, webhooks, terminal, history, tags) - Verificação HMAC-SHA256 para webhooks usando raw body - Limite de 5000 registros no store de execuções (maxSize) - Data de execução visível no histórico com ícone de calendário - Remoção de mutex desnecessário no flush síncrono do db.js - Novos stores preparatórios (secrets, notifications, agentVersions)
This commit is contained in:
@@ -41,6 +41,7 @@ function createStore(filePath) {
|
||||
let mem = null;
|
||||
let dirty = false;
|
||||
let timer = null;
|
||||
let maxSize = Infinity;
|
||||
|
||||
function boot() {
|
||||
if (mem !== null) return;
|
||||
@@ -81,6 +82,9 @@ function createStore(filePath) {
|
||||
updated_at: new Date().toISOString(),
|
||||
};
|
||||
mem.push(item);
|
||||
if (maxSize !== Infinity && mem.length > maxSize) {
|
||||
mem.splice(0, mem.length - maxSize);
|
||||
}
|
||||
touch();
|
||||
return clone(item);
|
||||
},
|
||||
@@ -118,6 +122,10 @@ function createStore(filePath) {
|
||||
dirty = false;
|
||||
}
|
||||
},
|
||||
|
||||
setMaxSize(n) {
|
||||
maxSize = n;
|
||||
},
|
||||
};
|
||||
|
||||
allStores.push(store);
|
||||
@@ -185,5 +193,9 @@ export const tasksStore = createStore(`${DATA_DIR}/tasks.json`);
|
||||
export const pipelinesStore = createStore(`${DATA_DIR}/pipelines.json`);
|
||||
export const schedulesStore = createStore(`${DATA_DIR}/schedules.json`);
|
||||
export const executionsStore = createStore(`${DATA_DIR}/executions.json`);
|
||||
executionsStore.setMaxSize(5000);
|
||||
export const webhooksStore = createStore(`${DATA_DIR}/webhooks.json`);
|
||||
export const settingsStore = createSettingsStore(`${DATA_DIR}/settings.json`);
|
||||
export const secretsStore = createStore(`${DATA_DIR}/secrets.json`);
|
||||
export const notificationsStore = createStore(`${DATA_DIR}/notifications.json`);
|
||||
export const agentVersionsStore = createStore(`${DATA_DIR}/agent_versions.json`);
|
||||
|
||||
Reference in New Issue
Block a user