Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not to expose password on browser console... #13

Closed
wants to merge 1 commit into from

Conversation

mahmed0715
Copy link

I was using this in our project. it was working great.
We were storing username and password as object to sessionstorage and in model.credentials.
The issue came around: one can get the raw password, so issue is to protect the password to be exposed.
I came around and found a solution that can protect the password.
We will store base64 encoded user:pass: thus the issue solved.

Use of string(base64) credential, for security we dont want to expose raw password. Storing the encoded credentials and using them on demand.
store in session
var cred = Backbone.BasicAuth.encode({
username: user,
password: pw
});
sessionStorage.setItem('credentials',cred);
this.model.credentials = cred;

using Backbone.BasicAuth.getHeader(sessionStorage.getItem('credentials'));

Thanks

Use of string(base64) credential, for security we dont want to expose raw password. Storing the encoded credentials and using them on demand.
store in session
var cred = Backbone.BasicAuth.encode({
                username: user,
                password: pw
            });
            sessionStorage.setItem('credentials',cred);
            this.model.credentials = cred;

using Backbone.BasicAuth.getHeader(sessionStorage.getItem('credentials'));
@fiznool
Copy link
Owner

fiznool commented May 20, 2015

Thanks for the PR and apologies for the delay in responding.

I came around and found a solution that can protect the password. We will store base64 encoded user:pass: thus the issue solved.

I'm afraid this isn't really a very good solution for storing the password securely. It's trivial to decode the base64 encoded string. Anybody who knows where to look in sessionStorage will likely have the technical knowledge to see a base64 encoded string and decode it.

For this reason, I don't want to encourage this technique, so I don't think this really belongs in the plugin. So I'm going to close this for now.

Thanks again for taking the time to contribute.

@fiznool fiznool closed this May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants