Gathering detailed insights and metrics for @veecode-platform/plugin-vault-backend
Gathering detailed insights and metrics for @veecode-platform/plugin-vault-backend
Gathering detailed insights and metrics for @veecode-platform/plugin-vault-backend
Gathering detailed insights and metrics for @veecode-platform/plugin-vault-backend
npm install @veecode-platform/plugin-vault-backend
Typescript
Module System
Node Version
NPM Version
27.1
Supply Chain
78.8
Quality
73.8
Maintenance
25
Vulnerability
79.1
License
TypeScript (95.98%)
JavaScript (4.01%)
Dockerfile (0.01%)
Total Downloads
4,767
Last Day
6
Last Week
23
Last Month
112
Last Year
1,067
51,584 Commits
77 Branches
2 Contributors
Latest Version
0.4.14
Package Id
@veecode-platform/plugin-vault-backend@0.4.14
Unpacked Size
48.45 kB
Size
12.39 kB
File Count
6
NPM Version
10.2.4
Node Version
18.19.1
Publised On
02 Apr 2024
Cumulative downloads
Total Downloads
Last day
500%
6
Compared to previous day
Last week
-4.2%
23
Compared to previous week
Last month
53.4%
112
Compared to previous month
Last year
-71.2%
1,067
Compared to previous year
16
A backend for Vault, this plugin adds a few routes that are used by the frontend plugin to fetch the information from Vault.
Vault is an identity-based secrets and encryption management system. A secret is anything that you want to tightly control access to, such as API encryption keys, passwords, or certificates. Vault provides encryption services that are gated by authentication and authorization methods.
This plugins allows you to view all the available secrets at a certain location, and redirect you to the official UI so backstage can rely on LIST permissions, which is safer.
To get started, first you need a running instance of Vault. You can follow this tutorial to install vault and start your server locally.
When your Vault instance is up and running, then you will need to install the plugin into your app:
1 # From your Backstage root directory 2 yarn --cwd packages/backend add @backstage/plugin-vault-backend
Create a file in src/plugins/vault.ts
and add a reference to it in src/index.ts
:
1// In packages/backend/src/plugins/vault.ts 2import { createRouter } from '@backstage/plugin-vault-backend'; 3import { Router } from 'express'; 4import { PluginEnvironment } from '../types'; 5 6export default async function createPlugin( 7 env: PluginEnvironment, 8): Promise<Router> { 9 return await createRouter({ 10 logger: env.logger, 11 config: env.config, 12 scheduler: env.scheduler, 13 }); 14}
1diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts 2index f2b14b2..2c64f47 100644 3--- a/packages/backend/src/index.ts 4+++ b/packages/backend/src/index.ts 5@@ -22,6 +22,7 @@ import { Config } from '@backstage/config'; 6 import app from './plugins/app'; 7+import vault from './plugins/vault'; 8 import scaffolder from './plugins/scaffolder'; 9@@ -56,6 +57,7 @@ async function main() { 10 const authEnv = useHotMemoize(module, () => createEnv('auth')); 11+ const vaultEnv = useHotMemoize(module, () => createEnv('vault')); 12 const proxyEnv = useHotMemoize(module, () => createEnv('proxy')); 13@@ -63,6 +65,7 @@ async function main() { 14 15 const apiRouter = Router(); 16 apiRouter.use('/catalog', await catalog(catalogEnv)); 17+ apiRouter.use('/vault', await vault(vaultEnv)); 18 apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv));
Add some extra configurations in your app-config.yaml
.
1vault: 2 baseUrl: http://your-internal-vault-url.svc 3 publicUrl: https://your-vault-url.example.com 4 token: <VAULT_TOKEN> 5 secretEngine: 'customSecretEngine' # Optional. By default it uses 'secrets'. Can be overwritten by the annotation of the entity 6 kvVersion: <kv-version> # Optional. The K/V version that your instance is using. The available options are '1' or '2' 7 schedule: # Optional. If the token renewal is enabled this schedule will be used instead of the hourly one 8 frequency: { hours: 1 } 9 timeout: { hours: 1 }
Get a VAULT_TOKEN
with LIST permissions, as it's enough for the plugin. You can check this tutorial for more info.
If you also want to use the renew
functionality, you need to attach the following block to your custom policy, so that Backstage can perform a token-renew:
# Allow tokens to renew themselves
path "auth/token/renew-self" {
capabilities = ["update"]
}
The Vault backend plugin has support for the new backend system, here's how you can set that up:
In your packages/backend/src/index.ts
make the following changes:
1 import { createBackend } from '@backstage/backend-defaults'; 2 const backend = createBackend(); 3 // ... other feature additions 4+ backend.add(import('@backstage/plugin-vault-backend'); 5 backend.start();
The token renewal is enabled automatically in the new backend system depending on the app-config.yaml
. If the schedule
is not defined there, no
task will be executed. If you want to use the default renewal scheduler (which runs hourly), set schedule: true
. In case you want a custom schedule
just use a configuration like the one set above.
The plugin can be integrated into each Component in the catalog. To allow listing the available secrets a new annotation must be added to the catalog-info.yaml
:
1apiVersion: backstage.io/v1alpha1 2kind: Component 3metadata: 4 # ... 5 annotations: 6 vault.io/secrets-path: path/to/secrets
The path is relative to your secrets engine folder. So if you want to get the secrets for backstage and you have the following directory structure:
.
├── ...
├── secrets # Your secret engine name (usually it is `secrets`)
│ ├── test # Folder with test secrets
│ │ ├── backstage # In this folder there are secrets for Backstage
│ ├── other # Other folder with more secrets inside
│ └── folder # And another folder
└── ...
You will set the vault.io/secret-path
to test/backstage
. If the folder backstage
contains other sub-folders, the plugin will fetch the secrets inside them and adapt the View and Edit URLs to point to the correct place.
In case you need to support different secret engines for entities of the catalog you can provide optional annotation to the entity in catalog-info.yaml
:
1 apiVersion: backstage.io/v1alpha1 2 kind: Component 3 metadata: 4 # ... 5 annotations: 6 vault.io/secrets-path: path/to/secrets 7+ vault.io/secrets-engine: customSecretEngine # Optional. By default it uses the 'secretEngine' value from your app-config.
That will overwrite the default secret engine from the configuration.
In a secure Vault instance, it's usual that the tokens are refreshed after some time. In order to always have a valid token to fetch the secrets, it might be necessary to execute a renew action after some time. By default this is deactivated, but it can be easily activated and configured to be executed periodically (hourly by default, but customizable by the user within the app-config.yaml file). In order to do that, modify your src/plugins/vault.ts
file to look like this one:
1import { VaultBuilder } from '@backstage/plugin-vault-backend'; 2import { Router } from 'express'; 3import { PluginEnvironment } from '../types'; 4 5export default async function createPlugin( 6 env: PluginEnvironment, 7): Promise<Router> { 8 const builder = await VaultBuilder.createBuilder({ 9 logger: env.logger, 10 config: env.config, 11 scheduler: env.scheduler, 12 }).enableTokenRenew( 13 env.scheduler.createScheduledTaskRunner({ 14 frequency: { minutes: 10 }, 15 timeout: { minutes: 1 }, 16 }), 17 ); 18 19 const { router } = builder.build(); 20 21 return router; 22}
If the taskRunner
is not set when calling the enableTokenRenew
, the plugin will automatically check what is set in the app-config.yaml
file. Refer to the new backend system setup for more information about it.
The secrets cannot be edited/viewed from within Backstage to make it more secure. Backstage will only have permissions to LIST data from Vault or to renew its own token if that is needed. And the user who wants to edit/view a certain secret needs the correct permissions to do so.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
18 different organizations found -- score normalized to 10
Details
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
30 commit(s) out of 30 and 0 issue activity out of 0 found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
found 30 unreviewed changesets out of 30 -- score normalized to 0
Reason
no update tool detected
Details
Reason
project is not fuzzed
Reason
no SAST tool detected
Details
Reason
non read-only tokens detected in GitHub workflows
Details
Score
Last Scanned on 2023-09-12T19:37:29Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More