Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redaction doesn't work on Browser #670

Closed
mrsimonemms opened this issue Jun 23, 2019 · 5 comments
Closed

Redaction doesn't work on Browser #670

mrsimonemms opened this issue Jun 23, 2019 · 5 comments

Comments

@mrsimonemms
Copy link
Contributor

Versions:

Pino: 5.12.6
Node: various, including 10.15.3
Browser: various, including Firefox 67, Chrome 75

I'm running Pino for both my front end and back end apps and the redaction doesn't seem to work in browser mode.

Backend

const pino = require('pino');
const logger = pino({
  name: 'test',
  level: 'info',
  redact: [
    'password'
  ]
});

logger.info({ password: 'pass1', hello: 'world' }, 'Password test');

This outputs:

{
  "level":30,
  "time":1561304419142,
  "pid":8064,
  "hostname":"hostname",
  "name":"test",
  "password":"[Redacted]",
  "hello":"world",
  "msg":"Password test",
  "v":1
}

However, the same code in a browser displays the password as pass1 without redaction, even with the browser config options:

const pino = require('pino');
const logger = pino({
  name: 'test',
  level: 'info',
  redact: [
    'password'
  ],
  browser: {
    asObject: true,
    serialize: true
  }
});

From looking through the code, it doesn't seem to be applied at all but the documentation for redaction implies that this should work the same for browser and server.

@davidmarkclements
Copy link
Member

davidmarkclements commented Jun 23, 2019 via email

@mrsimonemms
Copy link
Contributor Author

Nah, I don't have any particular need for it. I was trying something out and noticed that the redaction doesn't work. All it probably needs is a one-liner in the docs (will raise PR with this in soon)

@amcdnl
Copy link

amcdnl commented Dec 29, 2021

I would like to upvote need for redaction in browser.

Use case: Application that is a react app that needs to log errors/etc and then dump for remote debugging logs.

@davidmarkclements
Copy link
Member

@amcdnl a PR would be more than welcome

@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants