LiquidGuard SAST
A static analysis security scanner for Shopify Liquid templates that detects XSS vulnerabilities, unsafe data flows, and insecure patterns at the AST level before they reach production.
Shopify themes handle customer data, payment information, and user-generated content — but there's no security scanning tool purpose-built for Liquid. Generic SAST tools don't understand Liquid's template syntax, filter chains, or Shopify-specific security contexts.
Built a custom Liquid parser that generates an Abstract Syntax Tree, then walks the tree to trace data flows from untrusted sources (customer input, metafields) through filter chains to output contexts (HTML, JavaScript, URL attributes), flagging unescaped or improperly sanitized paths.
1export function analyzeOutputStatement(2 node: LiquidOutputNode,3 scope: AnalysisScope4): SecurityFinding[] {5 const findings: SecurityFinding[] = []6 const outputContext = determineContext(node)7 const dataSource = resolveDataSource(node.expression, scope)89 if (!dataSource.isTrusted) {10 const filterChain = extractFilters(node)11 const sanitized = filterChain.some(f =>12 SANITIZING_FILTERS[outputContext]?.includes(f.name)13 )1415 if (!sanitized) {16 findings.push({17 severity: 'high',18 rule: 'xss-unescaped-output',19 message: `Untrusted data "${dataSource.name}" rendered in ` +20 `${outputContext} context without sanitization`,21 location: node.location,22 fix: suggestFilter(outputContext),23 })24 }25 }2627 return findings28}29
Interested in similar work?
Let's discuss how I can help bring your Shopify project to life.