question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

redacting secrets

See original GitHub issue

I am interested in integrating a library that optionally redacts-secrets from log messages. Perhaps something like - https://www.npmjs.com/package/redact-secrets.

Wondering if there is an appetite for a PR of this nature?

One way to accomplish this today is to do something like this. However, this is harder to do when the output format is not an object.

   const redact = require('redact-secrets')('[REDACTED]');
   const winston = require('winston');

   winston.configure({
      transports: [
        new (winston.transports.File)({ 
          filename: 'somefile.log',
          json: false,
          prettyPrint: (json) => JSON.stringify(redact.map(json), null, 2)
        })
      ]
    });

This proposal would apply this internally before the log message is serialized, make it’s application more reliable. Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
indexzerocommented, Apr 19, 2018

In winston@3.0.0 you can implement this using a custom format. Please consider upgrading.

const redact = require('redact-secrets')('[REDACTED]');
const { createLogger, format, transports } = require('winston');

const logger = createLogger({
  format: format.combine(
    // Redact any properties
    format(info => redact.map(info))(),
    // Then make it JSON
    format.json()
  )
  transports: [new transports.Console()]
}); 
6reactions
fi0rinicommented, Oct 6, 2020

This doesn’t work for me for some reason, there is no output when adding the redact formatter

Read more comments on GitHub >

github_iconTop Results From Across the Web

redact-secrets - npm
Deeply iterate over an object and redact secret values by replacing them with a predefined string. Latest version: 1.0.0, last published: 6 ...
Read more >
watson/redact-secrets: Deeply iterate over an object ... - GitHub
Deeply iterate over an object and redact secret values by replacing them with a predefined string - GitHub - watson/redact-secrets: Deeply ...
Read more >
Secret redaction | Databricks on AWS
Learn how redaction protects Databricks secrets from accidental display and how to ensure proper control of secrets.
Read more >
1.15.4.8 Redacting credentials - Concourse CI
4.8 Redacting credentials. Concourse can be configured to automatically redact credentials from build output like so: CONCOURSE_ENABLE_REDACT_SECRETS=true. This ...
Read more >
Stop pixelating! New tool reveals the secrets of "redacted ...
New tool reveals the secrets of "redacted" documents. Imagine you want to publish online an image of a document, but there are parts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found