-
-
Notifications
You must be signed in to change notification settings - Fork 765
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
Security decorator should log client IP address #415
Conversation
1 similar comment
Could you please rebase this PR? I am seeing a lot of changes related to the PR #414. |
# 1) remote_addr, no x-forwarded-for, invalid token (401) | ||
with LogCapture() as l: | ||
wrapped_func = verify_oauth('https://example.org/tokeninfo', set(['admin']), [], func) | ||
request, headers = _setup_request_mock(remote_addr="123.123.123.123") |
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.
Better than doing all this mocking is to use test_request_context
. It is safer because we relay on how Flask actually works and not how the mocks are set up.
api_client.application.test_request_context('/').push()
Reference:
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.
Okay, no problem, I will review this code. A few things to clean up. Thanks for the feedback.
@danballance Thank you for the PR. Would be nice if we could have some documentation on what it does and how this works. What do you think? Do not need to be long. Basically a summary of your comments from #410. |
@danballance Please review the changes made in this PR. It needs rebasing. |
Hi, I've just been looking for a gap here where I can look again at this. Tomorrow may be possible - certainly this week. |
I am looking at this, but 1.1.7 appears to be a major re-factor and lots of things have broken. I still hope to resolve everything this week, but it's not going to be tomorrow now. |
@danballance Yes, sorry about that. It was an expected internal refactor to move the project forward (see #380). |
No problem - it makes complete sense to decouple Flask. It's a big change though! I can see you guys are still changing quite a lot of code so I think I'll wait until the dust settles before I return to this :) |
@danballance Sure, no problem. Yeah, now we are fixing some things since the decoupling started. |
I'm closing this PR since it wasn't updated in more than 1 year. If you are still interested in adding this change please reopen it. |
Fixes #410
Changes proposed in this pull request: