1593 Commits

Author SHA1 Message Date
github-actions[bot] 68db890456 Version Packages (next) 2026-05-26 15:26:38 +00:00
github-actions[bot] b97fcb0a93 Version Packages 2026-05-19 18:28:24 +00:00
benjdlambert 3f5e7ec2b4 Improve MCP safeStringify, OIDC error messages, and catalog model reference config
Signed-off-by: benjdlambert <ben@blam.sh>
2026-05-19 19:27:45 +02:00
Fredrik Adelöw a29edc58fb Merge pull request #34267 from backstage/freben/describe-each-databases
tests: use describe.each for database test iteration
2026-05-19 10:24:00 +02:00
Ben Lambert 29d398b57c fix(auth-backend): harden default allowed patterns for CIMD and DCR (#34260)
* fix(auth-backend): harden default allowed patterns for CIMD and DCR

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

* address PR review feedback for OIDC defaults

- narrow CLI client ID pattern to exact cli.json path
- add BREAKING prefix to changeset
- add IPv6 [::1] to docs examples
- add loopback redirect URI tests for IPv6 and 127.0.0.1

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

* remove dead ['*'] fallback when features are disabled

The restrictive defaults are now always used regardless of the enabled
flag, since the patterns are only consulted on code paths that require
the feature to be enabled.

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

* add default pattern tests and fix docs cli example

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

* use URL constructor for CLI client ID

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

* use string templating for cliClientId to match OidcRouter

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

* fix docs: remove misleading CLI client_id URL example

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

---------

Signed-off-by: benjdlambert <ben@blam.sh>
2026-05-19 09:45:31 +02:00
Patrik Oldsberg 5f14aba359 Merge pull request #34285 from backstage/rugvip/cimd-metadata-size-cap
auth-backend: cap CIMD metadata response size
2026-05-18 17:53:32 +02:00
Patrik Oldsberg 9f269d73ed auth-backend: cap CIMD metadata response size
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 16:38:46 +02:00
Patrik Oldsberg 735af6c8c0 Merge pull request #34142 from backstage/session/suspicious-heron-9w2p
feat(auth-backend): validate catalog user existence on refresh token usage
2026-05-18 11:17:21 +02:00
Fredrik Adelöw 8165184fba tests: use describe.each for database test iteration
Refactors all test files that use TestDatabases/TestCaches with
it.each(databases.eachSupportedId()) to instead use describe.each at
the outer level. This ensures that all tests for one database engine
complete before moving to the next, rather than interleaving engines
across individual tests. This reduces the number of concurrent database
connections and should help with test timeout issues in CI.

The TestDatabases.create() call is hoisted to module scope so the
describe.each can iterate over supported IDs at the top level.

40 files changed across packages/backend-defaults,
packages/backend-test-utils, and multiple plugins.

Signed-off-by: Fredrik Adelöw <freben@gmail.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-05-15 20:27:43 +02:00
github-actions[bot] 42a2f56e61 Version Packages (next) 2026-05-12 18:28:01 +00:00
MT Lewis ed4ffaa3b3 fix(auth-backend): default catalog presence check to on, rename config
Address review feedback: flip the catalog user existence check to
enabled by default and rename the config option to
`dangerouslyDisableCatalogPresenceCheck` as an escape hatch. Also use
`error.name` instead of `instanceof` for cross-realm error safety.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
2026-05-07 16:52:13 +01:00
Andre Wanlin fe697792c5 Merge pull request #34105 from awanlin/topic/non-breaking-typos
Fixes for non-breaking typos and typos configuration
2026-05-06 13:44:11 -05:00
MT Lewis 27f24a9a0f feat(auth-backend): validate catalog user existence on refresh token usage
Add `experimentalRefreshToken.validateCatalogUserExistence` config option
that checks whether the user's catalog entity still exists before issuing
a new access token during refresh. If the user has been removed from the
catalog (e.g. offboarded), the refresh is rejected and the session is
revoked. Transient catalog errors reject the refresh but preserve the
session for retry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
2026-05-06 18:10:41 +01:00
Fredrik Adelöw a590d4ad96 Merge pull request #34130 from backstage/codex/turtle395-improve-mcp-auth-dialog
Show MCP client metadata in auth consent dialog
2026-05-06 14:56:34 +03:00
djamaile 4f62755eed feat(auth): TURTLE-395: show MCP client metadata
Signed-off-by: djamaile <rdjamaile@gail.com>
2026-05-06 11:19:17 +02:00
Andre Wanlin 2f33a9f63f Fixes for non-breaking typos and typos configuration
Signed-off-by: Andre Wanlin <awanlin@spotify.com>

More

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
2026-04-29 16:54:05 -05:00
github-actions[bot] 7295193bb6 Version Packages (next) 2026-04-28 15:53:09 +00:00
Fredrik Adelöw e9b78e9698 Remove uuid dependency in favor of crypto.randomUUID()
The uuid package dropped its CommonJS entry point in v14, making it
incompatible with Backstage's CJS build output and Jest test runner.
Rather than working around the ESM-only issue, replace all usage with
the built-in crypto.randomUUID() which has been available in Node.js
since v16.7 and in all major browsers since March 2022.

Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Made-with: Cursor
2026-04-23 10:51:43 +02:00
github-actions[bot] 1cc86bee1c Version Packages (next) 2026-04-21 15:07:43 +00:00
github-actions[bot] 93e643d142 Version Packages 2026-04-14 14:57:31 +00:00
Patrik Oldsberg c9212bf4ce auth-backend: remove unused isCimdUrl function (#33882)
The function was a thin wrapper around validateCimdUrl that caught errors
and returned a boolean. It was never imported by any production code —
only by test files. Tests now use validateCimdUrl directly.


Made-with: Cursor

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-04-13 23:43:26 +02:00
github-actions[bot] 6c10d88c13 Version Packages (next) 2026-04-07 15:30:58 +00:00
Patrik Oldsberg b2319ffe45 errors: add toError utility and migrate assertError usages
Add a `toError` utility function to `@backstage/errors` that converts
unknown values to `ErrorLike` objects. If the value is already error-like
it is returned as-is. Strings are used directly as the error message, and
other values are stringified with a fallback to JSON.stringify to avoid
unhelpful `[object Object]` messages.

Non-error causes passed to `CustomErrorBase` are now converted and stored
using `toError` rather than discarded. Existing `assertError` call sites
across the codebase are migrated to `toError`.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-03 10:16:23 +02:00
github-actions[bot] a2cb332e25 Version Packages (next) 2026-03-31 15:30:51 +00:00
github-actions[bot] c1b510cabb Version Packages (next) 2026-03-24 14:54:00 +00:00
Ben Lambert 2e753eefb6 fix(auth-backend): allow any port for loopback redirect URIs per RFC 8252 (#33508)
For CIMD clients using loopback redirect URIs (localhost/127.0.0.1),
match by scheme, hostname, and path only, ignoring the port. Native
CLI apps like Claude Code use ephemeral ports for OAuth callbacks.

Signed-off-by: benjdlambert <ben@blam.sh>
2026-03-21 23:19:38 +00:00
Fredrik Adelöw d7c67cddf5 switch omitIdentityTokenOwnershipClaim to true
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-03-18 22:10:50 +01:00
github-actions[bot] 5725b5fcfa Version Packages 2026-03-17 21:39:07 +00:00
Fredrik Adelöw 4919273bea chore: align auth-backend zod version range with rest of repo
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-03-17 16:52:00 +01:00
Gabriel Dugny ffaded0b30 chore: lint & changeset
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-03-17 16:48:43 +01:00
Gabriel Dugny 49171c9de4 chore: Update all imports to zod/v3
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-03-17 16:48:42 +01:00
Patrik Oldsberg aba94d2b27 Merge pull request #33385 from drodil/auth_mem_leaks
fix(auth): memory leaks
2026-03-17 11:03:20 +01:00
Hellgren Heikki 634ededdc9 fix(auth): memory leaks
alb-provider: JWT verification block was wrapped in generic error
that turned 401 to 500 causing clients to retry the login

cimd: cimd clients are not registered in oidc_clients table
so inserting offline sessions for them violates the foreign key
constraint. dropping the fk.

offline: return access token even when refresh token issuing fails.
if the refresh token issue fails for some reason, it will return
500 which will then cause client to retry even it can get valid
access token without refresh token.

closes #33329
Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
2026-03-17 10:52:40 +02:00
benjdlambert 26b5f7a5f9 chore: fix main build
Signed-off-by: benjdlambert <ben@blam.sh>
2026-03-11 13:41:01 +01:00
Ben Lambert e9b6e978f1 Merge commit from fork
* fix: prevent SSRF via redirect in CIMD metadata fetch

* fix: prevent SSRF via redirect in CIMD metadata fetch

* fix: add redirect target listener to SSRF redirect test
2026-03-11 13:34:25 +01:00
Ben Lambert 0f9d673e82 Merge commit from fork
* Fix redirect URI allowlist bypass via URL userinfo syntax

* Validate redirect URIs against normalized origin+pathname
2026-03-11 13:33:00 +01:00
github-actions[bot] ed7c4e3bef Version Packages (next) 2026-03-10 17:34:12 +00:00
Ben Lambert d0f4cd215b feat(cli): add auth commands for OIDC login (#32920)
* feat(cli): add auth commands for OIDC login

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

* address PR review feedback

- move CIMD check before callback server start
- add try/finally for callback server cleanup
- validate URLs with human-readable errors
- deduplicate config URL candidates
- preserve selected flag on re-authentication
- delete accessToken on logout
- log token refresh to stderr in show command
- fix command descriptions to reference CIMD not DCR
- type keytar as optionalDependency, rename storage paths
- add auth-backend changeset

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

* migrate auth module from yargs to cleye pattern

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

* address PR review feedback

- consolidate storage imports in auth.ts
- add withMetadataLock to setSelectedInstance
- skip file permission tests on Windows
- clarify changeset endpoint path

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

* address review feedback from Rugvip and Copilot

- use stdout for user-facing messages instead of stderr
- remove clientSecret remnants from logout
- make refresh_token optional in token response schema
- add timeout to CIMD metadata fetch
- pass same state to callback server and authorize URL
- remove inaccurate test comment

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

* validate state in callback server, add CIMD endpoint tests

- localServer now validates the OAuth state parameter in the request
  handler and returns 400 on mismatch
- Added tests for the CIMD metadata endpoint in OidcRouter covering
  both disabled and enabled cases

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

* revert validateRequest to use Zod error details

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

* fix callback server hanging by closing keep-alive connections

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

* rename secret store service prefix to backstage-cli:auth-instance

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

---------

Signed-off-by: benjdlambert <ben@blam.sh>
2026-03-10 13:28:25 +00:00
github-actions[bot] db0d171511 Version Packages (next) 2026-03-03 14:16:49 +00:00
Ben Lambert 1ccad86e35 feat(auth-backend): add who-am-i action to actions registry (#33046)
Signed-off-by: benjdlambert <ben@blam.sh>
2026-02-28 10:08:46 +01:00
github-actions[bot] 4bd6a3a1af Version Packages (next) 2026-02-24 19:24:06 +00:00
Fredrik Adelöw 619be54133 auth: got rid of the sql report warnings
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2026-02-22 14:52:48 +01:00
dependabot[bot] 6738cf0842 build(deps): bump minimatch from 9.0.5 to 10.2.1 (#32915)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 9.0.5 to 10.2.1.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v9.0.5...v10.2.1)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 10.2.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-19 08:58:00 +01:00
Patrik Oldsberg 9506f2af73 auth-backend: correct changelog
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-17 20:49:55 +01:00
Patrik Oldsberg c4d19ed1b6 Merge pull request #32796 from backstage/changeset-release/master
Version Packages
2026-02-17 18:50:32 +01:00
benjdlambert 7dc3dfe5cb Revert configurable DCR token expiration (#31278)
Signed-off-by: benjdlambert <ben@blam.sh>
2026-02-17 17:07:24 +01:00
github-actions[bot] e6df5d52ce Version Packages 2026-02-17 16:06:18 +00:00
Ben Lambert 31de2c9b3a feat(auth-backend): add experimental CIMD support (#32307)
Signed-off-by: benjdlambert <ben@blam.sh>
2026-02-17 17:00:49 +01:00
github-actions[bot] 7c41134684 Version Packages (next) 2026-02-10 16:14:59 +00:00
Ben Lambert d0786b968e auth-backend: add experimental refresh token support (#32695)
* auth-backend: add experimental refresh token support

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

* auth-backend: refresh token review fixes

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

* auth-backend: address PR review feedback for refresh tokens

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

---------

Signed-off-by: benjdlambert <ben@blam.sh>
2026-02-10 17:00:51 +01:00