Skip to content

Parse shard names from the right - #700

Open
u7k4rs6 wants to merge 1 commit into
sigstore:mainfrom
u7k4rs6:fix-shard-name-colon
Open

u7k4rs6 wants to merge 1 commit into
sigstore:mainfrom
u7k4rs6:fix-shard-name-colon

Conversation

@u7k4rs6

@u7k4rs6 u7k4rs6 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Shard resource names are "path:start:end", and new_item split them on every ":", so a model with a colon in a file name could be shard-signed but never verified. This uses rsplit(":", 2) so the path keeps its colons.

Added a unit test for new_item and a sign/verify round trip with a colon in the file name (skipped on Windows, where ":" isn't allowed in file names). Both fail on main and pass with the change. Also added a CHANGELOG entry.

I left _Shard.from_str alone since nothing uses it and an existing test pins its behavior. Happy to change it too if you prefer.

Fixes #698

A shard resource name is "path:start:end", and new_item split it on
every ":". A model with a ":" in a file name (legal on Linux and macOS)
could be signed with shard serialization, but verifying the signature
always failed with "Invalid resource name".

Split from the right with rsplit(":", 2) so the path keeps its colons.

Resolves: sigstore#698

Signed-off-by: Utkarsh Bahuguna <utkarshbahuguna10@gmail.com>
@u7k4rs6
u7k4rs6 requested review from a team as code owners December 4, 2026 13:02

@mihaimaruseac mihaimaruseac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

This branch has not been deployed

No deployments
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.

Shard signatures can't be verified when a file name contains ":"

2 participants