
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@utrustdev/react-s3-post-uploader
Advanced tools
React component that handle uploading to S3 bucket via POST.
React component for S3 uploads via POST (only) (sigv4-post-example).
$ npm install --save @utrustdev/react-s3-post-uploader
Working full example (eg. with rendering errors) is here
import S3PostUploader from '@utrustdev/react-s3-post-uploader';
class Uploads extends Component {
setInputRef = input => {
this.uploadInput = input;
};
onClick = event => {
event.preventDefault();
this.uploadInput.click();
};
onUploadStart = () => {...}
onUploadProgress = (progressEvent) => {...}
onUploadFinish = (uploadResult, file) => {...}
onUploadError = error => {...}
getCredentials = (file, callback) => {
fetch('url-returning-credentials-for-post-upload')
.then(response => {
return response.json();
})
.then(({url, fields}) => {
callback(file, {
upload_url: url,
params: {
acl: fields.acl,
key: fields.key,
policy: fields.Policy,
success_action_status: fields.success_action_status,
'content-type': fields['Content-Type'],
'x-amz-signature': fields['X-Amz-Signature'],
'x-amz-algorithm': fields['X-Amz-Algorithm'],
'x-amz-date': fields['X-Amz-Date'],
'x-amz-credential': fields['X-Amz-Credential'],
},
});
})
}
render() {
<S3PostUploader
onStart={this.onUploadStart}
onProgress={this.onUploadProgress}
onFinish={this.onUploadFinish}
onError={this.onUploadError}
getCredentials={this.getCredentials}
inputRef={this.setInputRef}
/>
<div>
<Button onClick={this.onClick} variant="outlined" component="span">
Upload Attachments
</Button>
</div>
}
}
onStart
- method called when uploading is started. Can be used to set some uploading state.onProgress
- allows handling of progress events for uploads. The eventProgress struct is passing to function {loaded: number, total: number, lengthComputable: boolean, ...}
. See usability for displaying uploaded percentage hereonFinish
- function getting (s3Result, file)
where s3Result
is result from S3 and file is chosen file.
You can find relevant types here (type S3Result ...)onError
- function getting (error)
. Error returning from S3 if something went wrong with upload. Relevant type in here (type Error ...)getCredentials
- function getting (file, callback)
. File is chosen file. The callback
is function
responsible for uploading file on S3 via POST with required credentials we were fetched from server.inputRef
- function getting reference to original file field. Used for save reference in component and
call actions later on it (as shown in simple example above).In example folder you can find working example with server. In readme of example are instructions for running.
Contribution
sectionPlease create an issue or open a pull request. Once you change something in src/S3PostUploader.jsx
please don't
forget to run yarn build
which will compile and also update S3PostUploader componnent in example. After
this make sure example app is still working.
PUT
upload with pressigned URL (PresignedUrlUploadObject)FAQs
React component that handle uploading to S3 bucket via POST.
We found that @utrustdev/react-s3-post-uploader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.