Skip to content

fix(scope): validate object refs in /scope/fetch#10371

Merged
davidfirst merged 3 commits into
masterfrom
fix/b4-fetch-object-ref-validation
May 14, 2026
Merged

fix(scope): validate object refs in /scope/fetch#10371
davidfirst merged 3 commits into
masterfrom
fix/b4-fetch-object-ref-validation

Conversation

@davidfirst
Copy link
Copy Markdown
Member

/scope/fetch with type: 'object' was passing user-supplied ids directly into new Ref(id) without format validation. The other fetch types already validate via ComponentID.fromString or LaneId.parse; this brings the object type in line.

Validates each id with isHash (3–40 hex chars, so short-hash lookups still work) before constructing the Ref.

Copilot AI review requested due to automatic review settings May 13, 2026 19:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens /scope/fetch for type: 'object' by validating raw object refs before converting them to repository Ref instances, aligning object fetch behavior with the existing validation used by component and lane fetches.

Changes:

  • Imports isHash from @teambit/component-version.
  • Validates each object id before constructing Ref.
  • Rejects malformed object refs with a clear error.

@davidfirst davidfirst enabled auto-merge (squash) May 14, 2026 13:49
@davidfirst davidfirst merged commit d2cf6da into master May 14, 2026
12 checks passed
@davidfirst davidfirst deleted the fix/b4-fetch-object-ref-validation branch May 14, 2026 14:34
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.

3 participants