Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
gulp-dynamic-name
Advanced tools
gulp-dynamic-name is a gulp plugin to rename files easily.
gulp-dynamic-name is heavily based on the gulp-rename package, extending it to allow for dynamic naming of files within a stream using a structured object on the first line of the file. Useful for naming and building files in a build process when combined with the likes of Jade.
It provides all the features and methods of gulp-rename plus an extended feature set
Assuming your using Jade to build out a series of templates
//- { "dest_path": "./dist", "dest_name" : "lazy-dog" }
doctype html
html
body
P The Quick Brown Fox Jumped Over The Lazy Dog
var rename = require("gulp-dynamic-name");
var linereader = require("line-reader");
var intercept = require('gulp-intercept');
// dynamically naming and positioning a jade file
return gulp.src('path/to/jade/files/*.jade')
.pipe( intercept( function(file){
// Read the first line of the Jade file for any local, file level settings
linereader.eachLine(file.path, function(line, last, cb)
{
var ob;
try {
ob = JSON.parse( line.substring(4) );
file.data = {
'targetpath' : ob.dest_path,
'filename' : ob.dest_name };
ps.resume();
} catch( err ) {
file.data = {'targetpath' : cpath };
ps.resume();
}
})
return file;
}))
.pipe(jade({
locals: MERGED,
pretty: true
})
.pipe(rename({
extname: '.foo',
useconfig: true
}))
.pipe( gulp.dest( function(file, t) {
return String( file.data.targetpath );
})) // Builds the Jade files to /dist/lazy-dog.foo
extname
is the file extension including the '.' like path.extname(filename).dest_path
is the path to where the compiled file should be sentdest_name
the base name the file should be calledFAQs
Dynamically rename files during a jade build process
We found that gulp-dynamic-name 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.