Skip to content

Enforce tar entry path normalization in pub_package_reader - #9579

Merged
sigurdm merged 1 commit into
masterfrom
tar-entry-normalization
Sep 15, 2026
Merged

sigurdm merged 1 commit into
masterfrom
tar-entry-normalization

Conversation

@sigurdm

@sigurdm sigurdm commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Tar archives uploaded to pub.dev can contain non-normalized entry names (e.g. ./pubspec.yaml, foo/../pubspec.yaml, redundant slashes, or whitespace padding) or duplicate entries that normalize to the same path. Because pub.dev normalizes entry names during archive summarization while downstream extractors may operate on raw entry names, differences in path interpretation could cause mismatches between validated files and extracted files.

This change:

  • Rejects tar entries whose names are not normalized POSIX relative paths.
  • Rejects entries with redundant slashes, ./, directory navigation (..), and whitespace padding.
  • Allows directory entries both with and without a trailing slash (accommodating standard POSIX tar convention) while rejecting redundant slashes.
  • Tracks normalized entry names to reject duplicate entries that resolve to the same canonical path.

Reject non-normalized paths, redundant slashes, relative references (`.`, `./`, `..`),
and duplicate normalized entries in scanned package archives to ensure the archive
entries evaluated during validation match what downstream clients extract.
@sigurdm
sigurdm requested a review from isoos September 14, 2026 11:53
@sigurdm
sigurdm merged commit 7cf4e02 into master Sep 15, 2026
31 checks passed
@sigurdm
sigurdm deleted the tar-entry-normalization branch September 15, 2026 09:30
sigurdm added a commit that referenced this pull request Sep 15, 2026
Reject non-normalized paths, redundant slashes, relative references (`.`, `./`, `..`),
and duplicate normalized entries in scanned package archives to ensure the archive
entries evaluated during validation match what downstream clients extract.
sigurdm added a commit that referenced this pull request Sep 15, 2026
* feat: Redirect production downloads directly to primary host (#9572)

This simplifies the architecture. Instead of rewriting or signing
the GCS canonical buckets, this simply relies on Google Cloud
Load Balancer logic. If the user hits the service directly via AppEngine,
we redirect them to the canonical domain, which natively routes
via GCLB and serves the cached bucket.

* Enforce tar entry path normalization in pub_package_reader (#9579)

Reject non-normalized paths, redundant slashes, relative references (`.`, `./`, `..`),
and duplicate normalized entries in scanned package archives to ensure the archive
entries evaluated during validation match what downstream clients extract.

* Cleanup dartdoc image marker handling and HTML sanitization (#9578)

* Cleanup dartdoc image marker handling and HTML sanitization

- Retain image marker prefix through sanitization instead of stripping it via string replacement, and resolve it during rendering.
- Escape substituted URLs in attribute context.
- Drop HTML comments during sanitization.

* Bump runtimeVersion to 2026.09.14

* Match the exact encodeComponent alphabet in the image marker pattern

* Update end2end task test goldens
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