Skip to content

Commit

Permalink
Merge pull request #111 from snyk-tech-services/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
lili2311 authored Oct 5, 2022
2 parents f48b15a + 7c2034a commit 2a183e2
Show file tree
Hide file tree
Showing 11 changed files with 509 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Snyk Tech Services will be required for a review on every PR
* @snyk-tech-services/snyk-tech-services
* @snyk-tech-services/snyk-tech-services
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Snyk Backstage Plugin
[![Not Maintained](https://img.shields.io/badge/Maintenance%20Level-Not%20Maintained-yellow.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d)

**This repository is not in active developemnt and critical bug fixes only will be considered.**


The Snyk plugin displays security details from [snyk.io](https://snyk.io/).

Expand All @@ -9,13 +13,13 @@ The Snyk plugin displays security details from [snyk.io](https://snyk.io/).
> **Requirements: Snyk API enabled (Paid plans only)**
1. Install plugin
```
```bash
# packages/app
yarn add backstage-plugin-snyk
```

2. Add plugin to the app
```
```typescript
// packages/app/src/App.tsx
import { EntitySnykContent } from 'backstage-plugin-snyk';

Expand All @@ -35,7 +39,7 @@ The plugin is composed of 2 main parts
- Security tab in the entity displaying further details

a. Import the elements
```
```typescript
// packages/app/src/components/catalog/EntityPage.tsx
import { SnykOverview, EntitySnykContent, isSnykAvailable } from 'backstage-plugin-snyk';
```
Expand All @@ -44,7 +48,7 @@ b. Add the overview card\
\
![Overview card](https://storage.googleapis.com/snyk-technical-services.appspot.com/backstage-screenshots/backstage-plugin-overview-card.png)

```
```typescript
// packages/app/src/components/catalog/EntityPage.tsx
const overviewContent = (
<Grid container spacing={3} alignItems="stretch">
Expand All @@ -62,7 +66,7 @@ const overviewContent = (
```

c. Add the tab (feel free to rename title to Security, snyk, vulns, whatever you think is best)
```
```typescript
const ServiceEntityPage = (
<EntityLayoutWrapper>
...
Expand All @@ -75,7 +79,7 @@ const ServiceEntityPage = (
```

4. Add snyk proxy config to app-config.yaml file at the root directory. If using Snyk self hosted, adjust target to https://YOURHOSTNAME/api. User Agent helps us see how much API traffic comes from backstage setups so we can invest more in the plugin !
```
```yaml
proxy:
...

Expand All @@ -89,7 +93,7 @@ proxy:
```

5. Get your Snyk token (a service account with Viewer permission at your group level is preferred) and provide SNYK_TOKEN env var with the value "token <YOURTOKEN>"
```
```bash
export SNYK_TOKEN="token 123-123-123-123"
```

Expand All @@ -101,7 +105,7 @@ If multiple projects (like multiple package.json or pom files, add them with inc


Example:
```
```yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
Expand Down Expand Up @@ -129,7 +133,7 @@ spec:


- 404s from Snyk API? Add [pathRewrite your app-config.yaml proxy](https://github.com/snyk-tech-services/backstage-plugin-snyk/issues/11) to the following
```
```yaml
'/snyk':
target: https://snyk.io/api/v1
headers:
Expand All @@ -142,4 +146,4 @@ spec:
## Limitations
Infrastructure as Code and Snyk Code projects are not supported currently.
Infrastructure as Code and Snyk Code projects are not supported currently.
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
"test": "snyk test"
},
"dependencies": {
"@backstage/catalog-model": "^1.0.0",
"@backstage/core-components": "^0.9.2",
"@backstage/core-plugin-api": "^1.0.0",
"@backstage/plugin-catalog-react": "^1.0.1",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
"@mdi/js": "^5.6.55",
"@snyk/dep-graph": "^1.23.1",
"@backstage/catalog-model": "1.1.1",
"@backstage/core-components": "0.11.1",
"@backstage/core-plugin-api": "1.0.6",
"@backstage/plugin-catalog-react": "1.1.4",
"@material-ui/core": "4.12.4",
"@material-ui/icons": "4.11.3",
"@material-ui/lab": "4.0.0-alpha.61",
"@snyk/dep-graph": "2.3.0",
"react-circular-progressbar": "^2.0.3",
"react-use": "^17.2.4"
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/SnykEntityComponent/SnykEntityComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
mdiBitbucket,
mdiMicrosoftAzureDevops,
mdiLambda,
} from "@mdi/js";
} from "./svgs";
import { Grid } from "@material-ui/core";
import { useEntity } from "@backstage/plugin-catalog-react";

Expand Down
6 changes: 6 additions & 0 deletions src/components/SnykEntityComponent/svgs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// The following items have been copied from https://github.com/Templarian/MaterialDesign-JS
export { mdiConsole } from './mdiConsole'
export { mdiGitlab } from './mdiGitlab'
export { mdiBitbucket } from './mdiBitbucket'
export { mdiMicrosoftAzureDevops } from './mdiMicrosoftAzureDevops'
export { mdiLambda } from './mdiLambda'
2 changes: 2 additions & 0 deletions src/components/SnykEntityComponent/svgs/mdiBitbucket.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The following was copied from https://github.com/Templarian/MaterialDesign-JS/blob/3c2f1225ad685a16ecfe818e612b40ee80541306/mdi.js to improve the performance of the backstage application.
export var mdiBitbucket = "M2.65 3C2.3 3 2 3.3 2 3.65C2 3.69 2 3.73 2 3.77L4.73 20.27C4.8 20.69 5.16 21 5.58 21H18.63C18.94 21 19.22 20.78 19.27 20.46L22 3.77C22.05 3.42 21.81 3.09 21.46 3.04C21.43 3.03 21.39 3.03 21.35 3.03L2.65 3M14.1 14.95H9.94L8.81 9.07H15.11L14.1 14.95Z";
2 changes: 2 additions & 0 deletions src/components/SnykEntityComponent/svgs/mdiConsole.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The following was copied from https://github.com/Templarian/MaterialDesign-JS/blob/3c2f1225ad685a16ecfe818e612b40ee80541306/mdi.js to improve the performance of the backstage application.
export var mdiConsole = "M20,19V7H4V19H20M20,3A2,2 0 0,1 22,5V19A2,2 0 0,1 20,21H4A2,2 0 0,1 2,19V5C2,3.89 2.9,3 4,3H20M13,17V15H18V17H13M9.58,13L5.57,9H8.4L11.7,12.3C12.09,12.69 12.09,13.33 11.7,13.72L8.42,17H5.59L9.58,13Z";
2 changes: 2 additions & 0 deletions src/components/SnykEntityComponent/svgs/mdiGitlab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The following was copied from https://github.com/Templarian/MaterialDesign-JS/blob/3c2f1225ad685a16ecfe818e612b40ee80541306/mdi.js to improve the performance of the backstage application.
export var mdiGitlab = "M21.94 13.11L20.89 9.89C20.89 9.86 20.88 9.83 20.87 9.8L18.76 3.32C18.65 3 18.33 2.75 17.96 2.75C17.6 2.75 17.28 3 17.17 3.33L15.17 9.5H8.84L6.83 3.33C6.72 3 6.4 2.75 6.04 2.75H6.04C5.67 2.75 5.35 3 5.24 3.33L3.13 9.82C3.13 9.82 3.13 9.83 3.13 9.83L2.06 13.11C1.9 13.61 2.07 14.15 2.5 14.45L11.72 21.16C11.89 21.28 12.11 21.28 12.28 21.15L21.5 14.45C21.93 14.15 22.1 13.61 21.94 13.11M8.15 10.45L10.72 18.36L4.55 10.45M13.28 18.37L15.75 10.78L15.85 10.45H19.46L13.87 17.61M17.97 3.94L19.78 9.5H16.16M14.86 10.45L13.07 15.96L12 19.24L9.14 10.45M6.03 3.94L7.84 9.5H4.23M3.05 13.69C2.96 13.62 2.92 13.5 2.96 13.4L3.75 10.97L9.57 18.42M20.95 13.69L14.44 18.42L14.46 18.39L20.25 10.97L21.04 13.4C21.08 13.5 21.04 13.62 20.95 13.69";
2 changes: 2 additions & 0 deletions src/components/SnykEntityComponent/svgs/mdiLambda.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The following was copied from https://github.com/Templarian/MaterialDesign-JS/blob/3c2f1225ad685a16ecfe818e612b40ee80541306/mdi.js to improve the performance of the backstage application.
export var mdiLambda = "M6,20L10.16,7.91L9.34,6H8V4H10C10.42,4 10.78,4.26 10.93,4.63L16.66,18H18V20H16C15.57,20 15.21,19.73 15.07,19.36L11.33,10.65L8.12,20H6Z";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The following was copied from https://github.com/Templarian/MaterialDesign-JS/blob/3c2f1225ad685a16ecfe818e612b40ee80541306/mdi.js to improve the performance of the backstage application.
export var mdiMicrosoftAzureDevops = "M22 18L17 22L9 19V22L4.81 16.25L17.72 17.3V6.34L22 5.65V18M4.81 16.25V8.96L17.72 6.34L10.6 2V4.84L3.97 6.76L2 9.38V15.07L4.81 16.25Z";
Loading

0 comments on commit 2a183e2

Please sign in to comment.