Skip to content

fix(models): remove dead try/except in ClientTrustConfig.from_tuf - #1715

Open
xovishnukosuri wants to merge 2 commits into
sigstore:mainfrom
xovishnukosuri:fix/models-remove-dead-tuf-reraise
Open

xovishnukosuri wants to merge 2 commits into
sigstore:mainfrom
xovishnukosuri:fix/models-remove-dead-tuf-reraise

Conversation

@xovishnukosuri

Copy link
Copy Markdown

What

ClientTrustConfig.from_tuf wraps the get_signing_config_path call in a try/except that catches TUFError and immediately re-raises it with raise e:

try:
    sc_path = updater.get_signing_config_path()
    inner_sc = trustroot_v1.SigningConfig.from_json(Path(sc_path).read_bytes())
except TUFError as e:
    raise e

Why this is a bug

raise e resets the exception's __traceback__ to the re-raise site, so the traceback shown to the user points at line 972 in models.py instead of the actual failure location inside get_signing_config_path() or from_json(). This makes TUF errors harder to diagnose.

Since the handler does nothing beyond re-raising, the entire try/except block is dead code. The exception propagates identically without it, and bare propagation preserves the original traceback.

Change

Remove the try/except block and drop the now-unused TUFError import.

All 174 unit tests pass.

Vishnu Kosuri and others added 2 commits March 14, 2026 11:47
…entities

Fulcio ignores the CSR subject field entirely and derives the certificate
identity from the OIDC token directly. Embedding the actual identity claim
in the CSR's EMAIL_ADDRESS attribute causes failures when the claim contains
non-ASCII characters (e.g. emojis in GitHub Actions environment names), since
the field is encoded as IA5String which only allows ASCII.

Replace the identity value with a fixed stub "user@example.com" so that CSR
construction succeeds regardless of the claim content.

Fixes sigstore#1507

Signed-off-by: Vishnu Kosuri <xovishnukosuri@gmail.com>
The try/except block around get_signing_config_path() caught TUFError
only to re-raise it with `raise e`, which resets the traceback to the
re-raise site and hides the actual failure location. Since nothing else
is done in the handler, the block serves no purpose. Remove it and drop
the now-unused TUFError import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@woodruffw woodruffw 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.

This appears to have unrelated changes from #1714 in it.

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