Sourcegraph - Update AccessToken schema - #593
Conversation
scottisloud
left a comment
There was a problem hiding this comment.
Thanks for updating the Sourcegraph plugin schema and for the detailed manual test steps — the URL updates and making Endpoint required look right for how src authenticates today.
A few things I'd like to see before we merge, non-blocking, but ideally polish up if you deem it worthwhile:
- Token charset: Sourcegraph access tokens are hex-based and often include uppercase
A–F(for examplesgp_AaD80dc6E02eCAE1_d3cba16CC0F18fA14A2EFB61CbDFceEBf9fAD16b). The token field composition should includeUppercase: truein the charset, similar toplugins/github/personal_access_token.go. - Token length:
Length: 60doesn't match the current v3 format (sgp_{16hex}_{40hex}, 61 characters total). Legacy tokens (sgp_{40hex}) are shorter. I'd drop the fixed length and rely onPrefix: "sgp_"plus the hex charset, or pick a length that matches the format you're targeting. - Tests:
access_token_test.gostill uses a pre-sgp_fixture. Please update the test token to a realisticsgp_-prefixed value so the tests match the schema.
nit: spacing in AlternativeNames: []string{"Website","URL"} for gofmt.
Could you also confirm make sourcegraph/validate and go test ./plugins/sourcegraph/... pass locally? I only see the signed-commits check on the PR so far.
Happy to take another look after those updates/you indicate no intent to make those optional updates.
(forgot to do this as a proper Review the first time 🤦 )
- Add Uppercase to token charset (tokens are hex, can include A-F) - Drop fixed Length: 60; rely on sgp_ prefix + charset (v3 tokens are 61 chars, legacy tokens shorter) - Update test fixtures to realistic sgp_-prefixed v3-format token - Fix gofmt spacing Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a02ae6-d30c-77eb-a4f8-de0711282a78
|
@scottisloud the ManagementURL hardcoded in the plugin schema is more distracting than useful. Can we set the value based on the user's I've filed issue #661 for this. |
|
Hey @scottisloud,
Yes they do. |
Overview
sgp_v3 token format supportA-FType of change
Related Issue(s)
How To Test
op plugin init srcLocate your Sourcegraph Access Token:Import into 1Password...Enter or paste in the value of the Endpoint: Paste inhttps://sourcegraph.comEnter or paste in the value of the Token: Paste in the access token created earliersrc loginEntry created in 1Password desktop app:

Changelog
The Sourcegraph plugin now supports the current
sgp_access token format, and the Endpoint field is required since each token is tied to a specific endpoint.