Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
keystone-s3-upload-adapter
Advanced tools
[![NPM](https://nodei.co/npm/keystone-s3-upload-adapter.png)](https://nodei.co/npm/keystone-s3-upload-adapter/)
S3File
Upload. The main issue with that library is that it is based on knox
which not up to date. So this library is an aws-sdk
version of the same. The usage is exactly the same as of the original one.knox
was not able to incorporate all of them.This adapter is designed to replace the existing S3File
field in KeystoneJS using the new storage API.
Compatible with Node.js 0.12+
Install Package:
npm install --save keystone-s3-upload-adapter
Configure the storage adapter:
var s3Storage = new keystone.Storage({
adapter: require('keystone-s3-upload-adapter'),
s3: {
key: 's3-key', // required; defaults to process.env.S3_KEY
secret: 'secret', // required; defaults to process.env.S3_SECRET
bucket: 'bucket', // required; defaults to process.env.S3_BUCKET
region: 'region', // optional; defaults to process.env.S3_REGION, or if that's not specified, us-east-1
path: 'images',
headers: {
'x-amz-acl': 'public-read', // add default headers; see below for details
},
},
schema: {
bucket: true, // optional; store the bucket the file was uploaded to in your db
etag: true, // optional; store the etag for the resource
path: true, // optional; store the path of the file in your db
url: true, // optional; generate & store a public URL
},
});
Use it as a type in Keystone Field (Example Below):
imageUpload: {
type: Types.File,
storage: s3Storage,
filename: function (item, file) {
return encodeURI(item._id + '-' + item.name);
},
},
The adapter requires an additional s3
field added to the storage options. It accepts the following values:
key: (required) AWS access key. Configure your AWS credentials in the IAM console.
secret: (required) AWS access secret.
bucket: (required) S3 bucket to upload files to. Bucket must be created before it can be used. Configure your bucket through the AWS console here.
region: AWS region to connect to. AWS buckets are global, but local regions will let you upload and download files faster. Defaults to 'us-standard'
. Eg, 'us-west-2'
.
path: Storage path inside the bucket. By default uploaded files will be stored in the root of the bucket. You can override this by specifying a base path here. Path can be either absolute, for example '/images/profilepics', or relative, for example 'images/profilepics'.
headers: Default headers to add when uploading files to S3. You can use these headers to configure lots of additional properties and store (small) extra data about the files in S3 itself. See AWS documentation for options. Examples: {"x-amz-acl": "public-read"}
to override the bucket ACL and make all uploaded files globally readable.
The S3 adapter supports all the standard Keystone file schema fields. It also supports storing the following values per-file:
The main use of this is to allow slow data migrations. If you don't store these values you can arguably migrate your data more easily - just move it all, then reconfigure and restart your server.
FAQs
[![NPM](https://nodei.co/npm/keystone-s3-upload-adapter.png)](https://nodei.co/npm/keystone-s3-upload-adapter/)
The npm package keystone-s3-upload-adapter receives a total of 5 weekly downloads. As such, keystone-s3-upload-adapter popularity was classified as not popular.
We found that keystone-s3-upload-adapter 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 malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.