Skip to content

Commit

Permalink
release: 0.14.1 (#122)
Browse files Browse the repository at this point in the history
### Description

This PR refactors areas where JSON.parse was used in unsafe code which
leaves the potential for unexpected exceptions.

It also bumps Backstage package versions and fixes a high severity
security issue on a 3rd party dependency.

## Acknowledgement

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

**Disclaimer:** We value your time and bandwidth. As such, any pull
requests created on non-triaged issues might not be successful.
  • Loading branch information
t1agob authored Jul 24, 2024
2 parents daec2a0 + bfd34bb commit ada7bba
Show file tree
Hide file tree
Showing 4 changed files with 1,006 additions and 218 deletions.
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.27.7"
"version": "1.29.1"
}
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"types": "dist/index.d.ts"
},
"backstage": {
"role": "frontend-plugin"
"role": "frontend-plugin",
"pluginId": "pagerduty",
"pluginPackages": "pagerduty"
},
"homepage": "https://github.com/pagerduty/backstage-plugin",
"repository": {
Expand All @@ -34,12 +36,12 @@
},
"dependencies": {
"@backstage/catalog-model": "^1.5.0",
"@backstage/core-components": "^0.14.7",
"@backstage/core-plugin-api": "^1.9.2",
"@backstage/core-components": "^0.14.9",
"@backstage/core-plugin-api": "^1.9.3",
"@backstage/errors": "^1.2.4",
"@backstage/plugin-catalog-react": "^1.12.0",
"@backstage/plugin-home-react": "^0.1.13",
"@backstage/theme": "^0.5.5",
"@backstage/plugin-catalog-react": "^1.12.2",
"@backstage/plugin-home-react": "^0.1.15",
"@backstage/theme": "^0.5.6",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@material-ui/core": "^4.12.2",
Expand All @@ -63,10 +65,10 @@
"react-router-dom": "^6.3.0"
},
"devDependencies": {
"@backstage/cli": "^0.26.6",
"@backstage/core-app-api": "^1.12.5",
"@backstage/dev-utils": "^1.0.32",
"@backstage/test-utils": "^1.5.5",
"@backstage/cli": "^0.26.11",
"@backstage/core-app-api": "^1.14.0",
"@backstage/dev-utils": "^1.0.35",
"@backstage/test-utils": "^1.5.8",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@testing-library/dom": "^8.0.0",
Expand Down
61 changes: 36 additions & 25 deletions src/components/PagerDutyPage/ServiceMappingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,50 @@ export const ServiceMappingComponent = () => {
}

function fetchCatalogEntities() {
catalogApi
.getEntities({
filter: { kind: "Component" },
})
.then((result) => {
const entities: BackstageEntity[] = [];
result.items.forEach((entity: any) => {
const annotations: Annotations = JSON.parse(
JSON.stringify(entity.metadata.annotations)
);

entities.push({
name: entity.metadata?.name,
id: entity.metadata?.uid ?? "",
namespace: entity.metadata?.namespace ?? "",
type: entity.kind ?? "",
system: JSON.stringify(entity.spec?.system) || "",
owner: JSON.stringify(entity.spec?.owner) || "",
lifecycle: JSON.stringify(entity.spec?.lifecycle) || "",
annotations: annotations,
});
});
catalogApi
.getEntities({
filter: { kind: "Component" },
})
.then((result) => {
const entities: BackstageEntity[] = [];
result.items.forEach((entity) => {
const annotations: Annotations = {
"pagerduty.com/integration-key":
entity.metadata?.annotations?.[
"pagerduty.com/integration-key"
] ?? "",
"pagerduty.com/service-id":
entity.metadata?.annotations?.["pagerduty.com/service-id"] ??
"",
};

setCatalogEntities(entities);
entities.push({
name: entity.metadata?.name,
id: entity.metadata?.uid ?? "",
namespace: entity.metadata?.namespace ?? "",
type: entity.kind ?? "",
system: entity.spec?.system
? JSON.stringify(entity.spec?.system)
: "",
owner: entity.spec?.owner
? JSON.stringify(entity.spec?.owner)
: "",
lifecycle: entity.spec?.lifecycle
? JSON.stringify(entity.spec?.lifecycle)
: "",
annotations: annotations,
});
});

setCatalogEntities(entities);
});
}

fetchMappings();
fetchCatalogEntities();
}, [catalogApi, pagerDutyApi]);


return (
<MappingTable mappings={entityMappings} catalogEntities={catalogEntities} />
<MappingTable mappings={entityMappings} catalogEntities={catalogEntities} />
);
};
Loading

0 comments on commit ada7bba

Please sign in to comment.