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

[Backport 5.1] fix Bitbucket Cloud exclude regex to make it work with AJV.#54496

Merged
BolajiOlajide merged 2 commits into
5.1from
backport-54494-to-5.1
Jul 3, 2023
Merged

[Backport 5.1] fix Bitbucket Cloud exclude regex to make it work with AJV.#54496
BolajiOlajide merged 2 commits into
5.1from
backport-54494-to-5.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

The problem

The regular expression used in matching the exclusion by UUID in Bitbucket.org (Cloud) code host connection was unsupported by AJV, which was added for validation purposes in https://github.com/sourcegraph/sourcegraph/pull/52012.

The problem surfaced in an ugly way as an uncaught error that prevented the loading of create/edit code host UI for Bitbucket Cloud, which schema contained the invalid regex.

The issue was reported in Slack: https://sourcegraph.slack.com/archives/C05EMJM2SLR/p1688132947851839.

Customer impact

Customers using Bitbucket.org (Cloud) are unable to create new or edit existing code host connections.

What is changed

AJV JSON schema validator treated the escaped - sign as invalid. Removing the escaping from it fixed the problem.

Test plan:
Local sg run and verify that Bitbucket Cloud code hosts can be created and updated using UUID excludes, changes are stored in the DB, and UI validation with AJV works.

Backport 66044a7 from #54494

### The problem
The regular expression used in matching the exclusion by UUID in
Bitbucket.org (Cloud) code host connection was unsupported by
[AJV](https://ajv.js.org/), which was added for validation purposes in
https://github.com/sourcegraph/sourcegraph/pull/52012.

The problem surfaced in an ugly way as an uncaught error that prevented
the loading of create/edit code host UI for Bitbucket Cloud, which
schema contained the invalid regex.

The issue was reported in Slack:
https://sourcegraph.slack.com/archives/C05EMJM2SLR/p1688132947851839.

### Customer impact

Customers using Bitbucket.org (Cloud) are unable to create new or edit
existing code host connections.

### What is changed

AJV JSON schema validator treated the escaped `-` sign as invalid.
Removing the escaping from it fixed the problem.

Test plan:
Local sg run and verify that Bitbucket Cloud code hosts can be created
and updated using UUID excludes, changes are stored in the DB, and UI
validation with AJV works.

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
(cherry picked from commit 66044a7)
@sourcegraph-bot

sourcegraph-bot commented Jun 30, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@mrnugget

mrnugget commented Jul 3, 2023

Copy link
Copy Markdown
Contributor

@sashaostrikov can you make sure the build works?

@sashaostrikov

Copy link
Copy Markdown
Contributor

Hmm, I must have wrongly remembered that it passed, taking a look now

@mrnugget

mrnugget commented Jul 3, 2023

Copy link
Copy Markdown
Contributor

It passed in the original PR, but in this one -- the backport PR -- there seem to be problems with the formatting.

@sourcegraph-bot

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 4a6fa5d...885ac80.

Notify File(s)
@eseliger internal/database/external_services_test.go

@BolajiOlajide BolajiOlajide merged commit 5584671 into 5.1 Jul 3, 2023
@BolajiOlajide BolajiOlajide deleted the backport-54494-to-5.1 branch July 3, 2023 11:49
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.

4 participants