350 Commits

Author SHA1 Message Date
Fredrik Adelöw 843f71caf4 fix: adapt tests for Azure SDK upgrade to ESM-style exports
The Azure SDK monorepo upgrade (storage-blob 12.26→12.31, identity
4.5→4.9) adds "type": "module" to package.json, making jest.mock()
unable to intercept imports from production code.

- AzureBlobStorageUrlReader: accept createContainerClient as an
  optional dependency, letting tests pass a mock directly instead
  of trying to mock the @azure/storage-blob module
- AzureUrlReader: provide PAT credentials in all test cases so
  DefaultAzureCredential is never instantiated — the Bearer auth
  flow is already covered by the integration package's own tests
- DefaultAzureDevOpsCredentialsProvider: use expect.any() for
  mock instance comparison instead of new DefaultAzureCredential()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-05-26 17:18:31 +02:00
Andre Wanlin a07e6a31a4 Typos CLI - initial config and changes
Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed test typos

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed docs typos

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed code comment typos

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed remaining typos

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Added CI and Config

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed typo, lol

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixes and update API reports

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated test

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Minor corrections

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Removed changesets

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Refactor to make changes non-breaking

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Clean up of new typos

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Use typoed over typo'd

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Added typoed

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated API Reports

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Feedback improvement

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Refinements

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Simplify based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Reverted to handle both keys

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2026-05-19 07:38:06 -05:00
Fredrik Adelöw da5ba4eecd Handle non-numeric Retry-After header values gracefully
Validate the parsed Retry-After value is a finite positive number before
using it as a delay, falling back to exponential backoff otherwise. This
prevents a near-zero delay tight retry loop when the header contains an
HTTP-date or unexpected value.

Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-04 15:12:02 +02:00
Fredrik Adelöw dd78c9cffa defer fetch lookup so test interceptors apply
Capturing globalThis.fetch as a value at construction time meant the
GitLabUrlReader tests bypassed the MSW fetch interceptor and hit the
real gitlab.com (returning 401). Wrapping the call resolves fetch at
invocation time so the patched fetch is used.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-05-04 14:01:43 +02:00
Fredrik Adelöw 1500fe31b4 restructure retry loop to remove parallel response/error variables
Each catch path now decides for itself whether to rethrow or sleep and
continue, so the loop body has a definite Response after the try/catch
and there is no shared `error: unknown` slot that could in principle be
thrown unset. Pulls the exponential delay into a tiny local helper to
share between the two retry paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-05-04 11:28:29 +02:00
Fredrik Adelöw d7f994308e drop non-null assertion in retry loop
Flip the order of the response/error check so TypeScript narrows the
types itself rather than relying on `response!` to assert what the code
already guarantees by construction.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-05-04 11:17:51 +02:00
Fredrik Adelöw 90d3968e6c address review comments
- Cancel discarded response bodies before retrying so the underlying
  connection can be returned to the pool instead of being held open
  until the response is garbage collected.
- Stop asserting on the rejected error message in the network-error
  retry test; track rejection via a flag so the test isn't tied to
  fetch/MSW error strings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-05-04 11:01:41 +02:00
Fredrik Adelöw 6b112d3fe8 fix(integration): correct GitLab fetch mode and retry on network errors
Removes a misplaced `mode: 'same-origin'` option that would have rejected
cross-origin requests when the integration is used from a browser, and
extends the retry wrapper so transient network errors are retried using
the configured `maxRetries`. Caller-initiated aborts still propagate
immediately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-05-04 10:43:49 +02:00
Patrik Oldsberg 191b41a0b3 integration: remove unnecessary exports from internal helpers
Remove `export` from five internal helper functions that are not part of
the published API and are only used within their own files. The `sleep`
function in GitLabIntegration is kept exported for test access but marked
as `@internal`.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-20 16:49:21 +02:00
Patrik Oldsberg 047a2175e3 integration: use registerMswTestHooks from backend-test-utils
Removed the test-only `registerMswTestHooks` function from `helpers.ts`
and replaced it with the shared version from `@backstage/backend-test-utils`.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-14 14:20:01 +02:00
Vincenzo Scamporlino d96b7281dc Make owner parameter optional in getAppToken and getInstallationCredentials methods
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2026-03-30 21:59:27 +02:00
Vincenzo Scamporlino d1124998ca Fix SingleInstanceGithubCredentialsProvider to return app credentials for bare host URLs
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2026-03-30 21:35:40 +02:00
Ben Lambert 1513a0b132 Merge commit from fork
* Reject path traversal in SCM URL filepath parsing

* Harden parseGitUrlSafe against encoding bypass variants
2026-03-04 07:28:36 +01:00
Andre Wanlin 120d425326 Fixed failing tests
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2026-02-27 12:50:03 -06:00
Andre Wanlin d8116c463d Latest feedback
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2026-02-27 12:50:03 -06:00
Andre Wanlin 5da7c6c5c2 Add check for removed config
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2026-02-27 12:50:02 -06:00
Andre Wanlin 527cf88a90 Integration - Removed long deprecated code
Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed lock file

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Improve changesets

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Removed link

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Update .changeset/sharp-ravens-shop.md

Co-authored-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com>
Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>

Update .changeset/six-trees-carry.md

Co-authored-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com>
Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>

Update .changeset/tiny-zoos-smash.md

Co-authored-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com>
Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>

Corrected gerrit changes based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated API report

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed some tests

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed test

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed another test

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Removed parseGerritGitilesUrl

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Table clean up

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Remove from changeset

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Changes based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2026-02-27 12:50:00 -06:00
Johannes Will d933f6257f feat: use gitlab integration with throttled fetch
Signed-off-by: Johannes Will <17289602+JohannesWill@users.noreply.github.com>
2026-02-16 16:14:22 +01:00
Andre Wanlin cc6206e436 Added support for {org}.visualstudio.com domains used by Azure DevOps
Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Address CodeQL comments

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Another correction

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Fixed casing

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Adjusted to be more secure based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Tighten up endsWith

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Corrections to TSDoc comment

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Changes based on feedback

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Correct URL for discovery

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated docs

Signed-off-by: Andre Wanlin <awanlin@spotify.com>

Updated changeset

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2026-02-05 13:28:26 -06:00
Patrik Oldsberg f9d2fa6d1b Merge pull request #31682 from GDivino/feature/25324/add-git-tag
Feature: add git tag to AzureUrl class
2026-02-02 19:19:05 +01:00
Fredrik Adelöw 7455dae884 require the use of node prefix on native imports
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-01-26 13:22:53 +01:00
Fredrik Adelöw 17e33e683d fix tests
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-01-05 11:30:06 +01:00
Ben Lambert 3afeab42a0 feat(integrations): Add googleGcs to ScmIntegrations and implement readTree for the UrlReader (#31998)
* feat: implementing google gcs read tree and scm integrations

Signed-off-by: benjdlambert <ben@blam.sh>

* feat: added changesets

Signed-off-by: benjdlambert <ben@blam.sh>

* chore: cleanup
Signed-off-by: benjdlambert <ben@blam.sh>

Signed-off-by: benjdlambert <ben@blam.sh>

* chore: fix test issues

Signed-off-by: benjdlambert <ben@blam.sh>

* chore: fix code review comments
Signed-off-by: benjdlambert <ben@blam.sh>

* chore: fix code review comments

Signed-off-by: benjdlambert <ben@blam.sh>

---------

Signed-off-by: benjdlambert <ben@blam.sh>
2025-12-30 14:20:23 +01:00
Ben Lambert 9083273931 Revert "fix: making the github urls case insensitive" (#32220)
Signed-off-by: benjdlambert <ben@blam.sh>
2025-12-29 14:11:46 +01:00
Gio Divino faab29a014 feat: add getPrefix function and more tests
Signed-off-by: Gio Divino <giodivino.tech@gmail.com>
2025-12-17 14:27:00 +08:00
Gio Divino 6999f6df21 feat: add git tag to AzureUrl class
Signed-off-by: Gio Divino <giodivino.tech@gmail.com>
2025-12-17 14:27:00 +08:00
Jake Smith 1956b3f398 Remove cachekey logic, not needed as only a single bitbucket connection is supported, rework tests and update api report
Signed-off-by: Jake Smith <jakemgsmith@gmail.com>
2025-12-16 10:20:57 +01:00
Jake Smith 959e6ecc5a Add Bitbucket Cloud OAuth support
Signed-off-by: Jake Smith <jakemgsmith@gmail.com>
2025-12-16 10:20:57 +01:00
Johan Persson cd0b8a11a3 chore: make jest a peer dependency with v29/v30 support
Move jest from dependencies to peer dependencies, allowing users to
choose between Jest 29 and Jest 30.

The CLI now detects the Jest version at runtime and uses the
appropriate environment:
- Jest 29: Uses standard jest-environment-jsdom
- Jest 30: Uses a custom environment based on @jest/environment-jsdom-abstract
  with fixes for Web API globals (fetch, streams, Error, etc.)

The cross-fetch polyfill is only injected for Jest 29, as with Jest 30+
our patched Jest environment is used. The network request blocker is made
MSW-compatible by checking if fetch was wrapped before blocking.

Jest 30 (with jsdom v27) fixes `Could not parse CSS stylesheet`
warnings/errors when testing components from @backstage/ui or other
packages using CSS `@layer` declarations.

New peer dependencies (install based on your Jest version):
- jest (required, ^29 or ^30)
- Jest 29 requires: jest-environment-jsdom
- Jest 30 requires: @jest/environment-jsdom-abstract, jsdom

Production code changes for jsdom 27 testability:
- AppIdentityProxy: extract navigateToUrl method for spying
- LiveReloadAddon: export utils.reloadPage for spying
- collect.ts: export internal.resolvePackagePath for mocking

MockFetchApi: evaluate global.fetch at call time instead of construction
time, allowing MSW to patch fetch after MockFetchApi is constructed.

Test adaptations for jsdom 27:
- Use RGB values instead of named colors in CSS assertions
- Update error format expectations (hyphenated type names, SyntaxError
  instead of FetchError for JSON parse errors)
- Simplify URL error assertions for cross-version compatibility
- Fix accessible name whitespace handling for external links
- Use history.replaceState for location mocking (non-configurable)
- Use fireEvent.blur for contentEditable elements
- Move async assertions inside waitFor for race conditions
- Remove Blob.prototype.text polyfill (now native)
- Remove test case using credentials in plugin:// URLs

Test adaptations for Jest 30:
- Replace `expect.objectContaining([...])` with direct array equality
- Replace `expect.objectContaining({ length: N })` with
  `expect.any(Array)` + separate `toHaveLength()` assertions
- Use child process for native Node.js module resolution in
  collect.test.ts to work around Jest 30's resolver behavior
- Update snapshot headers for new Jest format

Also removes the jest-haste-map patch which is no longer needed.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
2025-12-11 18:06:55 +01:00
benjdlambert f2b7585824 feat: support marking a github app as a public token generator
Signed-off-by: benjdlambert <ben@blam.sh>
2025-12-11 09:33:46 +01:00
Ben Lambert 4cd620f5cc Merge pull request #31754 from mrlunchbox777/fix-case-sensitive-github-url
fix: making the github urls case insensitive
2025-11-25 10:40:47 +01:00
Andre Wanlin 70d394f307 Fixed more tests
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2025-11-17 15:52:29 -06:00
Andre Wanlin 9246b57e86 Fixed config logic
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2025-11-17 14:31:48 -06:00
Andre Wanlin fa255f530a Bitbucket Cloud - API Token Support
Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2025-11-17 12:49:43 -06:00
Andrew Shoell e15fdae80f fix: making the github urls case insensitive
Signed-off-by: Andrew Shoell <mrlunchbox777@gmail.com>
2025-11-13 15:40:56 -05:00
Paul Schultz 05f60e1e0a refactor: convert constructor parameter properties for erasableSyntaxOnly compatibility
Signed-off-by: Paul Schultz <pschultz@pobox.com>
2025-10-14 08:29:21 -05:00
Lee Standen 56897d717e Fixes issue with organization name case sensitivity when using allowedInstallationOwners
Signed-off-by: Lee Standen <lee.standen@ironcladhq.com>
2025-09-10 15:57:16 -07:00
Benjamin Janssens 94e8ade615 Merge branch 'master' into catalog/github-app-discovery
Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
2025-08-14 14:27:40 +02:00
Ben Lambert 577c91f109 Merge pull request #30170 from CptnFizzbin/fix-gitlab-get-projectid
Fix(Integration - GitLab): use authorization header for GitLab requests
2025-06-24 09:50:02 +02:00
Cptn Fizzbin e0189b811d Fix authorization header for GitLab requests
Signed-off-by: Cptn Fizzbin <code@cptnfizzbin.ca>
2025-06-06 10:36:29 -04:00
ElaineDeMattosSilvaB 9afe2702ab fix: pass OAuth token explicitly to avoid config token overwrite
Signed-off-by: ElaineDeMattosSilvaB <elaine.de-mattos-silva-bezerra@deutschebahn.com>
2025-06-03 16:06:54 +02:00
Fredrik Adelöw 9e6af578c0 Merge pull request #28437 from sanderaernouts/users/saernouts/client-assertion-credential
Added support for federated credentials using a managed identity (to generate the client assertion)
2025-05-08 17:00:58 +02:00
Benjamin Janssens 7810e8d998 feat(catalog): implement discovery by GitHub app
Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
2025-05-08 16:34:55 +02:00
Andre Wanlin 145d4c5ad3 Merge pull request #28543 from leboncoin/feat-integration-gerrit-edit-mode
feat(integration): add edit url mode for Gerrit integration
2025-05-02 13:52:45 -05:00
Cptn Fizzbin 36f77e935c pass user provided token through to gitlab url resolvers
Signed-off-by: Cptn Fizzbin <code@cptnfizzbin.ca>
2025-04-23 10:03:01 -04:00
Andy LADJADJ 74c924dcfb Merge branch 'master' into feat-integration-gerrit-edit-mode 2025-04-11 17:07:09 +02:00
djamaile 9768992a4e fix: mark github webhookSecret as optional
Signed-off-by: djamaile <rdjamaile@gmail.com>
2025-03-26 11:22:53 +01:00
Andy LADJADJ f687ad4cbd chore: update config definition
Signed-off-by: Andy LADJADJ <andy.ladjadj@adevinta.com>
2025-03-24 16:41:28 +01:00
Andy LADJADJ f56ee49904 chore: activate gerrit editURL by default
Signed-off-by: Andy LADJADJ <andy.ladjadj@adevinta.com>
2025-03-24 15:25:13 +01:00
Sander Aernouts d945206377 feat(azure): support managed identity federated credentials
Signed-off-by: Sander Aernouts <sander.aernouts@gmail.com>
2025-03-24 14:42:04 +01:00