Тёмный

How to Make Your React App Safer 

PedroTech
Подписаться 214 тыс.
Просмотров 41 тыс.
50% 1

Hey everyone, in this video I will be going over different ways to make your react application safer.
Join our Discord: / discord
🚀 Learn ReactJS By Building 6 Projects: codedamn.com/l...
🐙 GraphQL Course: codedamn.com/l...
► Buy Crypto on Coinbase: coinbase-consumer.sjv.io/PedroTech
Social
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Website: machadopedro.com
Linkedin: / machadop1407
Instagram: / _pedro.machado_
Github: github.com/mac...
Business Email: pedro@pedrotech.co
Tags:
ReactJS Tutorial
ReactJS and MySQL
NodeJS Tutorial
API Tutorial
#reactjs #security

Опубликовано:

 

6 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 85   
@o_glethorpe
@o_glethorpe Год назад
You mentioned that it's not good to store jwt in localstorage since is public, can be accessed by browsers extensions etc..., well, cookie can be accessed as well, httponly can be intercepted by extensions, so where would you store a jwt? The title says: How to Make Your React App Safer, but you only pointed out a problem...
@PedroTechnologies
@PedroTechnologies Год назад
I mean, there will always be vulnerability. For example, not only can httpOnly cookies be accessible by the chrome extension api, but if a browser doesn't support httpOnly cookies, then it will treat it like a normal cookie. My point with this wasn't to give a 100% solution, because there isn't one. I just pointed out what you should do to minimize the risk. The risk from using cookies is way less then the risk of using session/local storage.
@nonequivalence1864
@nonequivalence1864 Год назад
I've been a pro software engineer with over 6yrs of experience, here's my $0.02 on this - there really isn't a safe way to store tokens. Local storage, cookies, etc are all vulnerable. All websites, even major ones, use one of these and get hacked regularly but the media never talks about it due to not making their stock prices more volatile than it already is. The security of your application 99.9% depends on how well your backend is. Frontend code will ALWAYS be vulnerable no matter which framework, library or language you use which means your desired method of storing auth tokens "safely" is also vulnerable.
@adnanhussain1460
@adnanhussain1460 Год назад
agree
@AG-ur1lj
@AG-ur1lj Год назад
If only React were only front end code
@yousefwaleed-e9w
@yousefwaleed-e9w 11 месяцев назад
@nonequivalence1864 Could you please explain how do i make my back end more secure or provide me any blog or channel that you think it might help me I use node.js btw And Thank you ❤
@GoKotlinJava
@GoKotlinJava 11 месяцев назад
@@AG-ur1lj lmao
@edmonvevo5691
@edmonvevo5691 8 месяцев назад
pro software engineer ? it’s something new haha
@ozoemenabright7925
@ozoemenabright7925 Год назад
Not a new dev but you caught me there at saving cookies to local storage for easy accessibility. Thanks for the knowledge
@ThanHtutZaw3
@ThanHtutZaw3 Год назад
I also saved in localstorage too . but these info from firebase . May be it is safe.
@hyzyr
@hyzyr Год назад
Sorry, but nosense, cookies are same vulnerable to XSS attacks as localStorage, it doesn't matter where you store them, that's why we create tokens so they are encrypted, the only thing you can do is add a little more information in the token. such as the user's browser, device, and checking it on the backend
@eugeneesterhuizen4263
@eugeneesterhuizen4263 Год назад
Congrats on the 100k man! So happy that you keep going up, your channel has been a huge help and the content keeps getting better. Great job.
@tomasburian6550
@tomasburian6550 Год назад
Dude, you are among my top favorite dev video creators! Keep up the great job!
@rhiannonmonks6894
@rhiannonmonks6894 Год назад
Great discussion on JWT and your point about a huge hit via NPM packages is....accurate and scary!
@PedroTechnologies
@PedroTechnologies Год назад
@harimuthum3407
@harimuthum3407 Год назад
Please make a video on Authentication and Authorisation for React. Authentication and Authorisation for Node Express were very useful.
@uttekarlsson3265
@uttekarlsson3265 Год назад
Nice, could you do a tutorial on how to implement Pagination in React Table? Where you fetch next page by API and not load everything at once.
@uttekarlsson3265
@uttekarlsson3265 Год назад
He have made one before but not with react table. You can find it here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-HANSMtDy508.html. However I also prefer react table.
@adnanhussain1460
@adnanhussain1460 Год назад
@@uttekarlsson3265 implement the same logic with react table
@afickredox4121
@afickredox4121 Год назад
yesssir, thanks to make us up to date with ur videos and make me more aware what i'm doing with my web application , love it
@carliey
@carliey Год назад
Where should be store the jwt then pedro?
@davidrawlings7067
@davidrawlings7067 19 дней назад
Fantastic video! Thank you
@codewithguillaume
@codewithguillaume Год назад
About Next 13, how would you deal with authentication? :)
@PedroTechnologies
@PedroTechnologies Год назад
Tbh ive been sick so I haven't been totally up to date with the new release yet! I will try it out and for sure make a vid on my opinions!
@codewithguillaume
@codewithguillaume Год назад
@@PedroTechnologies oh god I hope you are doing better ! Thanks for your work my friend
@user-gnwolmgkqpcn15829
@user-gnwolmgkqpcn15829 10 месяцев назад
your advice is so good to think about even though mine is based on vue framework. thank you for your work and video.
@jay8118
@jay8118 Год назад
Love from India... 🙌
@PedroTechnologies
@PedroTechnologies Год назад
I love India ❤️
@spacepacehut3265
@spacepacehut3265 Год назад
@QURASHI AKEEL no one does🗿
@piuspolocha
@piuspolocha Год назад
Pedro this is nice video but we will really appreciate it if you build of full stack application consisting of Admin and user dashboard using JavaScript and nodejs for backend Thanks you are the best so far
@mahmoodnazari1004
@mahmoodnazari1004 Год назад
Hi Pedro, thanks for your useful tutorials. I learned a lot of things until now. If you make another video about "How to load content based on language changed from mongo DB with react js?", it will also become another useful video. Thanks
@ehfajkhan
@ehfajkhan 5 месяцев назад
Good one, would be better if you have explanation with some digrams.
@abongilebono7999
@abongilebono7999 Год назад
i agree local storage is not the best place to store your tokens. So as a beginner I'm asking which are the best places to store them ? It's important for me plz answer
@nikhilgupta6655
@nikhilgupta6655 Год назад
If you could animate things up and show us that instead of your face in full screen mode, I think that would be helpful. You can keep your face video at the bottom/ top in small screen overlapped like in streaming videos. Just a suggestion. Cheers
@realmanproject7529
@realmanproject7529 Год назад
Thanks, bro, xss is pretty interesting
@adnanhussain1460
@adnanhussain1460 Год назад
rock on Pedro, you're doing a great work and CONGRATS
@PanlasangMotour
@PanlasangMotour Год назад
Brother would like to ask can i apply it also on my angular app 🤔
@randomforest_dev
@randomforest_dev Год назад
Thanks for your video! Is there any solution for securely storing jwt token ? If we store it in httpOnly cookie, we need server side proxy for our react app (which means our react app will become a Nodejs app) or if our REST Api handle cookies, it will become stateful which is against REST.
@Stormface16
@Stormface16 Год назад
Had the same thing on my table today as well, i really hoped there was a solution given here
@Weagle1337
@Weagle1337 Год назад
Nowadays all methods has a vulnerability problem, it's easy to say that save JWT in LocalStorage is dangerous, but nothing is a silver bullet, you just must take a lot of care of your backend, rotating the JWT signature secret regulary and having a system that allows the user to invalidate/ban a stolen JWT based on the identity saved on it
@SxAde
@SxAde Год назад
Hi! In the example you gave where the user manually types a URL, is it safe to just set the input type to "url"? I found out that forms do validate url input types when calling the onChange and onSubmit events, but I wonder if that's enough and if it also works when the input is not within a form.
@victorohachor203
@victorohachor203 Год назад
Agreed... Except that you can manually change the input type to text in the developer tools before submitting. So, it is still not safe relying on it completely.
@jorgedavalos5663
@jorgedavalos5663 Год назад
would you ever do a todo tutorial or something like that trying solid.js?
@MrSYLVESTER444
@MrSYLVESTER444 18 дней назад
How do one create a backdoor in his react code just in case client failed to payup
@thegrizzlywolf5927
@thegrizzlywolf5927 Год назад
the only person ever when i heard him said please do like to this video i go fast to do the like thank u so much pedro
@synt-x6458
@synt-x6458 Год назад
Awesome. Would be great if you drop a video about S.E.O for react apps
@favouritejome
@favouritejome Год назад
Please could you make a video about Authentication, how to properly save jwt tokens without localstorage, how to refresh the token? I know this is a lot, but I've been having issues with this
@arzooqadri8805
@arzooqadri8805 Год назад
It's out of context but, can u make a Vedio on Api integration in React js. I'll appreciate it thnx!
@piero.guerrero
@piero.guerrero Год назад
So at the end, where to store the security tokens in the frontend?
@adnanhussain1460
@adnanhussain1460 Год назад
there isn't any foolproof way to store, its kind of anything is vulnerable on frontend and your app security 99% depends on your backend, so make a double check on backend upon token coming from frontend in a req when you are doing some critical action
@jsantos1220
@jsantos1220 Год назад
So whats the way to handle tokens? cookies? you didn't say it, or the answer is cookies with corrects cors?
@althafahd9872
@althafahd9872 Год назад
hi sir, in you github repo is their are any real world professional projects publically. plz can u refer one of them for review for me
@marianaangel5338
@marianaangel5338 Год назад
I liked the lesson so much! Good job! Still waiting for Nextjs with redux toolkit.....
@Babbili
@Babbili Год назад
create react app has never been safe with all these redos valunerablities
@hatosenshi
@hatosenshi Год назад
Hello pedro ! First of all, It's been like 1 year I wanted to leanr MERN but couldn't because I felt like the youtuber wasn't able to explain it well to a beginner. But after watching your 1 hour course, I want to thank you because I understand better now. But I have a little problem If you ( or someone else ) can help... I tried to connect my cluster to mongodb compass but I got this error "Server selection timed out after 30000 ms". Does someone knows what's the reason for this ? Thanks !
@tech3425
@tech3425 Год назад
*Alternative title* Battle Scars: PEDRO
@wizz1e80
@wizz1e80 7 месяцев назад
YOU DIDN'T GIVE ANY RECOMMENDATIONS ABOUT WHERE ELSE TO STORE TOKENS IF I'M NOT USING LOCAL STORAGE OR COOKIES WHAT DO I USE??????
@Wakkyguy
@Wakkyguy Год назад
If we have to retain the user session between revisits to our application, where should we store the jwt? Cookies?
@napoleonbonaparte1260
@napoleonbonaparte1260 Год назад
Redis cache
@Wakkyguy
@Wakkyguy Год назад
@@napoleonbonaparte1260 then we have to maintain user session on the server side.
@eliasgarcia1146
@eliasgarcia1146 Год назад
I was left with the same doubt since it does not mention where to store it
@Azoraqua
@Azoraqua Год назад
What I learned is that it's best to store JWT tokens in cookies, and use them for any API request as it goes on; Make sure to keep the tokens valid for a limited time-span, determined by the nature of the app. After that, revoke access (either directly, indirectly or even both).
@wagnerlessa5518
@wagnerlessa5518 Год назад
Joga duro man, parabens denovo.
@shinobi_coder88
@shinobi_coder88 Год назад
Pedro, if we're using like Firebase Auth, Auth0, or NextAuth isn't the JWT pre-handled already?
@umangbhatnagar1415
@umangbhatnagar1415 Год назад
lots of love and respect from INDIA
@orarbel167
@orarbel167 Год назад
I didn't understand why jwt in localstorage is unsafe 🙈 If the jwt is encrypted what can a attacker do with it? The attacker also doesn't have the BE details (its in .env file) so the attacker can't use the jwt to update the data in the DB
@abdirahmann
@abdirahmann Год назад
you have misundertood 4 things so i'll help you understand them. jwts are not encrypted, they are signed!, both encryption and signing use public private key pairs though, there is a difference between encryption and signing. for example: ENCRYPTION - 1. if i wanted to tell you a secret but there were alot of people that will listen to us, i will ENCRYPT the secret, we will agree beforehand on how to decrypt encrypted data, then i will encrypt the secret and give you the encrypted secret, since we both agreed on how to decrypt data before, you'll be able to decrypt the secret and read it, since all the other people dont know how to decrypt the secret, it will seem to them as a bunch of useless data. SIGNING - 2. on the other hand, if i wanted to announce something to the people and the people wanted to be 100% sure it was me and not an impersonator, i will announce my public key to the people and everyone will have a record of my public key, then i will SIGN the message that i want to announce with my private key, the people then receive my announcement and they will verify the signature in the message that i signed using my public key that i shared with them. 3 .If the jwt is encrypted what can a attacker do with it? - first of all, its not encrypted, its signed as you read above, infact you can go to jwt.io, paste in a jwt that you have and they'll tell you the information contained in the jwt. if an attacker gets hold of a jwt, they can impersonate the person that received that jwt from the backend, the backend only checks to see if the jwt is valid by checking if the signature on the jwt is valid and now that this attacker has a jwt they stole, the backend would allow them to do anything the owner could do and thats BAAAAAD. 4. The attacker also doesn't have the BE details (its in .env file) so the attacker can't use the jwt to update the data in the DB whatever logic you wrote in the app update the data in the db, your users dont update the DB directly, your backend does, and what else does your backend allow?? 🤔, it allows request from the user on the internet 😄, processes the requests and UPDATES the DB to store the information received from the user. you .env file defines what environment your app runs on and what DBs to connect to. The attacker initially doesnt know how your backend is setup BUT they can enumerate your backend by analyzing the response the app returns when they do certain things and hence why the pedro says its better to return a generic statement to the user instead of returning the message of the error which is usually contained in the message field (err.message) i hope this cleared up some confusion and taught you something new, have fun and take care byeeeeeeeeeee
@dixztube
@dixztube Год назад
@@abdirahmann great response. I learned a few things in there as far as jwt being signed
@sinc1802
@sinc1802 Год назад
@@abdirahmann This comment deserves a pin
@jeevandza3464
@jeevandza3464 Год назад
How extensions can excess my browser local storage, isn't that protected inside my browser ?.
@juanurani5839
@juanurani5839 Год назад
Yo said what not to do with jwt but you didn't say what to do with jwb...
@Pedro-gu7jj
@Pedro-gu7jj Год назад
mora no brasil mano ?
@ACHTech20
@ACHTech20 Год назад
That's encoding not encryption
@VishalSharma-rn7mt
@VishalSharma-rn7mt 10 месяцев назад
Awesome
@EAbdoAhmedSayed
@EAbdoAhmedSayed Год назад
Egyptian announced 11/ 11 a revolution against the decorators alsis Could you speak about Our Egyptian revolution
@imkir4n
@imkir4n Год назад
Nice vid pedro
@arunkb6452
@arunkb6452 Год назад
Love from kerala❤
@wagnerlessa5518
@wagnerlessa5518 Год назад
Rumo ao 1M
@oncoding4520
@oncoding4520 Год назад
like and comment done :)
@wagnerlessa5518
@wagnerlessa5518 Год назад
Mr Beast quem?
@palyanytsia
@palyanytsia 7 месяцев назад
This video just a waste of time. No examples or solutions provided
@huzaifac137
@huzaifac137 Год назад
It sucks to know you cannot use JWT safely in your client app that's why I'll stick to localStorage and JWT expiring after one hour until I'll learn httpOnly ( which is also not full safe)
@rayhanislam7518
@rayhanislam7518 Год назад
It's not effective for everyone. do code It'll helpful for everyone
Далее
UseEffect Mistakes Every Beginner Should Avoid
18:05
Просмотров 29 тыс.
Modern Data Fetching in React (Complete Guide)
16:41
Просмотров 52 тыс.
React Security Crash Course 2022
46:12
Просмотров 15 тыс.
You might not need useEffect() ...
21:45
Просмотров 163 тыс.
Preventing XSS Attacks in React
5:59
Просмотров 8 тыс.
How To Increase Performance in React Apps
14:19
Просмотров 26 тыс.
Why Signals Are Better Than React Hooks
16:30
Просмотров 479 тыс.
How To Learn React In 2024 - React Roadmap
20:51
Просмотров 11 тыс.
How To Debug React Apps Like A Senior Developer
21:07
Просмотров 147 тыс.