
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
posthtml-nonce
Advanced tools
A posthtml plugin create whitelist for specific inline scripts,styles,images,media using a cryptographic nonce
The HTTP Content-Security-Policy response header allows web site administrators to control resources the user agent is allowed to load for a given page. With a few exceptions, policies mostly involve specifying server origins and script endpoints. This helps guard against cross-site scripting attacks (XSS).
Used in conjunction with the
middleware
npm i -S posthtml posthtml-nonce
Note: This project is compatible with node v6+
import {readFileSync, writeFileSync} from 'fs';
import posthtml from 'posthtml';
import posthtmlNonce from 'posthtml-nonce';
const html = readFileSync('input.html', 'utf8');
posthtml()
.use(posthtmlNonce({tags: ['links'], nonce: '4f90d13a42'}))
.process(html)
.then(result => {
writeFileSync('output.html', result.html);
});
input.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<img data-src="logo.svg" alt="">
<script src="script.js"></script>
</body>
<html>
output.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" nonce="4f90d13a42">
</head>
<body>
<img data-src="logo.svg" alt="">
<script src="script.js"></script>
</body>
<html>
will be added nonce attribute with nanoid
tagsType: Array(required)
Default: []
Description: You can also expand the list by adding the tags you need...
nanoidType: String(required)
Default: ``
Description: nanoid
FAQs
A posthtml plugin for add nanoid to style & script links
We found that posthtml-nonce demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.