New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@soluto-asurion/kamus-cli

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soluto-asurion/kamus-cli - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

26

lib/actions/encrypt.js
const bluebird = require('bluebird');
const opn = require('opn');
const os = require('os');
const url = require('url');
const fs = require('fs');
const Confirm = require('prompt-confirm');
const request = require('request');

@@ -43,5 +45,19 @@ const { promisify } = require('util');

const encrypt = async ({ secret, file, serviceAccount, namespace, kamusUrl, certFingerprint, fileEncoding }, token = null) => {
const checkForNewlines = async (secret) => {
const eolIndex = secret.indexOf(os.EOL);
if (eolIndex !== -1) {
const newlinesDetectedPrompt = new Confirm(`Secret contains newlines at index ${eolIndex}. Continue encrypting this secret?`);
const response = await newlinesDetectedPrompt.run();
if (!response) {
throw new Error('Aborted secret encryption');
}
}
};
const encrypt = async ({ secret, secretFile, serviceAccount, namespace, kamusUrl, certFingerprint, fileEncoding }, token = null) => {
// eslint-disable-next-line security/detect-non-literal-fs-filename
const data = file ? fs.readFileSync(file, { encoding: fileEncoding || DEFAULT_ENCODING }) : secret;
const data = secretFile ? fs.readFileSync(secretFile, { encoding: fileEncoding || DEFAULT_ENCODING }) : secret;
await checkForNewlines(data);
const response = await performEncryptRequestAsync(data, serviceAccount, namespace, kamusUrl, certFingerprint, token);

@@ -54,8 +70,8 @@ if (response && response.statusCode >= 300) {

const validateArguments = ({ secret, file, kamusUrl, allowInsecureUrl }) => {
if (!secret && !file) {
const validateArguments = ({ secret, secretFile, kamusUrl, allowInsecureUrl }) => {
if (!secret && !secretFile) {
throw new Error('Neither secret nor secret-file options were set.');
}
if (secret && file) {
if (secret && secretFile) {
throw new Error('Both secret nor secret-file options were set.');

@@ -62,0 +78,0 @@ }

{
"name": "@soluto-asurion/kamus-cli",
"version": "0.2.1",
"version": "0.2.2",
"description": "CLI Tool to encrypt secrets for kamus",

@@ -36,2 +36,3 @@ "main": "index.js",

"opn": "^5.4.0",
"prompt-confirm": "^2.0.4",
"request": "^2.88.0"

@@ -43,2 +44,4 @@ },

"eslint-plugin-security": "^1.4.0",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
"mocha": "^5.2.0",

@@ -52,3 +55,17 @@ "mock-fs": "^4.7.0",

"yarn.lock"
]
],
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "yarn test --reporter min"
}
},
"lint-staged": {
"linters": {
"*.js": [
"eslint",
"git add"
]
}
}
}

@@ -49,1 +49,2 @@ [![npm version](https://badge.fury.io/js/%40soluto-asurion%2Fkamus-cli.svg)](https://badge.fury.io/js/%40soluto-asurion%2Fkamus-cli)

| --log-encoding <encoding> | false | specify the log file's encoding.
| --secret or --secret-file | true | the secret to encrypt, or the file containing it | |

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc