-
Notifications
You must be signed in to change notification settings - Fork 4
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
Header authentication #180
Conversation
Can you also add a global flag to completely disable this functionality? I don't have too much knowledge of header auth, but I do know that it can be pretty dangerous if the upstream proxy is not configured properly. Obviously that is not Wishlist's job to know about that or enforce it, but I think there should be a disclaimer in the docs about that. Maybe something like Warning When header authentication is enabled, Wishlist makes no assumptions about the validity of the headers. It is up to you to have your proxy properly configured. An improperly configured proxy could allow anyone to gain access to the application by forging the headers. |
Couple other things to consider
|
d43e103
to
14da946
Compare
|
|
8ac1e52
to
6076398
Compare
6076398
to
fd44cae
Compare
@cmintey This is now ready for a review. I have implemented a function for creating a user, just so don't have duplicated code everywhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just a suggestion to add some logs when the required headers are missing. Can just use console.log since I haven't set up any real logging yet
|
||
if (!user) { | ||
if (!env.HEADER_EMAIL || !env.HEADER_NAME) { | ||
return fail(400, { username: username, password: "", incorrect: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a log message here that the header variables are missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will fix!
const name = request.headers.get(env.HEADER_NAME); | ||
const email = request.headers.get(env.HEADER_EMAIL); | ||
if (!name || !email) { | ||
return fail(400, { username: username, password: "", incorrect: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a log message here as well that the required headers are missing from the request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will fix!
I have added logging @cmintey |
No description provided.