I recently saw a video in which they used react with node/express at the back, to do role based authorization. In that, once a user is authenticated, his job role is passed as a response to the react front end, which is then stored in states and used to render pages accordingly. So, how safe is this approach? Is it possible for someone like a normal user to tamper with the response coming from the server and modify it to something like "admin". Or is there some other approach which is safer. Please help me out as I'm fairly new to these topics.
How safe is job role based authorization in react?
1k Views Asked by Bichu Ben At
2
There are 2 best solutions below
0
Someone Special
On
Rule Number 1 - Never trust anything from client side.
Whatever information passed on to client side is purely for display purpose.
Every modification on the backend should contains verification of data before it's being inserted/updated into database, or before it's being used for any purpose for an intended user.
A user may change the role to see a different UI, but the UI should never attempt to retrieve information that's not meant for the user, or to accept any input from that user, if the user is not the rightful user.
Related Questions in NODE.JS
- How to solve CERT_UNTRUSTED error in nodemailer
- Run a loop over a callback, node js
- Implementing prerender.io middleware in sails.js
- Token based authorization in nodejs/ExpressJs and Angular(Single Page Application)
- formatting path string in javascript
- One to One screensharing using WEBRTC
- Create polygon from grid (for collisions)
- Strange npm behavior when installing packages like grunt
- Convert JSON.gz to JSON in node js
- "Your npm version is outdated." but it's not. While install yo
- Why put methods on the prototype of a class instead of declaring them in the constructor?
- Node JS Async Response
- mongoose get property from nested schema after `group`
- Cannot Receive Incoming call on Twilio android Client
- How can I change a specific line in a file with node js?
Related Questions in REACTJS
- What is `_dereq_()` inside React?
- React TypeError: React.renderComponent is not a function
- React - saving a component in the ref callback
- React Rails component: manually triggering a re-render
- React, ES6 - getInitialState was defined on a plain JavaScript class
- How to get multiple selected options value in React JS?
- React.render replace container instead of inserting into
- reactjs datagrid use html
- props is not initialized in react component
- How to display xml data using Reactjs
- hooking up the data model in ReactJS - syntax
- ReactJS: How to use an immutable empty array or object
- How to use Sinon.js FakeXMLHttpRequest with superagent?
- React select onChange is not working
- ReactJS - Tutorial Comment System > Threaded commenting
Related Questions in SECURITY
- Can MVC.NET prevent SQL-injection at razor or controller level?
- Forgotten password reset page: should the user need to enter a username/email as well?
- Dynamic roles list in CustomAuthorize ASP MVC
- Access roles from multiple applications
- How to Fix TLS CBC Incorrect Padding Abuse Vulnerability on Windows 2003 Server
- Evernote Web Clipper and Content Security Policy
- Invalidate user credentials when password changes
- Spring Boot MVC non-role based security
- Correct Captcha behaviour on error
- Is macro more secure than static const if I don't want someone to know or change the hardcode value?
- In Android, ensuring only pre-decided users can only use the app
- Authenticating plain text passwords against md5 hash in DB using Apache Shiro
- Symfony2 - handle HTTP/Entity user access restrictions
- Client side computation without exposing code?
- searchable row level encryption using java?
Related Questions in ROLE-BASED-ACCESS-CONTROL
- Authorization Model: Context of Role?
- JHipster Role based masking of certain columns
- How to make IIS authorize requests based on Windows user name or group membership?
- Group role based authorization
- Is it possible to restrict user/role access to TFS by file extension?
- How to Securely Differentiate Admin and User Roles with NextAuth and Next.js?
- Not able to give owner access from classic service administrator role
- Role-based chat system in Nodejs
- Allow everyone in RoleBinding for a namespace
- How safe is job role based authorization in react?
- Role based Authentication: Bearer Token to Cookie using Microsoft .NetCore 3.1
- Role based authentication in React Native app using Firebase
- API and Database Access Control Architecture
- Role based authorization in spring boot
- A participant using transaction to update/add another participant
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Yes they can. React state is just JavaScript, and as a user they can always modify those state value in their browser.
This problem depends on how you secure in the server-side. User can always tamper with the request to server. It's server job to check for whether the request is valid or not. For example using JWT, when the request come to server, the server need to check whether the user is actually admin or not before performing any job.
In general, saving admin role or something similar in front-end usually for the sake of data displaying. You can always do some input checking before sending request to server, but VALIDATE REQUEST in server is a must