Merge remote-tracking branch 'refs/remotes/origin/master' into scaffolder-stepper-analytics-2

This commit is contained in:
bnechyporenko
2024-04-30 08:44:03 +02:00
21 changed files with 58 additions and 32 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-app-api': patch
---
Remove explicit `alg` check for user tokens in `verifyToken`
+1 -1
View File
@@ -4,7 +4,7 @@ author: Simply Business
authorUrl: https://github.com/simplybusiness/
category: Monitoring
description: Access Airbrake error monitoring and other integrations from within Backstage
documentation: https://github.com/backstage/backstage/blob/master/plugins/airbrake
documentation: https://github.com/backstage/community-plugins/tree/main/workspaces/airbrake/plugins/airbrake
iconUrl: https://wp-assets.airbrake.io/wp-content/uploads/2020/10/05222904/Square-white-A-on-Orange.png
npmPackageName: '@backstage/plugin-airbrake'
addedDate: '2022-01-10'
@@ -4,7 +4,7 @@ author: Spotify
authorUrl: https://github.com/spotify
category: Monitoring
description: Track usage of your Backstage instance using Google Analytics.
documentation: https://github.com/backstage/backstage/blob/master/plugins/analytics-module-ga/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/analytics/plugins/analytics-module-ga/README.md
iconUrl: /img/ga-icon.png
npmPackageName: '@backstage/plugin-analytics-module-ga'
addedDate: '2021-10-07'
+1 -1
View File
@@ -4,7 +4,7 @@ author: unredundant
authorUrl: https://github.com/unredundant
category: Debugging
description: Integrates Apollo Explorer graphs as a tool to browse GraphQL API endpoints inside Backstage.
documentation: https://github.com/backstage/backstage/blob/master/plugins/apollo-explorer/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/apollo-explorer/plugins/apollo-explorer/README.md
iconUrl: /img/apollo-explorer.png
npmPackageName: '@backstage/plugin-apollo-explorer'
addedDate: '2022-07-20'
+1 -1
View File
@@ -4,7 +4,7 @@ author: Keyloop
authorUrl: https://keyloop.com/
category: CI/CD
description: Easily view your Azure Pipelines within the Software Catalog
documentation: https://github.com/backstage/backstage/blob/master/plugins/azure-devops/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/azure-devops/plugins/azure-devops/README.md
iconUrl: /img/azure-pipelines.svg
npmPackageName: '@backstage/plugin-azure-devops'
addedDate: '2021-12-22'
+1 -1
View File
@@ -4,7 +4,7 @@ author: Andreas Stenius
authorUrl: https://github.com/backstage/community
category: Discovery
description: The badges plugin offers a set of badges that can be used outside of Backstage, showing information related to data from the catalog.
documentation: https://github.com/backstage/backstage/blob/master/plugins/badges/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/badges/plugins/badges/README.md
iconUrl: /img/badges.svg
npmPackageName: '@backstage/plugin-badges'
addedDate: '2021-09-29'
+1 -1
View File
@@ -3,7 +3,7 @@ author: Axis Communications AB
authorUrl: https://www.axis.com
category: Discovery
description: A marketplace where engineers can propose projects suitable for inner sourcing
documentation: https://github.com/backstage/backstage/blob/master/plugins/bazaar/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/bazaar/plugins/bazaar/README.md
iconUrl: /img/bazaar.svg
npmPackageName: '@backstage/plugin-bazaar'
addedDate: '2022-01-11'
+1 -1
View File
@@ -4,7 +4,7 @@ author: SDA SE
authorUrl: https://sda.se/
category: CI/CD
description: View Bitrise builds and download the build artifacts within Backstage.
documentation: https://github.com/backstage/backstage/blob/master/plugins/bitrise/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/bitrise/plugins/bitrise/README.md
iconUrl: https://avatars.githubusercontent.com/u/7174390?s=400&v=4
npmPackageName: '@backstage/plugin-bitrise'
addedDate: '2021-03-01'
+2 -2
View File
@@ -4,7 +4,7 @@ author: FireHydrant
authorUrl: https://firehydrant.io/
category: Monitoring
description: View service incidents information from FireHydrant, such as active incidents and incident metrics, directly within Backstage.
documentation: https://github.com/backstage/backstage/blob/master/plugins/firehydrant/README.md
iconUrl: https://raw.githubusercontent.com/backstage/backstage/master/plugins/firehydrant/doc/firehydrant_logo.png
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/firehydrant/plugins/firehydrant/README.md
iconUrl: https://github.com/backstage/community-plugins/blob/main/workspaces/firehydrant/plugins/firehydrant/doc/firehydrant_logo.png
npmPackageName: '@backstage/plugin-firehydrant'
addedDate: '2021-08-18'
+1 -1
View File
@@ -4,7 +4,7 @@ author: SDA SE
authorUrl: https://sda.se/
category: Quality
description: View FOSSA license compliance of your components in Backstage.
documentation: https://github.com/backstage/backstage/blob/master/plugins/fossa/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/fossa/plugins/fossa/README.md
iconUrl: https://avatars0.githubusercontent.com/u/9543448?s=400&v=4
npmPackageName: '@backstage/plugin-fossa'
addedDate: '2020-12-10'
@@ -5,7 +5,7 @@ authorUrl: https://github.com/adityasinghal26
category: Development
description: Integrates GitHub Codespaces for a Backstage component with the Authenticated User.
documentation: https://github.com/adityasinghal26/backstage-plugins/tree/main/plugins/github-codespaces
iconUrl: https://github.com/adityasinghal26/backstage-plugins/blob/00c9c00ba9acc3135014d6454ccf04f573195eef/plugins/github-codespaces/images/GitHubLogo.png
iconUrl: https://github.com/adityasinghal26/backstage-plugins/blob/main/plugins/github-codespaces/images/GitHubLogo.png
npmPackageName: '@adityasinghal26/plugin-github-codespaces'
tags:
- github
+1 -1
View File
@@ -4,7 +4,7 @@ author: Keyloop
authorUrl: https://keyloop.com/
category: Metadata
description: View the programming language break down for your entities within the Software Catalog
documentation: https://github.com/backstage/backstage/blob/master/plugins/linguist/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/linguist/plugins/linguist/README.md
iconUrl: /img/linguist.svg
npmPackageName: '@backstage/plugin-linguist'
addedDate: '2023-06-17'
@@ -4,7 +4,7 @@ author: '@mufaddal7'
authorUrl: https://github.com/mufaddal7
category: Monitoring
description: Easily view your New Relic Dashboards in Backstage, via real-time snapshots of your dashboards
documentation: https://github.com/backstage/community-plugins/tree/main/workspaces/newrelic-dashboard/plugins/newrelic-dashboard
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/newrelic/plugins/newrelic-dashboard/README.md
iconUrl: https://newrelic.com/themes/custom/erno/assets/mediakit/new_relic_logo_vertical_white.svg
npmPackageName: '@backstage-community/plugin-newrelic-dashboard'
tags:
+1 -1
View File
@@ -4,7 +4,7 @@ author: jmezach
authorUrl: https://jmezach.github.io/
category: CI/CD
description: Easily view your Octopus Deploy releases within the Software Catalog
documentation: https://github.com/backstage/backstage/blob/master/plugins/octopus-deploy/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/octopus-deploy/plugins/octopus-deploy/README.md
iconUrl: /img/octopus-deploy.svg
npmPackageName: '@backstage/plugin-octopus-deploy'
addedDate: '2023-02-24'
+1 -1
View File
@@ -4,7 +4,7 @@ author: Matt Ray
authorUrl: https://opencost.io
category: Monitoring
description: OpenCost provides cloud cost monitoring for your cloud native environments.
documentation: https://github.com/backstage/backstage/blob/master/plugins/opencost/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/opencost/plugins/opencost/README.md
iconUrl: /img/opencost.png
npmPackageName: '@backstage/plugin-opencost'
addedDate: '2023-10-26'
+1 -1
View File
@@ -4,7 +4,7 @@ author: TDabasinskas
authorUrl: https://github.com/tdabasinskas
category: Configuration Management
description: Visualize resource information and Puppet facts from PuppetDB.
documentation: https://github.com/backstage/backstage/blob/master/plugins/puppetdb/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/puppetdb/plugins/puppetdb/README.md
iconUrl: /img/puppet.png
npmPackageName: '@backstage/plugin-puppetdb'
tags:
+1 -1
View File
@@ -4,7 +4,7 @@ author: Spotify
authorUrl: https://github.com/spotify
category: Utility
description: The shortcuts plugin allows a user to have easy access to pages within a Backstage app by storing them as "shortcuts" in the Sidebar.
documentation: https://github.com/backstage/backstage/blob/master/plugins/shortcuts/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/shortcuts/plugins/shortcuts/README.md
iconUrl: /img/shortcuts.svg
npmPackageName: '@backstage/plugin-shortcuts'
addedDate: '2021-10-06'
+1 -1
View File
@@ -4,7 +4,7 @@ author: SDA SE
authorUrl: https://sda.se/
category: Quality
description: Components to display code quality metrics from SonarCloud and SonarQube.
documentation: https://github.com/backstage/backstage/blob/master/plugins/sonarqube/README.md
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/sonarqube/plugins/sonarqube/README.md
iconUrl: /img/sonarqube-icon.svg
npmPackageName: '@backstage/plugin-sonarqube'
addedDate: '2020-11-03'
+1 -1
View File
@@ -4,7 +4,7 @@ author: Spotify
authorUrl: https://github.com/spotify
category: Discovery
description: Provides Stack Overflow specific functionality that can be used in different ways (e.g. for homepage and search) to compose your Backstage App.
documentation: https://github.com/backstage/backstage/blob/master/plugins/stack-overflow
documentation: https://github.com/backstage/community-plugins/blob/main/workspaces/stack-overflow/plugins/stack-overflow/README.md
iconUrl: /img/stack-overflow-logo.svg
npmPackageName: '@backstage/plugin-stack-overflow'
addedDate: '2022-06-14'
@@ -133,6 +133,34 @@ describe('UserTokenHandler', () => {
).rejects.toThrow('signature verification failed');
});
it('should fail to verify tokens that have a bad alg', async () => {
const expectedIssuedAt = 1712071714;
const expectedExpiresAt = 1712075314;
jest.useFakeTimers({
now: expectedIssuedAt * 1000 + 600_000,
});
const header = encodeData({
typ: 'vnd.backstage.user',
alg: 'none',
});
const payload = encodeData({
iss: 'http://localhost:7007/api/auth',
sub: 'user:development/guest',
ent: ['user:development/guest', 'group:default/team-a'],
aud: 'backstage',
iat: expectedIssuedAt,
exp: expectedExpiresAt,
uip: 'proof',
});
const token = `${header}.${payload}.`;
await expect(userTokenHandler.verifyToken(token)).rejects.toThrow(
/Unsupported "alg" value/,
);
});
it('should verify a valid legacy backstage token', async () => {
const expectedIssuedAt = 1712071714;
const expectedExpiresAt = 1712075314;
@@ -151,7 +179,7 @@ describe('UserTokenHandler', () => {
sub: 'user:development/guest',
ent: ['user:development/guest', 'group:default/team-a'],
aud: 'backstage',
iat: 1712071714,
iat: expectedIssuedAt,
exp: expectedExpiresAt,
},
};
@@ -179,7 +207,7 @@ describe('UserTokenHandler', () => {
iss: 'http://localhost:7007/api/auth',
ent: ['user:development/guest', 'group:default/team-a'],
aud: 'backstage',
iat: 1712071714,
iat: expectedIssuedAt,
exp: expectedExpiresAt,
},
};
@@ -209,7 +237,7 @@ describe('UserTokenHandler', () => {
sub: 'user:development/guest',
ent: ['user:development/guest', 'group:default/team-a'],
aud: 'backstage',
iat: 1712071714,
iat: expectedIssuedAt,
exp: expectedExpiresAt,
uip: 'proof',
},
@@ -239,7 +267,7 @@ describe('UserTokenHandler', () => {
payload: {
sub: 'user:development/guest',
ent: ['user:development/guest', 'group:default/team-a'],
iat: 1712071714,
iat: expectedIssuedAt,
exp: expectedExpiresAt,
},
};
@@ -34,18 +34,14 @@ import { JwksClient } from '../JwksClient';
*/
export class UserTokenHandler {
static create(options: { discovery: DiscoveryService }): UserTokenHandler {
const algorithms = ['ES256']; // TODO: configurable?
const jwksClient = new JwksClient(async () => {
const url = await options.discovery.getBaseUrl('auth');
return new URL(`${url}/.well-known/jwks.json`);
});
return new UserTokenHandler(algorithms, jwksClient);
return new UserTokenHandler(jwksClient);
}
constructor(
private readonly algorithms: string[],
private readonly jwksClient: JwksClient,
) {}
constructor(private readonly jwksClient: JwksClient) {}
async verifyToken(token: string) {
const verifyOpts = this.#getTokenVerificationOptions(token);
@@ -79,7 +75,6 @@ export class UserTokenHandler {
if (typ === tokenTypes.user.typParam) {
return {
algorithms: this.algorithms,
requiredClaims: ['iat', 'exp', 'sub'],
typ: tokenTypes.user.typParam,
};
@@ -87,7 +82,6 @@ export class UserTokenHandler {
if (typ === tokenTypes.limitedUser.typParam) {
return {
algorithms: this.algorithms,
requiredClaims: ['iat', 'exp', 'sub'],
typ: tokenTypes.limitedUser.typParam,
};
@@ -96,7 +90,6 @@ export class UserTokenHandler {
const { aud } = decodeJwt(token);
if (aud === tokenTypes.user.audClaim) {
return {
algorithms: this.algorithms,
audience: tokenTypes.user.audClaim,
};
}