Skip to content

Commit f751544

Browse files
author
Eldar B
authored
Merge pull request #48 from PCOffline/feature/secure-debug
Feature/secure debug
2 parents 2649b5c + cc3d2d1 commit f751544

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22

3-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
3+
### [0.4.2](https://github.com/pcoffline/reset-db/compare/v0.4.1...v0.4.2) (2022-10-08)
4+
5+
6+
### Features
7+
8+
* dont log sensitive info by default in debug ([19be06d](https://github.com/pcoffline/reset-db/commit/19be06d89d39049693970f57b2f615037f1b7b64))
49

510
### [0.4.1](https://github.com/pcoffline/reset-db/compare/v0.4.0...v0.4.1) (2022-10-08)
611

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default {
2525
preferPath: true, // When both path and data are provided, ignore the data and only use the path. If false, only the data will be used in such case.
2626
logLevel: 'info', // 'debug' | 'info' | 'warn' | 'error' | 'silent'
2727
mongoUri: 'mongodb://localhost:27017/my-database', // Can also be retrieved from environment variable: MONGO_URI, MONGODB_URI, DB_URI, DATABASE_URI or mongoUri
28+
sensitiveDebugLog: false, // Log information that is considered sensitive (such as the MongoDB URI) in debug mode.
2829
collections: {
2930
collectionName: {
3031
schema: new Schema({

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ const standardCollections = [];
9292

9393
function logDebugData() {
9494
if (logLevel > logLevels.debug) return;
95+
const { dbUri, ...printableConfig } = config;
9596

9697
logDebug(`[${logDebugData.name}]`, 'Log Level:', logLevel);
97-
logDebug(`[${logDebugData.name}]`, 'Config:', JSON.stringify(config));
98+
logDebug(`[${logDebugData.name}]`, 'Config:', JSON.stringify(config.insecureDebugLog ? printableConfig : config));
9899
logDebug(`[${logDebugData.name}]`, 'Standard Collections:', JSON.stringify(standardCollections));
99100
}
100101

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "reset-db",
33
"type": "module",
4-
"version": "0.4.1",
4+
"version": "0.4.2",
55
"description": "A fast and easy way to reset your collections",
66
"main": "index.js",
77
"scripts": {

0 commit comments

Comments
 (0)