angular secure from browser editing

Marc Rasmussen

So i have the following code:

            Session.create(uc.user);
        Session.location = 'Dashboard';
        switch (uc.user.user_type_id)
        {
            case 1:
                $state.go('app.dashboard-v1');
                break;
            case 2:
                $state.go('app.dashboard-v1');
                break;
            case 3:
                $state.go('app.dashboard-v1');
                break;
            case 4:
                $state.go('client.dashboard');
                break;
            case 5:
                // break (external partner)
                break;
        }

This controls where the newly logged in user is redirected to.

If i use the HTML editor in google chrome (as an example) and insert the following line:

        Session.create(uc.user);
        Session.location = 'Dashboard';
        uc.user.user_type_id = 4; // this line
        switch (uc.user.user_type_id)
        {
            case 1:
                $state.go('app.dashboard-v1');
                break;
            case 2:
                $state.go('app.dashboard-v1');
                break;
            case 3:
                $state.go('app.dashboard-v1');
                break;
            case 4:
                $state.go('client.dashboard');
                break;
            case 5:
                // break (external partner)
                break;
        }

Then i am able to "Crack" the redirection and allow my user to access some sensitive data.

My question is how do i avoid this?

deceze

It doesn't matter at all that how exactly you edit the Javascript... you must not send any sensitive information from the server to the client if the client is not authorised to access that data. If the data is already on the client and all that prevents the client from seeing it is a Javascript switch statement, you have already lost. You can very well send the client some admin UI, but the actual data to fill in the blanks in that UI must only be sent after the client has properly authenticated with the server; and the client must not be allowed to execute any action on the server unless they're authorised by the server to do so.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Editing buildout.cfg in Plone from a browser

Editing JSON search results from within Angular

AWS Certificates Not Secure In Browser

Keep css when editing in the browser

error on web browser 'Website not secure'

Secure Browser Extension API requests

How to handle a back from editing a table record in a separate Div section via the browser back button

Can you expose your local minikube cluster to be accessible from a browser without editing etc/hosts?

The request was aborted: Could not create SSL/TLS secure channel but works from browser/POSTMAN

Secure Cloud Run service to accept requests from a Domain in Browser only (and not Postman / shell script)

Angular app container is not accessible from browser

prevent angular template from being evaluated by browser

Display file in browser from server using angular

Call function from browser console in Angular

Editing a Form in Angular

Handle relationships editing in Angular

Python - Editing SharePoint xlsx in a browser tab (selenium)

How to automate editing HTML/CSS in browser

Electron Google Login: "This browser or app may not be secure"

Is SSL secure connection available without browser call?

Editing templates from MaterialDesignInXaml

Editing files from dockerfile

Editing Javascript from textarea

Editing code from webpage

How can I prevent Angular from re-sorting my list while editing?

Same form for creating and editing data in Angular 6 using template driven from

how to make API call from angular js more secure. Do we need to pass some key?

download large files from azure storage blob to angular client in secure way

Editing table data in Angular 4