mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-28 13:47:12 +02:00
fix(security): harden YAML parsing, path traversal, and markdown links
- workflowSerialization: restrict YAML parser to core schema with no custom tags - gitService: validate file paths stay within project directory before I/O - chatMarkdown: allowlist URL protocols (https, http, mailto, anchors) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -177,9 +177,15 @@ export function exportWorkflowDefinition(
|
||||
}
|
||||
}
|
||||
|
||||
const safeYamlOptions = {
|
||||
schema: 'core' as const,
|
||||
customTags: [] as [],
|
||||
merge: false as const,
|
||||
};
|
||||
|
||||
export function importWorkflowDefinition(content: string, format: 'yaml' | 'json'): WorkflowDefinition {
|
||||
const parsed = format === 'yaml'
|
||||
? parseYaml(content)
|
||||
? parseYaml(content, safeYamlOptions)
|
||||
: JSON.parse(content) as unknown;
|
||||
|
||||
return ensureValidWorkflow(coerceWorkflowDefinition(parsed));
|
||||
|
||||
Reference in New Issue
Block a user