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-awspublish
Advanced tools
awspublish plugin for gulp
First, install gulp-awspublish
as a development dependency:
npm install --save-dev gulp-awspublish
Then, add it to your gulpfile.js
:
var awspublish = require('gulp-awspublish');
gulp.task('publish', function() {
// create a new publisher
var publisher = awspublish.create({ key: '...', secret: '...', bucket: '...' });
// define custom headers
var headers = {
'Cache-Control': 'max-age=315360000, no-transform, public'
// ...
};
return gulp.src('./public/*.js')
// gzip, Set Content-Encoding headers and add .gz extension
.pipe(awspublish.gzip({ ext: '.gz' }))
// publisher will add Content-Length, Content-Type and Cache-Control headers
// and if not specified will set x-amz-acl to public-read by default
.pipe(publisher.publish(headers));
// create a cache file to speed up consecutive uploads
.pipe(publisher.cache())
// print upload updates to console
.pipe(awspublish.reporter());
});
add an aws-credentials.json json file to the project directory with your bucket credentials, then run mocha.
{
"key": "...",
"secret": "...",
"bucket": "..."
}
create a through stream, that gzip file and add Content-Encoding header.
Available options:
Create a Publisher. Options are passed to knox to create a s3 client.
Create a through stream, that push files to s3.Publish take a header
object that add or override existing s3 headers.
Files that go through the stream receive extra properties:
Create a through stream that create or update a cache file using file s3 path and file etag. Consecutive runs of publish will use this file to avoid reuploading identical files.
Cache file is save in the current working dir and is named.awspublish-bucket. The cache file is flushed to disk every 10 files just to be safe :).
create a transform stream that delete old files from the bucket. Both new and delete files are written to the stream. Deleted file will have s3.state property set to delete.
warning
sync
will delete files in your bucket that are not in your local folder.
// this will publish and sync bucket files with the one in your public directory
gulp.src('./public/*')
.pipe(publisher.publish())
.pipe(publisher.sync())
.pipe(awspublish.reporter());
The knox client object exposed to let you do other s3 operations.
Create a reporter that logs s3.path and s3.state (delete, create, update, cache, skip).
Available options:
// this will publish,sync bucket files and print created, updated and deleted files
gulp.src('./public/*')
.pipe(publisher.publish())
.pipe(publisher.sync())
.pipe(awspublish.reporter({
states: ['create', 'update', 'delete']
}));
FAQs
gulp plugin to publish files to amazon s3
The npm package gulp-awspublish receives a total of 21,424 weekly downloads. As such, gulp-awspublish popularity was classified as popular.
We found that gulp-awspublish demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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.