Gathering detailed insights and metrics for jsecrets
Gathering detailed insights and metrics for jsecrets
Gathering detailed insights and metrics for jsecrets
Gathering detailed insights and metrics for jsecrets
jsecrets is a wrapper around AWS Secrets Manager for your JavaScript projects.
npm install jsecrets
Typescript
Module System
Node Version
NPM Version
56.8
Supply Chain
96
Quality
74.3
Maintenance
100
Vulnerability
99.3
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
6 Stars
7 Commits
4 Watchers
1 Branches
1 Contributors
Updated on Apr 18, 2024
Latest Version
1.0.0
Package Id
jsecrets@1.0.0
Unpacked Size
9.27 kB
Size
4.03 kB
File Count
5
NPM Version
6.12.0
Node Version
12.13.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
jsecrets lets you fetch and use secrets from AWS Secrets Manager in your JavaScript projects. jsecrets is built and maintained by Pixie Labs.
You may want to use this if you use AWS Secrets Manager to store encrypted credentials, e.g. for your database, or for accessing an API with a token, and need to access those credentials in a backend JavaScript application e.g. an Express server, Lambda function, or some other backend piece of code.
Add the package to your package.json with either NPM or Yarn:
1# With NPM: 2$ npm i -S jsecrets 3# With Yarn: 4$ yarn add jsecrets
jsecrets expects that your secrets are JSON objects stored in AWS Secrets Manager as strings.
1// app.js 2const jsecrets = require("jsecrets"); 3 4try { 5 // Fetch secrets from AWS Secrets Manager with jsecrets.fetch(), passing in 6 // the region and an array of secret IDs. The secret ID can be the Amazon 7 // Resource Name (ARN) or the "friendly name" of the secret. 8 await jsecrets.fetch("eu-west-2", ["databaseSecret", "anotherSecret"]); 9 10 // Once the secrets have been retrieved, individual values can be extracted by 11 // passing in the name of the secret and the key to jsecrets.get(). 12 const database = jsecrets.get("databaseSecret", "database"); 13 const username = jsecrets.get("databaseSecret", "username"); 14 const password = jsecrets.get("databaseSecret", "password"); 15 const options = { 16 host: jsecrets.get("databaseSecret", "host"), 17 dialect: "postgres" 18 }; 19 20 // You might then use those secrets to configure a DB connection, such as: 21 const sequelize = new Sequelize(database, username, password, options); 22 23 // The rest of your app goes here. 24 25} catch (e) { 26 console.log(e.message); 27}
jsecrets has a helper method making it easy to stub calls to AWS when you are
developing your application, and so don't need to use production secrets.
Immediately after the import
, call jsecrets.devStubs()
passing in an
object with the same shape as your secrets.The stubs will be used in all
circumstances.
Wrap the call to jsecrets.devStubs()
in a if
block to ensure devStubs()
is not called in production.
If you have multiple secrets, you can pass them all into jsecrets.devStubs()
at once.
For example:
1const jsecrets = require('jsecrets'); 2 3if (process.env.NODE_ENV != 'production') { 4 // Stub the return values of jsecrets.get() unless the app is running in 5 // production. 6 jsecrets.devStubs({ 7 'databaseSecret': { 8 'database': 'jsecrets_node_app', 9 'host': 'localhost', 10 'username': 'pixielabs', 11 'password': 'pixielabs_secrets' 12 }, 13 'anotherSecret': { 14 'jwt_signing_key': 'jsecret_signing', 15 'jwt_client_key': 'jsecret_client' 16 } 17 }) 18} 19 20try { 21 // Fetch secrets from AWS Secrets Manager with jsecrets.fetch() 22 await jsecrets.fetch("eu-west-2", ["databaseSecret", "anotherSecret"]);
All errors returned by jsecrets will have a message
key.
If the error is from AWS then there will also be other keys such as
code
, time
and statusCode
.
Unit tests can be run with:
$ npm test
Feature tests are part of the example Express app within the exampleApp folder:
$ npm run exampleAppStart
In a new terminal:
$ npm run exampleAppTest
Before contributing, please read the code of conduct.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 0/5 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
57 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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