mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
* feat(audit): inspect bundled hooks and settings Bundled declarations can schedule commands and broaden permissions outside SKILL.md, while ordinary scanning skips hidden settings. Inspect the four explicit paths with bounded root-confined reads and structured findings so existing audit policy can review their potential execution. Keep activation conditional and redact arbitrary arguments before reports. Register rule metadata through the existing structure analyzer and cover benign twins, parse gaps, source links, policy overrides, CLI/API output and a synthetic E2E runbook. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com> * refactor(audit): parse bundled hook commands with a shell parser The hand-written lexer for hook commands grew six similar quote and paren scanners, and each review round found another shell form it missed (comments after line continuations, nested backticks, `time -p`). Parsing with mvdan.cc/sh/v3/syntax follows quoting, comments, substitutions, loops, functions and heredocs the way bash does, so the analyzer walks every call in the syntax tree instead. The wrapper table (sudo, env, timeout, xargs, bash -c, git) and the POST and destination rules are unchanged, now applied to unquoted argv words. A script fed to a shell on stdin (`bash <<'EOF'`, `bash <<<`) is parsed like `bash -c`. Statements before a syntax error are still inspected. bash runs some forms the parser rejects (an array element assigned before a command), so a rejected command also gets a word-level network check next to its coverage gap, rather than dropping to MEDIUM. The dependency adds about 0.26 MB to the release binary; vendorHash follows the new go.sum. * fix(audit): bound nested shell parsing and skip stdin data A script nested in a substitution was inspected twice, once by reparsing the outer shell's argument and once by walking the outer syntax tree, so each `bash <<< "$(...)"` or `bash -c "$(...)"` level doubled the work and a hook under 1 KB could stall an audit. Results are now remembered per script text and depth, and one hook command may parse at most 1 MiB of source in total, since deep nesting still costs quadratic time with the cache alone. Past the budget the command is classified word by word and gets a coverage gap, as a rejected command does. Stdin was also treated as a script whenever a shell had a heredoc or here-string, but `bash -c 'cat' <<<` or `bash ./script.sh <<<` hands it to something else as data, which turned a lifecycle hook into a false HIGH. Stdin is now parsed only for `-s`, or when there is neither `-c` nor a script file operand. Option values (`-euo pipefail`, `-O extglob`, `--rcfile f`) are not mistaken for a script file. --------- Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: sim <sim@example.invalid>