Repository navigation
feat(repo): add the gpg-key and repo collaborator commands - #507
Merged
Merged
Conversation
Gitea returns no user ID of a GPG key, so each test key is marked by a private scratch repository it-run-<time>-gk<key ID>. A GPG key is deleted only when such a marker names its ID: on the test's cleanup, or for a marker older than two hours at the start of a later run, before the stale repository sweep deletes the marker.
Copia does not register GET /user/gpg_key_token, so gpg-key add drops --signature (Lead decision on QUB-1230) and no integration test adds a GPG key. Without one, the key fixture, its marker repositories and its sweep have nothing to guard. This reverts commit 64ada01.
Copia does not register GET /user/gpg_key_token (it answers Go's plain 404 page not found), so a token signature cannot be made. gpg-key add now sends the armored key only, like gh, and Gitea's 404 for a key without a verified email shows a hint to verify that email instead of Gitea's offer to sign the token.
The test adds no key: Copia adds only a key with a verified email of the account, which the tests never read.
ReadAPIMessage reads at most 64 KiB of an error body and cuts the message to 512 bytes on a rune boundary, so a server cannot make copia-cli read or print an error of any size. FetchPages uses it for HTTPError.Message (security review QUB-1261, finding 3).
gpg-key add refused only PRIVATE KEY BLOCK, so an OpenSSH, PKCS#8, RSA or legacy PGP secret key passed. cmdutil.CheckArmor is an allowlist: every armor header must be the public key header, a header naming PRIVATE or SECRET is refused as a private key. A server message that holds 16 bytes in a row of the key material, compared without white space, is left out of the error (security review QUB-1261, findings 1 and 2).
chore(epic): bring Go 1.27.4 from develop into epic/481-keys-and-access
feat(gpg-key): add gpg-key list and add
feat(gpg-key): add gpg-key delete
Copia answers GET /repos/{owner}/{repo}/collaborators/{login}/permission
with a plain-text 404, so the list shows LOGIN and NAME only and --json
takes login and full_name. The integration test checks that the account
is listed after add -p read, without the permission-route probe.
Refs #486
…-list-add feat(repo): add repo collaborator list and add
Check GET /repos/{owner}/{repo}/collaborators/{login} first, since Gitea
answers 204 to a delete of a non-collaborator, then DELETE it. --yes is
required and checked before anything else.
Closes #50
…remove feat(repo): add repo collaborator remove
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Epic E3 Keys and access (planning issue QUB-969): add the
gpg-keyandrepo collaboratorcommands, each proven against live Copia, and record indocs/parity.mdwhygh ssh-keyandgh repo deploy-keyhave no Copia counterpart.New commands:
gpg-key list(aliasls),gpg-key add [<key-file>],gpg-key delete <key-id> --yes, as in gh.addsends an armored public key only: content with any other-----BEGINheader (a private or secret key, a signature, an SSH key) is refused before any request, and a server message that quotes the key is withheld.--signatureis left out: Copia does not registerGET /user/gpg_key_token, so only a key with a verified account email can be added.repo collaborator list(aliasls),repo collaborator add <login> [-p/--permission read|write|admin](defaultwrite),repo collaborator remove <login> --yes; gh has no such commands.Other changes:
pkg/cmdutil:CheckArmor(public key allowlist) andReadAPIMessage(error body read bounded to 64 KiB, message cut to 512 bytes).docs/parity.mdlistsgh ssh-keyandgh repo deploy-keyas None on Copia: app.copia.io answersPOST /user/keyswith 422SSH is disabled.gpg-key listand a delete of a random key ID against live Copia (no test adds a GPG key to the account); the collaborator test adds the test account itself to the run repository, lists it and removes it. All under the no-account-data guard.Slice PRs (merged into the epic, in merge order)
Not in this epic:
ssh-keyandrepo deploy-key(Copia has SSH disabled); PR #487 was closed unmerged, #481, #47, #484 and #485 were closed as not planned.Checklist
docs/parity.md,CLAUDE.mdand the docs sidebar updated in the slicesgo test ./...andgolangci-lint run ./...on the epic head (see the review on the Paperclip issue)The slice issues below were closed by hand when their slice merged into the epic; the lines keep the record.
Closes #482
Closes #483
Closes #486
Closes #50