registrystack / registrystack/registry-stack

bregctl: prepare-source on a borrowed issuer silently skips owner registration

Open Beginner friendly
#1,061 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2
Forks
0
Avg merge
2h 57m
Merged PRs (30d)
128

Description

## What happens

`bregctl dev prepare-source --apply`, including the path driven by `evidencectl source add`, runs to completion against a session started with `--issuer-project`.

The transition creates a new client keypair under `credentials/`, then calls `config::refresh_issuer_registration`, which returns `Ok(())` immediately when `state.issuer_project.is_some()`. `finish` still commits the updated clients inventory and regenerates the runtime.

The result is a session that admits a client the shared issuer cannot authenticate, so token acquisition for the newly connected source fails at first use.

## Why it is a silent no-op

`crates/registry-bregctl/src/dev/prepare_source.rs:537` carries the comment "Publish the whole derived issuer description so the next owned restart bootstraps the registration". On a borrowed session no registration is published and nothing says so. Searching `prepare_source.rs` for `issuer_project`, `issuer_owner` or `borrowed` returns nothing, so no refusal exists anywhere on this path.

This is the shape `CLAUDE.md` rules out: a failure that neither raises nor reports.

## Options

1. Refuse the transition before any mutation when the issuer is borrowed. Simplest, and matches how the other borrowed paths behave.
2. Require and verify a matching owner registration, the way `caseworkctl` verifies the owner's registered connection at launch.

Option 1 unless there is a reason a borrowed session should be able to add sources at all.

## Scope

Local dev tooling only. No runtime or deployment surface.

Found by Codex review on #1057 and verified by reading the call path. Not fixed there: the fix is a refusal path of its own rather than a rider on that change.

Contributor guide

Open the contributing guide

Research direction

Start at crates/registry-bregctl/src/dev/prepare_source.rs:537 and trace bregctl dev prepare-source --apply, including the evidencectl source add path, through config::refresh_issuer_registration and finish. Confirm how borrowed sessions are identified with --issuer-project, then make the transition refuse before creating credentials or committing inventory changes; done means the borrowed path reports a failure instead of silently completing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.