
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
upload-file
Advanced tools
Some options is borrowed from jquery.upload
var Upload = require('upload-file');
npm install upload-file --save
app.post('/upload', function(req, res) {
var upload = new Upload({
dest: 'dest/path',
maxFileSize: 100 * 1024,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
rename: function(name, file) {
console.log(this.fields);
return file.filename;
}
});
upload.on('end', function(fields, files) {
if (!fields.channel) {
this.cleanup();
this.error('Channel can not be empty');
return;
}
res.send('ok')
});
upload.on('error', function(err) {
res.send(err);
});
upload.parse(req);
});
options
required
options.dest
requiredoptions.acceptFileTypes
options.rename(name, file)
[options.maxNumberOfFiles=Infinity]
[options.minNumberOfFiles=1]
[options.maxFileSize=Infinity]
[options.minFileSize=0]
options.messages
Inherit from node's EventEmitter
Parse the http request
If the form is invalid, you can invoke this method for clear unnecessary file
Emit error event with msg
The fields of form, it's a object
{
name: 'value',
city: ['1', '2']
}
The files of form, it's a obejct
{
file: {
filename: 'index.css',
path: 'upload/path/index.css',
type: 'text/css',
size: 100
},
files: [{...}, {...}]
}
// If the file.filename is empty string,
// it's means that user do not upload file with this file input
upload-file
modules pathFAQs
Simplified file upload
We found that upload-file 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.