Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@agiledigital/pino-redact-pii
Advanced tools
A collection of redaction solutions focused on Pino and redact-pii.
npm add @agiledigital/pino-redact-pii
This package contains a wrapper around redact-pii
that makes it convenient to plug into Pino.
To use it:
import { pino } from "pino";
import { pinoPiiRedactor } from "@agiledigital/pino-redact-pii";
// This uses the default redactor. You can specify your own as an argument to `pinoPiiRedactor`.
const redactor = pinoPiiRedactor();
const logger = pino({
formatters: {
log: redactor,
},
});
Finally, this package contains a safeStringify
function that provides a few benefits over JSON.stringify
. You can use it without Pino.
JSON.stringify
would throw). It replaces them with "[circular]"
, similar to Node's util.inspect
(but with no Node dependency).JSON.stringify
). The workarounds are the same as for JSON.stringify
. See https://github.com/GoogleChromeLabs/jsbi/issues/30import { defaultRedactor, safeStringify } from "@agiledigital/pino-redact-pii";
const obj = { text: "I might contain PII" };
// No redaction
const result = safeStringify(obj);
if (result.success) {
const str = result.value;
}
// With redaction
const reactor = defaultRedactor();
const result2 = safeStringify(obj, reactor);
The underlying redactor from the redact-pii
package can take a few seconds to start up. This happens when the first redaction is performed.
You can preemptively initialise the redactor and get this startup out of the way by redacting a dummy string and throwing away the result.
// Using the underlying SyncRedactor directly.
import { SyncRedactor } from "redact-pii";
new SyncRedactor().redact("");
// Or using our own default redactor (which wraps SyncRedactor).
import { defaultRedactor } from "@agiledigital/pino-redact-pii";
defaultRedactor().redact("");
# make sure the right version of node is being used
# tip: it might be worth automating this (https://github.com/nvm-sh/nvm#bash)
nvm use
# install dependencies
npm install
# compile
npm run build
# run the compiled code
node dist/index.js
If you are using VSCode, it should automatically recommend you some important plugins for this package (e.g. eslint) If not, check the .vscode/extensions.json because they will greatly improve your workflow.
FAQs
Pino + redact-pii
We found that @agiledigital/pino-redact-pii demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.