Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

heap-snapshot-sanitizer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heap-snapshot-sanitizer

Stream transform implementation to sanitize heap snapshot.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by133.33%
Maintainers
1
Weekly downloads
 
Created
Source

heap-snapshot-sanitizer

Stream transform implementation to sanitize heap snapshot. This is to redact sensitive data in the heap snapshots. All strings which are not name of nodes or edges are obfuscated.

why is it needed?

Heap-snapshots are helpful to diagnose memory leaks. One reason they are discouraged in production is that they can contain sensitive data like PII. Obfuscating strings in the heap-snapshot tries to remediate this.

sample usage

  ...
  const Sanitizer = require('heap-sanpshot-santizer');
  ...

  const session = new inspector.Session();
  const fstrm = fs.createWriteStream(filename);
  const sanitizer = new Sanitizer(/*options*/);
  
  session.connect();

  sanitizer.pipe(fstrm);
  fstrm.on('error', (e) => {
    // console.error(e);
  });
  sanitizer.on('error', (e) => {
    // console.error(e);
  });
  sanitizer.on('end', function() {
    sanitizer.unpipe();
    // fstrm.end(); // unpipe should end the filestream
  });
  session.on('HeapProfiler.addHeapSnapshotChunk', (m) => {
    sanitizer.write(m.params.chunk);
    sanitizer.resume();
  });

  session.post('HeapProfiler.takeHeapSnapshot', null, (err, r) => {
    // console.log('Runtime.takeHeapSnapshot done:', err, r);
    session.disconnect();
    sanitizer.end();
  });
  ...

options

  • useWorkerThread: {Boolean} Default is false. The chunk is processed in the worker thread. Node.js clones the chunk while passing it over to the worker thread.

Keywords

FAQs

Package last updated on 05 May 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc