Skip to content

fix: contain recipe template includes - #10930

Merged
jbg merged 1 commit into
mainfrom
jbg/security-recipe-template-containment
Aug 6, 2026
Merged

fix: contain recipe template includes#10930
jbg merged 1 commit into
mainfrom
jbg/security-recipe-template-containment

Conversation

@jbg

@jbg jbg commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • confine MiniJinja include and extends targets to the recipe directory
  • reject absolute paths, parent traversal, and symlink escapes at the shared template loader
  • preserve missing-template behavior and valid sibling or nested inheritance
  • add focused absolute-path, traversal, symlink, and legitimate nested-template regressions

This restores the invariant that loading an untrusted recipe cannot make template inheritance read files outside that recipe's directory. It addresses the confirmed private audit finding project-loupe/audit-goose#91 without publishing exploit-specific content.

Validation

  • Regression proof before the fix: 3 escape tests failed; the legitimate nested-template test passed
  • cargo fmt --all
  • cargo test -p goose recipe::template_recipe::tests::template_loader_tests — 4 passed
  • cargo test -p goose recipe::build_recipe::tests::test_template_inheritance — 1 passed
  • cargo build -p goose
  • cargo clippy -p goose --all-targets -- -D warnings

Limitations

This change intentionally limits inheritance to existing UTF-8 template files beneath the canonical recipe directory. It does not change recipe discovery, YAML parsing, or template parameter behavior.

This finding was discovered by Project Loupe.

@jbg
jbg requested a review from lifeizhou-ap August 5, 2026 21:13
@jbg
jbg merged commit cdc016a into main Aug 6, 2026
25 checks passed
@jbg
jbg deleted the jbg/security-recipe-template-containment branch August 6, 2026 00:14
lifeizhou-ap added a commit that referenced this pull request Aug 6, 2026
* main: (32 commits)
  fix: keep turn-context in place for OpenAI Responses-stack models so prompt caching works (#10993)
  fix(developer): byte-bound the shell truncation preview (#10992)
  fix(openrouter): stop silently ignoring thinking effort off (#10991)
  fix: dispatch edited queued messages (#10933)
  fix: contain recipe template paths (#10930)
  fix: make shell approval titles faithful (#10986)
  fix: block MCP app form submissions (#10985)
  fix: migrate desktop routing to React Router 8.3.0 (#10971)
  fix: sanitize Bedrock tool errors (#10934)
  fix implicit OAuth during model discovery (#10929)
  fix: update React Router to 7.18.2 (#10967)
  test: early-exit code-exec smoke tests once tool invocation is observed (#10954)
  fix: keep ACP session naming out of live conversations (#10963)
  Bind MCP apps to trusted ownership metadata (#10747)
  tests: add recursion_limit attribute to remaining ACP test files (#10559)
  Sanitize Unicode tags in MCP resources (#10746)
  fix(oauth): preserve RFC 9207 iss from MCP OAuth callback (#10678)
  feat(installer): detect Termux and select musl portable build (#10568)
  feat: add Celeris provider (#10714)
  fix: shell ACP providers on desktop (#10907)
  ...
lifeizhou-ap added a commit that referenced this pull request Aug 6, 2026
* main: (101 commits)
  fix: keep turn-context in place for OpenAI Responses-stack models so prompt caching works (#10993)
  fix(developer): byte-bound the shell truncation preview (#10992)
  fix(openrouter): stop silently ignoring thinking effort off (#10991)
  fix: dispatch edited queued messages (#10933)
  fix: contain recipe template paths (#10930)
  fix: make shell approval titles faithful (#10986)
  fix: block MCP app form submissions (#10985)
  fix: migrate desktop routing to React Router 8.3.0 (#10971)
  fix: sanitize Bedrock tool errors (#10934)
  fix implicit OAuth during model discovery (#10929)
  fix: update React Router to 7.18.2 (#10967)
  test: early-exit code-exec smoke tests once tool invocation is observed (#10954)
  fix: keep ACP session naming out of live conversations (#10963)
  Bind MCP apps to trusted ownership metadata (#10747)
  tests: add recursion_limit attribute to remaining ACP test files (#10559)
  Sanitize Unicode tags in MCP resources (#10746)
  fix(oauth): preserve RFC 9207 iss from MCP OAuth callback (#10678)
  feat(installer): detect Termux and select musl portable build (#10568)
  feat: add Celeris provider (#10714)
  fix: shell ACP providers on desktop (#10907)
  ...
michaelneale added a commit that referenced this pull request Aug 9, 2026
* origin/main: (47 commits)
  chore(deps): bump pypa/gh-action-pypi-publish from 1.14.1 to 1.14.2 (#11037)
  chore(deps): bump actions/setup-java from 5.6.0 to 5.7.0 (#11036)
  chore(deps): bump Jimver/cuda-toolkit from 0.2.35 to 0.2.36 (#11035)
  chore(deps-dev): bump js-yaml from 4.3.0 to 4.3.1 in /documentation (#11052)
  chore(deps-dev): bump @types/yauzl from 2.10.3 to 3.4.0 in /ui (#10975)
  chore(deps-dev): bump electron from 41.0.0 to 41.10.3 in /ui (#10969)
  chore(deps): bump brace-expansion from 1.1.16 to 1.1.18 in /documentation (#10947)
  chore(deps-dev): bump postcss from 8.5.8 to 8.5.23 in /ui (#10946)
  chore(deps): bump aiohttp from 3.14.1 to 3.14.3 in /scripts/provider-error-proxy (#10945)
  chore(deps): bump fast-uri from 3.1.4 to 3.1.5 in /documentation (#10944)
  fix: reject invalid subrecipe content (#10994)
  chore(deps): bump azure/login from 3.0.0 to 3.0.1 (#11033)
  chore(deps): bump pnpm/action-setup from 6.0.9 to 6.0.10 (#11034)
  Cache-safe request assembly: append-only turn context and declared cache semantics (#11022)
  Unrolled agent loop (#9574)
  fix: keep turn-context in place for OpenAI Responses-stack models so prompt caching works (#10993)
  fix(developer): byte-bound the shell truncation preview (#10992)
  fix(openrouter): stop silently ignoring thinking effort off (#10991)
  fix: dispatch edited queued messages (#10933)
  fix: contain recipe template paths (#10930)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants