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.
git-diff-tree
Advanced tools
Shelling out to git-diff-tree(1) in a Node streamy fashion.
gitDiffTree(repoPath, [options]);
Where options defaults to:
{
rev : 'HEAD',
originalRev : '--root',
// don't output data for files that have more lines changed than allowed
MAX_DIFF_LINES_PER_FILE: 300,
// when the diff output is bigger than the limit destroy the stream
MAX_DIFF_SIZE: (3 * 1024 * 1024) // 3 Mb
}
Example:
var gitDiffTree = require('git-diff-tree');
var path = require('path');
var repoPath = path.resolve(process.env.REPO || (__dirname + '/../.git'));
gitDiffTree(repoPath).on('data', function(type, data) {
if (type === 'raw') {
console.log('RAW DATA');
} else if (type === 'patch') {
console.log('PATCH DATA');
} else if (type === 'stats') {
console.log('FILE STATS');
} else if (type === 'noshow') {
console.log('Diffs not shown because files were too big');
}
console.log('------ \n');
console.log(data);
console.log('=================\n');
// console.log(type, data);
}).on('error', function(err) {
console.log('OH NOES!!');
throw err;
}).on('cut', function() {
console.log('-----------------');
console.log('Diff to big, got cut :|');
}).on('end', function() {
console.log('-----------------');
console.log("That's all folks");
});
npm test
MIT
FAQs
Shelling out to git-diff-tree(1) in a Node streamy fashion
We found that git-diff-tree 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.