Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix(batch-changes): remove leading and trailing spaces from batch changes credentials#63517

Merged
BolajiOlajide merged 2 commits into
mainfrom
bo/trim-credentials-batch-changes
Jun 27, 2024
Merged

fix(batch-changes): remove leading and trailing spaces from batch changes credentials#63517
BolajiOlajide merged 2 commits into
mainfrom
bo/trim-credentials-batch-changes

Conversation

@BolajiOlajide

Copy link
Copy Markdown
Contributor

@jamesmcnamara reported a number of 401s when using a PAT that had access to the repositories affected by a Batch Change. I spent some hours looking into this and was amazed by what I found.

That error was happening because there was a leading whitespace in the token in 1password and apparently the github credential validator doesn't care about whitespaces however when this token is being used to push a change, it becomes a problem because the URL now looks like this:

https://%20ghp_....@github.com/sourcegraph-testing/markdowns

And that's what was calling your failing batch changes with the devx token. I'll push a fix to correct this.

Test plan

  • Manual testing
  • Added a credential with whitespaces and confirmed that the spaces were correctly removed.

Changelog

  • Whitespaces in Batch Changes credentials are trimmed before being saved to the database, this prevents 401 errors when using the token to construct an authenticated push URL.

@BolajiOlajide BolajiOlajide requested a review from a team June 27, 2024 12:51
@BolajiOlajide BolajiOlajide self-assigned this Jun 27, 2024
@cla-bot cla-bot Bot added the cla-signed label Jun 27, 2024
@BolajiOlajide BolajiOlajide changed the title update fix(batch-changes): remove leading and trailing spaces from batch changes credentials Jun 27, 2024
@burmudar

Copy link
Copy Markdown
Contributor

Good catch!

@BolajiOlajide BolajiOlajide merged commit 8e2c34c into main Jun 27, 2024
@BolajiOlajide BolajiOlajide deleted the bo/trim-credentials-batch-changes branch June 27, 2024 15:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants