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

@tsmx/secure-config-tool

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsmx/secure-config-tool - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

test/testfiles/config-ambiguous-prop.json

2

functions/create-file.js

@@ -31,3 +31,3 @@ const fs = require('fs');

processValue: (key, value, level, path, isObjectRoot, isArrayElement, cbSetValue) => {
if (patternMatch(key, patternArray)) {
if (typeof value !== 'object' && patternMatch(key, patternArray)) {
cbSetValue(cryptUtils.encrypt(value, configKey.toString()));

@@ -34,0 +34,0 @@ }

{
"name": "@tsmx/secure-config-tool",
"version": "2.1.0",
"version": "2.1.1",
"description": "Command-line tool for @tsmx/secure-config.",

@@ -5,0 +5,0 @@ "main": "secure-config-tool.js",

@@ -12,2 +12,3 @@ const { verifyEncryptedJson, verifyUnencryptedJson, verifyEncryptedValue } = require('./test-utils');

const unencryptedPassword = 'SecretDbPassword';
const unencryptedDatabase = 'MyDB';

@@ -73,2 +74,25 @@ const TEST_KEY = 'iC771qNLe+OGVcduw8fqpDIIK7lK0T5p';

it('tests a successful command line file encryption with a hex key and custom patterns and an ambiguous property name', () => {
process.env['CONFIG_ENCRYPTION_KEY'] = TEST_KEY_HEX;
const oh = require('@tsmx/object-hmac');
const originalConfig = require('./testfiles/config-ambiguous-prop.json');
const expectedHmac = oh.calculateHmac(originalConfig, TEST_KEY_HEX);
const createFile = require('../functions/create-file');
createFile('./test/testfiles/config-ambiguous-prop.json', { patterns: 'host,pass,database'});
expect(testOutput.length).toBe(1);
let encryptedJson = JSON.parse(testOutput[0]);
expect(encryptedJson).toBeDefined();
expect(encryptedJson.database).toBeDefined();
expect(encryptedJson.database.host).toBeDefined();
verifyEncryptedValue(encryptedJson.database.host, unencryptedHost);
expect(encryptedJson.database.username).toBeDefined();
expect(encryptedJson.database.username).toBe(unencryptedUsername);
expect(encryptedJson.database.password).toBeDefined();
verifyEncryptedValue(encryptedJson.database.password, unencryptedPassword);
expect(encryptedJson.database.database).toBeDefined();
verifyEncryptedValue(encryptedJson.database.database, unencryptedDatabase);
expect(encryptedJson['__hmac']).toBeDefined();
expect(encryptedJson['__hmac']).toStrictEqual(expectedHmac);
});
it('tests a successful command line file encryption without HMAC generation', () => {

@@ -75,0 +99,0 @@ process.env['CONFIG_ENCRYPTION_KEY'] = TEST_KEY_HEX;

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