Socket
Socket
Sign inDemoInstall

@npmcli/redact

Package Overview
Dependencies
0
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @npmcli/redact

Redact sensitive npm information from output


Version published
Weekly downloads
1.9M
increased by8.38%
Maintainers
5
Install size
4.34 kB
Created
Weekly downloads
 

Changelog

Source

1.1.0 (2024-04-03)

Features

Readme

Source

@npmcli/redact

Redact sensitive npm information from output.

API

This will redact npm_ prefixed tokens and UUIDs from values.

It will also replace passwords in stringified URLs.

redact(string)

Redact values from a single value

const { redact } = require('@npmcli/redact')

redact('https://user:pass@registry.npmjs.org/')
// https://user:***@registry.npmjs.org/

redact(`https://registry.npmjs.org/path/npm_${'a'.repeat('36')}`)
// https://registry.npmjs.org/path/npm_***

redactLog(string | string[])

Redact values from a string or array of strings.

This method will also split all strings on \s and = and iterate over them.

const { redactLog } = require('@npmcli/redact')

redactLog([
  'Something --x=https://user:pass@registry.npmjs.org/ foo bar',
  '--url=http://foo:bar@registry.npmjs.org',
])
// [
//   'Something --x=https://user:***@registry.npmjs.org/ foo bar',
//   '--url=http://foo:***@registry.npmjs.org/',
// ]

FAQs

Last updated on 03 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc