mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
fix(security): use YAML core schema to prevent type coercion (#20857)
YAML 1.1 default schema silently coerces values like "on" to true and "off" to false, which can cause unexpected behavior in frontmatter parsing. Explicitly set schema: "core" to use YAML 1.2 rules that only recognize true/false/null literals.
This commit is contained in:
@@ -34,7 +34,7 @@ function coerceFrontmatterValue(value: unknown): string | undefined {
|
||||
|
||||
function parseYamlFrontmatter(block: string): ParsedFrontmatter | null {
|
||||
try {
|
||||
const parsed = YAML.parse(block) as unknown;
|
||||
const parsed = YAML.parse(block, { schema: "core" }) as unknown;
|
||||
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user