open-index/open-npm huggingface dataset:
npm package: @geislor/backstage-plugin-defectdojo
Description: Welcome to the `backstage-plugin-defectdojo` plugin!
Latest version: 1.0.2

# backstage-plugin-defectdojo

Welcome to the `backstage-plugin-defectdojo` plugin!


## Getting started

#### Overview Page - defectdojo Vulnerability Chart
![defectdojo Chart Example](./docs/defectdojo-chart.png)

#### Service Entiry Page - defectdojo Vulnerability Table List
![defectdojo Table Example](./docs/defectdojo-table.png)

The following sections will help you get the defectdojo plugin setup and running

### defectdojo Backend
You need to setup the [defectdojo backend plugin](https://github.com/geislor/backstage-plugin-defectdojo-backend) before you move forward with any of these steps if you haven't already

## Installation
This plugin needs to be added to an existing backstage instance.

```bash
# From your Backstage root directory
yarn add --cwd packages/app @geislor/backstage-plugin-defectdojo
```

`Note: You have 2 Options, you can setup both too`

### Option 1
Add defectdojo Vulnerability chart in to Overview page

Import the plugin to `packages/app/src/components/catalog/EntityPage.tsx`.
### EntityPage.tsx
```typescript
// ...
import { DefectDojoCard } from '@geislor/backstage-plugin-defectdojo';
// ...
const overviewContent = (
    <Grid container spacing={3} alignItems="stretch">
    {entityWarningContent}
    <Grid item md={6}>
      <EntityAboutCard variant="gridItem" />
    </Grid>
    //...
    <Grid item md={4} xs={12}>
      <DefectDojoCard />
    </Grid>
    <Grid item md={8} xs={12}>
      <EntityHasSubcomponentsCard variant="gridItem" />
    </Grid>    
  </Grid>
);
```

### Option 2
Add defectdojo Vulnerability Table List in to Service Entity

Import the plugin to `packages/app/src/components/catalog/EntityPage.tsx` and add the following.

### EntityPage.tsx
```typescript
// ...
import { DefectDojoPage } from '@geislor/backstage-plugin-defectdojo';
// ...
const serviceEntityPage = (
    <EntityLayout>
    <EntityLayout.Route path="/" title="Overview">
      {overviewContent}
    </EntityLayout.Route>

    <EntityLayout.Route path="/ci-cd" title="CI/CD">
      {cicdContent}
    </EntityLayout.Route>
    //...
    <EntityLayout.Route path="/defectdojo" title="Security">      
        <DefectDojoPage />    
    </EntityLayout.Route>
    // ...    
  </EntityLayout>
);
```
`Note: If you dont want to display the Service page if no annotation specified in catalog.`
```typescript
//...
import { DefectDojoPage, isdefectdojoAvailable } from '@geislor/backstage-plugin-defectdojo';
//...
<EntityLayout.Route if={isdefectdojoAvailable} path="/defectdojo" title="Security">      
    <DefectDojoPage />    
</EntityLayout.Route>
// ...    

```
## Configuration

Add the following into your `app-config.yaml`
### Config
```yaml
defectdojo:
  host: https://defectdojo.yourcompany.com/api
  token: YOUR_API_TOKEN
```

Add the following into your catalog
### Catalog
```yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: backstage
  annotations:
    defectdojo/project: YOUR_PROJECT_NAME/YOUR_PROJECT_VERSION
```
npm package: @geislor/backstage-plugin-defectdojo-backend
Description: Welcome to the backstage-plugin-defectdojo-backend backend plugin!
Latest version: 1.0.2

# backstage-plugin-defectdojo-backend

Welcome to the backstage-plugin-defectdojo-backend backend plugin!


## Getting started

## Installation
This plugin needs to be added to an existing backstage instance.

```bash
# From your Backstage root directory
yarn add --cwd packages/backend @geislor/backstage-plugin-defectdojo-backend
```

Create a file called defectdojo.ts inside `packages/backend/src/plugins/` and add the following:

### defectdojo.ts
```typescript
import { createRouter } from '@geislor/backstage-plugin-defectdojo-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {  
  return await createRouter({
    logger: env.logger,
    config: env.config,
  });
}
```

And import the plugin to `packages/backend/src/index.ts`.
### src/index.ts
```diff
diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts
index c4736a5..5822302 100644
--- a/packages/backend/src/index.ts
+++ b/packages/backend/src/index.ts
@@ -28,6 +28,7 @@ import scaffolder from './plugins/scaffolder';
 import proxy from './plugins/proxy';
 import techdocs from './plugins/techdocs';
 import search from './plugins/search';
+import defectdojo from './plugins/defectdojo';
 import { PluginEnvironment } from './types';
 import { ServerPermissionClient } from '@backstage/plugin-permission-node';
 import { DefaultIdentityClient } from '@backstage/plugin-auth-node';
@@ -85,6 +86,7 @@ async function main() {
   const techdocsEnv = useHotMemoize(module, () => createEnv('techdocs'));
   const searchEnv = useHotMemoize(module, () => createEnv('search'));
   const appEnv = useHotMemoize(module, () => createEnv('app'));
+  const defectdojoEnv = useHotMemoize(module, () => createEnv('defectdojo'));

   const apiRouter = Router();
   apiRouter.use('/catalog', await catalog(catalogEnv));
@@ -93,6 +95,7 @@ async function main() {
   apiRouter.use('/techdocs', await techdocs(techdocsEnv));
   apiRouter.use('/proxy', await proxy(proxyEnv));
   apiRouter.use('/search', await search(searchEnv));
+  apiRouter.use('/defectdojo', await defectdojo(defectdojoEnv));

   // Add backends ABOVE this line; this 404 handler is the catch-all fallback
   apiRouter.use(notFoundHandler());

```

## Continue with Frontend Plugin
Follow the Docs from [README.md](https://github.com/geislor/backstage-plugin-defectdojo)

## Configuration

Add the following into your `app-config.yaml`
### Config
```yaml
defectdojo:
  host: https://defectdojo.yourcompany.com/api
  token: YOUR_API_TOKEN
```

Add the following into your catalog
### Catalog
```yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: backstage
  annotations:
    defectdojo/project: YOUR_PROJECT_NAME/YOUR_PROJECT_VERSION
```