Skip to content

Constrain content paths to the content root. - #99

Merged
samuel-williams-shopify merged 2 commits into
mainfrom
constrain-content-local-path
Aug 17, 2026
Merged

Constrain content paths to the content root.#99
samuel-williams-shopify merged 2 commits into
mainfrom
constrain-content-local-path

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Summary

Resolve Utopia::Content::Node#local_path through Protocol::URL::Path#local_path, ensuring application paths remain lexically contained beneath the configured content root.

Preserve the existing Pathname return type and relative-path behavior. Reject absolute paths containing traversal which would escape the root.

This boundary does not resolve symbolic links or protect against filesystem races; it provides the same lexical containment used by static file serving.

Testing

  • bundle exec sus test/utopia/content.rb test/utopia/content/node.rb
  • bundle exec rubocop lib/utopia/content/node.rb test/utopia/content/node.rb
  • bundle exec bake decode:index:coverage lib

Assisted-By: devx/cbdeae41-9308-4071-ad53-58cd92db2946
Assisted-By: devx/cbdeae41-9308-4071-ad53-58cd92db2946
@samuel-williams-shopify
samuel-williams-shopify force-pushed the constrain-content-local-path branch from 4c2b8bf to 9345f01 Compare August 17, 2026 08:43
@samuel-williams-shopify
samuel-williams-shopify merged commit 6377c1e into main Aug 17, 2026
34 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the constrain-content-local-path branch August 17, 2026 08:45
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.

1 participant