
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
gulp-sri-php
Advanced tools
Scan PHP files in Gulp and process script and stylesheet tags to add SRI attributes
Scan PHP (or other HTML-based) files in Gulp and process script and stylesheet tags to add Sub-Resource Integrity (SRI) attributes.
I tried other plugins, but found the following issues...
For these reasons, I decided to write my own.
This plugin doesn't worry about non-HTML tags (such as PHP), it uses the built in crypto module, and it updates the HTML tags that it finds as it goes. It also allows for multiple algorithms to be specified, which is pretty cool.
Tags will be ignored for the following reasons...
Just to clarify, this plugin isn't specifically for PHP files, but will work with HTML tags in any file, such as a PHP file, without worrying about the non-HTML parts.
npm install gulp-sri-php --save-dev
var gulp = require("gulp");
var pump = require("pump");
var sri = require("gulp-sri-php");
var phpFiles = ["index.php"];
gulp.task("php",function(cb) {
pump([
gulp.src(phpFiles),
sri({verbose:true,algorithm:"sha384"}),
gulp.dest("build")
],cb);
});
<!DOCTYPE html>
<html lang="en-gb">
<head>
<title>gulp-sri-php</title>
<link rel="stylesheet" href="css/style.css">
<script src="js/script.js" defer></script>
</head>
<body>
<!-- etc -->
</body>
</html>
<!DOCTYPE html>
<html lang="en-gb">
<head>
<title>gulp-sri-php</title>
<link rel="stylesheet" href="css/style.css" integrity="sha384-54Zl+ll6X3PdHPKfBjEU8TtSZc29x/y3anYm06KOlBpMAZcRS9Zw4YwloXptTN0n" crossorigin="anonymous">
<script src="js/script.js" defer integrity="sha384-1hPB2dkVqfc4TsrWjuj7Ot6EjZpPCT8SXkMPcFVS72GywaLYlgGGC21Bden2FYc0" crossorigin="anonymous"></script>
</head>
<body>
<!-- etc -->
</body>
</html>
FAQs
Scan PHP files in Gulp and process script and stylesheet tags to add SRI attributes
We found that gulp-sri-php 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.