mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-03-14 02:17:27 +00:00
fix(security): disable executable gray-matter frontmatter in commands
This commit is contained in:
18
server/utils/frontmatter.js
Normal file
18
server/utils/frontmatter.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import matter from 'gray-matter';
|
||||
|
||||
const disabledFrontmatterEngine = () => ({});
|
||||
|
||||
const frontmatterOptions = {
|
||||
language: 'yaml',
|
||||
// Disable JS/JSON frontmatter parsing to avoid executable project content.
|
||||
// Mirrors Gatsby's mitigation for gray-matter.
|
||||
engines: {
|
||||
js: disabledFrontmatterEngine,
|
||||
javascript: disabledFrontmatterEngine,
|
||||
json: disabledFrontmatterEngine
|
||||
}
|
||||
};
|
||||
|
||||
export function parseFrontmatter(content) {
|
||||
return matter(content, frontmatterOptions);
|
||||
}
|
||||
Reference in New Issue
Block a user