Skip to content

Instantly share code, notes, and snippets.

// Strict font allowlist (absolute paths only)
const FONT_MAP = Object.freeze({
"dejavu-sans": "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
"dejavu-sans-bold": "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",
"dejavu-mono": "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf",
"noto-sans": "/usr/share/fonts/noto/NotoSans-Regular.ttf",
"liberation-sans": "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf"
});
// Validate and sanitize text (reject ImageMagick coders)
// Trust boundaries: Anything from network = untrusted data
// Anything from LLM = untrusted instructions
// Tool scoping with policy allow-list
const ALLOWED_TOOLS = {
azure_invoke: {
// Helper: create a null-prototype object with fields
function obj(data) {
return Object.assign(Object.create(null), data)
}
// Safe deep merge that prevents prototype pollution