DEV Community

Cover image for How I Created a File Sharing Website using Simple REACT

How I Created a File Sharing Website using Simple REACT

Varshith V Hegde on July 25, 2023

Introduction Welcome Dev Enthusiasts! In this blog, I will take you through the journey of developing FreeShare, a free online file shar...
Collapse
 
miketalbot profile image
Mike Talbot ⭐

Seems like a 5 digit pin would be easy for a hacker to guess, or provide by a DDoS attack, have you protected against that?

Collapse
 
varshithvhegde profile image
Varshith V Hegde

I know about it. Its only for single use only. Therefore if user uploads the file and then intended user downloads it. It will automatically delte all the related files, metadata and everything from the db.

Collapse
 
miketalbot profile image
Mike Talbot ⭐ • Edited

Yeah it's just someone could get it before the intended recipient etc. I can see the attraction of a 5 digit pin for ease of entry, just 100k combinations seems like too few.

  • You could ban IP addresses that get the wrong PIN more than x times (say 5) for a number of minutes.

  • You could rate limit IP addresses to x calls a minute.

  • You could make your PINs be alpha numeric. A 4 digit A-Z0-9 PIN would have 4.5x more combinations, a 5 digit PIN like this would have 118x more.

Also, at present you are using Math.random() - this is a sequence that is well known by hackers - by creating a few links of their own they'd have a good chance of working out the previous and subsequent PINs you were creating with minimal effort - this would negate all of these strategies. You should use a cryptographically secure method of generating randoms when used for purposes like this.

Thread Thread
 
miketalbot profile image
Mike Talbot ⭐

One more thought, you could use a What Three Words type of approach and give people a 3 or 4 word phrase - very very hard to guess by brute force (unless your candidate word list is in the open), quite easy to remember and a large number of combinations with just a few dozen words.

Thread Thread
 
varshithvhegde profile image
Varshith V Hegde

Yeah sure I will surely try to implement. Thanks for your valuable feedback.

Thread Thread
 
miketalbot profile image
Mike Talbot ⭐

Good luck with it, looks like a very cool project :)

Thread Thread
 
varshithvhegde profile image
Varshith V Hegde

Thanks

Collapse
 
varshithvhegde profile image
Varshith V Hegde • Edited

But if you have any suggestions I am open to it. And will try to implement it for sure.

Collapse
 
jcubic profile image
Jakub T. Jankiewicz • Edited

I have my own similar project created with Vanilla JavaScript. It doesn't use any storage at all. It use WebRTC and unique names to send file from one computer to the other directly. I use it all the time when I want to send files from one laptop to other or send it to my phone.

GitHub logo jcubic / webrtc-share

Application for sharing files using WebRTC

webrtc-share

Application for sharing files using WebRTC

Vector illustration with computers, file icon and arrows

License

Released with GNU AGPL 3 license

Copyright (C) 2019 Jakub T. Jankiewicz <jcubic.pl>




Collapse
 
varshithvhegde profile image
Varshith V Hegde

Its a great project. I am also developing similiar one using webrtc but its still in development. But main disadvantage is recieving side should also be ready for sending the files.

Collapse
 
vulcanwm profile image
Medea

great article and interesting project!

Collapse
 
varshithvhegde profile image
Varshith V Hegde • Edited

Yeah please check it out and your feedback is valuable to me freeshare.vercel.app/

Collapse
 
vulcanwm profile image
Medea

dude this is amazing.
it would be nice if instead of having to input the id in the form, you can just share a url which automatically links to a file.
also maybe change the download file button to view file since users may misunderstand that button and believe that they are about to download the file instead of opening it in a new tab

Thread Thread
 
varshithvhegde profile image
Varshith V Hegde

Yes , Thanks for the feedback. About the downloading in the same tab problem with this is my storage and website hosted is diffenrent network or platform thus it impossible to download it on the same tab it will always open in new tab . This is the same problem i got in my previous project too.

Thread Thread
 
vulcanwm profile image
Medea

i don't think it's important to have a download button since if you have a file opened in a tab you can automatically download it

Collapse
 
soanvig profile image
Mateusz Koteja • Edited

Check out 'croc'. Your solution sounds similar to Firefox Send (or its nowadays forks). 'croc' approach is far more superior

Collapse
 
varshithvhegde profile image
Varshith V Hegde

Sure!!

Collapse
 
mulugetanigus profile image
Muller_King

Good luck, looks like a very cool project :)

Collapse
 
varshithvhegde profile image
Varshith V Hegde

Thank You !!

Collapse
 
m_hashir147 profile image
Mohamed Hashir

Fantabulous

Collapse
 
varshithvhegde profile image
Varshith V Hegde

Thank You!!

Collapse
 
nextupweb profile image
nextupweb

Nice Project Dude

Collapse
 
varshithvhegde profile image
Varshith V Hegde

Thank You

Collapse
 
thepracticaldevgod profile image
The Practical Dev God

Wow it is very great blog . I am new to dev still it is a quality Content . I am gonna use freeshare everyday now.

Collapse
 
varshithvhegde profile image
Varshith V Hegde

Thank You so much I am greatful for your kind words