
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
gulp-md5-thing
Advanced tools
Insert MD5 hash into a filenames and update a dictionary of information about the hashes and renamed files
Insert an MD5 hash into afilenames and retrieve information about the generated hash and hashed filename
npm install --save-dev gulp-md5-thing
var md5Dict = {};
var gulp_md5_thing = require("gulp-md5-thing");
gulp.src("./src/*.ext")
.pipe(gulp_md5_thing( arg ))
.pipe(gulp.dest("./dist"));
Type: `String` or `Object`
Optional:
If type == `String`:
'arg' is a number representing the number of characters from the md5 hash string to be used in the filename
If type == `Object`:
'arg' may have any or all of the following properties :
'size' : A number representing the number of characters from the md5 hash string to be used in the filename
'separator' : A custom separator between the filename and the md5 hash ( e.g. '', '_', '---' )
'inject' : A string 'search and replace' token.
If provided, and if the token string is present in the file it will be replaced with the md5 hash,
calulated on the file's contents before the hash is injected.
'md5info' : A reference to a dictionary which will be populated with an entry for each filename processed during execution.
Each entry will contain the following properties after execution:
'hash' : The md5 hash created (truncated if 'size' was specified)
'hashedfilename' : The new filename with md5 hash inserted
'hashedfilepath' : The new filepath with md5 hash inserted
Default: If arg is omitted a full 32 character md5 hash is used and the separator is '-'
Given the directory structure:
top/
├── src/
├── file.a.ext
├── file.b.ext
├── file.c.ext
├── file.d.txt
├── dist/
├── ...
and a set of source files, one of which (file.a.ext) contains the replacement token string : '{{MD5_HASH}}'
var md5_info = {};
gulp.src('src/**/*.ext', {base: './top'})
.pipe(gulp_md5_thing({size:6, inject:'{{MD5_HASH}}', separator:'_', md5info:md5_info}))
.pipe(gulp.dest('./dist'));
will result in:
top/
├── src/
├── file.a.ext
├── file.b.ext
├── file.c.ext
├── file.d.txt
├── dist/
├── file.a_6b85e3.ext
├── file.b_53ef22.ext
├── file.c_2b86b1.ext
├── ...
and
console.log( md5_info['file.a.ext'].hash ); // 6b85e3
console.log( md5_info['file.a.ext'].hashedfilename ); // file.a_6b85e3.ext
console.log( md5_info['file.a.ext'].hashedfilepath ); // src/file.a_6b85e3.ext
. . .
etc.
and '{{MD5_HASH}}' will be replaced with '6b85e3' in file.a_6b85e3.ext
FAQs
Insert MD5 hash into a filenames and update a dictionary of information about the hashes and renamed files
We found that gulp-md5-thing 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.