Skip to content

feat(BRE2-763): adding revoke command. Fixes to register.#309

Merged
patelspratik merged 5 commits intomainfrom
BRE2-763-revoke
Mar 4, 2026
Merged

feat(BRE2-763): adding revoke command. Fixes to register.#309
patelspratik merged 5 commits intomainfrom
BRE2-763-revoke

Conversation

@patelspratik
Copy link
Contributor

  • Added revoke-ssh (inverse of grant)
  • device_registration is now in etc so all linux users will see a registration

@patelspratik patelspratik marked this pull request as ready for review March 4, 2026 18:09
@patelspratik patelspratik requested a review from a team as a code owner March 4, 2026 18:09
Comment on lines +25 to +27
// BrevKeyComment is kept as an alias for backward compatibility with tests
// and callers that reference the old constant name.
const BrevKeyComment = BrevKeyPrefix
Copy link
Contributor

Choose a reason for hiding this comment

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

Just consolidate?

// RevokeSSHAccessFromNode removes the user's public key from authorized_keys
// and calls RevokeNodeSSHAccess to record the revocation server-side.
// No rollback is performed if the RPC fails — the key stays removed for safety.
func RevokeSSHAccessFromNode(
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused?

Copy link
Contributor

Choose a reason for hiding this comment

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

Old but: typo here curren

Comment on lines +155 to +169
func getRegistration(deps revokeSSHDeps) (*register.DeviceRegistration, error) {
registered, err := deps.registrationStore.Exists()
if err != nil {
return nil, breverrors.WrapAndTrace(err)
}
if !registered {
return nil, fmt.Errorf("no registration found; this machine does not appear to be registered\nRun 'brev register' to register your device first")
}

reg, err := deps.registrationStore.Load()
if err != nil {
return nil, fmt.Errorf("failed to read registration file: %w", err)
}
return reg, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks duplicated (also exists in grantssh.go)

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 58.13008% with 103 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.46%. Comparing base (88dc335) to head (ab0aa88).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cmd/revokessh/revokessh.go 66.33% 30 Missing and 4 partials ⚠️
pkg/cmd/register/device_registration_store.go 39.47% 21 Missing and 2 partials ⚠️
pkg/cmd/register/register.go 24.00% 17 Missing and 2 partials ⚠️
pkg/cmd/register/sshkeys.go 77.61% 11 Missing and 4 partials ⚠️
pkg/cmd/deregister/deregister.go 20.00% 4 Missing ⚠️
pkg/cmd/grantssh/grantssh.go 20.00% 4 Missing ⚠️
pkg/cmd/enablessh/enablessh.go 0.00% 3 Missing ⚠️
pkg/cmd/cmd.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #309      +/-   ##
==========================================
+ Coverage   14.77%   15.46%   +0.69%     
==========================================
  Files         127      128       +1     
  Lines       16977    17155     +178     
==========================================
+ Hits         2508     2653     +145     
- Misses      14182    14203      +21     
- Partials      287      299      +12     
Flag Coverage Δ
Linux 15.46% <58.13%> (+0.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@patelspratik patelspratik merged commit 8bdb6f9 into main Mar 4, 2026
11 checks passed
@patelspratik patelspratik deleted the BRE2-763-revoke branch March 4, 2026 20:46
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