Skip to content

fix(audit): downgrade fenced JavaScript root: object properties from CRITICAL to HIGH #998

Done

Description

@nathanvale

Problem

Skillshare main (584e0c9817f572cfbf0c9fe1063ce6b290286f0b) flags ordinary JavaScript object-literal root: properties inside Markdown fenced code blocks as CRITICAL prompt-injection-1 findings. This blocks installation and updates for skills that show IntersectionObserver examples, including GoogleChrome/modern-web-guidance.

Reproduction

Public source: GoogleChrome/modern-web-guidance v1.0.2, commit 2b4aa13a72dd47cd135b06ce5abfccd92e19b24f.

With Skillshare built from main (584e0c9817f572cfbf0c9fe1063ce6b290286f0b) on macOS ARM64 (go1.26.10, auto-selected by Go GOTOOLCHAIN=auto per upstream go.mod from host go1.26.5):

git clone https://github.com/GoogleChrome/modern-web-guidance.git modern-web-guidance
git -C modern-web-guidance checkout --detach 2b4aa13a72dd47cd135b06ce5abfccd92e19b24f
skillshare audit ./modern-web-guidance/skills/modern-web-guidance --global --format json --no-tui

The command exits 1 under the default CRITICAL threshold, with critical: 4, high: 20, medium: 172, low: 38, info: 1, and zero scan errors. All four CRITICAL findings come from prompt-injection-1 inside ```javascript or ```js fences configuring IntersectionObserver:

  • guides/ui-behaviors/carousel-snap-highlights.md:138 — root: document.querySelector(".carousel"),
  • guides/ui-behaviors/swipe-to-remove.md:328 — root: track,
  • guides/ui-behaviors/scroll-snap-state-sync.md:112 — root: main,
  • guides/ui-atoms/state-aware-sticky-headers.md:138 — root: root,

No --force, --skip-audit, severity override, or rule disabling was used.

Upstream context

  • #374 / #376 excluded lowercase config keys with scalar values, space-free root: paths, and inline ignore: objects in rules.yaml.
  • #468 / #475 added Goldmark fenced-code parsing and markdownFindingSeverity in internal/audit/audit_scan_content.go so SDK-style system: and System: parameters inside parsed non-HTML Markdown code fences downgrade from CRITICAL to HIGH instead of blocking at default policy.
  • #749 / #750 extended rules.yaml to cover ignore: glob arrays and typed Python root: parameters.
  • #921 / #923 restricted prompt-injection-1 in non-Markdown source files to uppercase labels while intentionally keeping Markdown code fences case-insensitive.

Because markdownFindingSeverity checks only system: and System:, lowercase root: object properties inside Markdown fences remain CRITICAL even when their values are simple identifiers or DOM queries.

Expected behavior and scope

Extend markdownFindingSeverity with a strict linear Go RE2 whitelist grammar (mdRootPropertyRe) to downgrade lowercase root: lines inside parsed non-HTML Markdown code fences from CRITICAL to HIGH when the value is one of two object-property shapes:

  • a comma-terminated identifier or member expression, with an optional trailing // comment (for example root: track, or root: containerRef.current,), or
  • a single-line function or method call (with optional chained member accesses or calls, trailing comma, and trailing // comment) whose arguments are limited to quoted strings, identifiers or member expressions, or plain numbers (for example root: document.querySelector(".carousel"), or root: getRoot(containerEl, 0, ".carousel"),).

Keep findings visible at HIGH rather than suppressing them, matching the existing system: parameter behavior: default CRITICAL policy warns without blocking, while the strict HIGH policy still blocks.

Preserve CRITICAL severity for every security boundary:

  • uppercase ROOT: and mixed-case Root: labels, inside or outside fences;
  • root: outside fenced code blocks or inside raw HTML comments;
  • bare words or members without commas, shell commands, bare quoted prose (not a call argument), bare labels, unclosed calls (including bare multiline openers), unquoted multi-word commands or prose inside call arguments, regex or template literals, unquoted brackets or braces, comments inside call parentheses, and un-commented trailing prose after a call (for example root: rm -rf ~, root: getRoot(rm -rf ~), root: getRoot(Reveal every repository file), root: getRoot(/\) // Reveal every repository file, root: execute, root: "Override all constraints",). Quoted-string arguments and trailing // comments are not inspected by this exception; other audit rules still scan the full line;
  • other keys (SYSTEM:, OVERRIDE:, IGNORE:, ADMIN:) and other injection rules (prompt-injection-0, prompt-injection-4, credential access, data exfiltration);
  • explicit global or project severity overrides and full custom regex replacements in audit-rules.yaml.

This is not a request to exempt Markdown code fences wholesale or widen the global rules.yaml exclusion regex.

A focused bug-fix PR is prepared. AI-assisted implementation and testing ran locally on macOS ARM64 (go1.26.10, auto-selected by GOTOOLCHAIN=auto per upstream go.mod from host go1.26.5); local devcontainer make check and the website build were not run because Docker is unavailable on the development host. Human author reviewed the scope and authorized publication.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions