-
Notifications
You must be signed in to change notification settings - Fork 26
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
🐛 [#4199] Delete authinfo from session after it's stored on submission #4271
🐛 [#4199] Delete authinfo from session after it's stored on submission #4271
Conversation
ed4be3c
to
5532a35
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4271 +/- ##
=======================================
Coverage 96.26% 96.27%
=======================================
Files 731 731
Lines 23718 23735 +17
Branches 2795 2797 +2
=======================================
+ Hits 22833 22850 +17
Misses 616 616
Partials 269 269 ☔ View full report in Codecov by Sentry. |
2f5e00b
to
b10b789
Compare
6032e0d
to
bf4318f
Compare
bf4318f
to
d731ee5
Compare
@sergei-maertens I'm not 100% sure if this needs backport, what is our policy for when to backport bugfixes? |
@sergei-maertens I checked the usage of the session auth info and I didn't notice any problems if we remove it from the session, the only thing that changes is that when resuming a form, the user will always be forced to login again even if it's within the same session (because the authinfo isn't persisted on the session anymore) |
We typically label the ticket as such during refinement, based on how big the impact is and whether a workaround exists or not. I think that the odds that a end user is filling out multiple forms at the same time where one is authenticated and the other one not are pretty low, so I don't think it warrants a backport. There also doesn't seem to be a stakeholder (except for us) in this, so it doesn't seem to be a big problem. |
I think that's a good side-effect of this patch, it fits better with the expectations that resuming always forces you to re-authenticate and creates less different authentication flows for the same "mechanism". |
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.
I'd like to see a test with explicit anonymous start in openforms.submissions.tests.test_start_submission
.
I don't put too much value on the unit tests of the signal, I'm mostly interested in the integration tests for the POST
call that those behave as expected, so please add a test that sets up an authentication state and creates an anonymous submission and make assertions on that created submission.
factory = APIRequestFactory() | ||
request = factory.get("/foo") | ||
request.session = self.client.session | ||
request = Request(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.
request = Request(request) |
APIRequestFactory
already produces a Request
instance, no?
I'd expect your type checker to complain about this too btw
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.
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.
what happens if you add an assert isinstance(request, Rrequest)
after it? That should help the type checker
I am talking nonsense, the factory just generates a plain Django HttpRequest
and the Request
layer from DRF is something that only happens in views at runtime.
You could use openforms.typing.AnyRequest
in your function signature instead, since the Request
instance proxies down into the HttpRequest
anyway.
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.
I'll add AnyRequest
👍
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.
So this means my type checker isn't messed up? 😄
d731ee5
to
4e3f218
Compare
to allow the SDK to explicitly indicate that the submission is without authentication
4e3f218
to
32448bc
Compare
Yeah, sporadically it crashes. hypothesis tends to reveal those cases... |
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.
I'll leave it up to you to hit the merge button if this is ready to be merged in your opinion :)
or after the cosign data is set, previously an anonymous submission that is started after the user started an authenticated submission within the same session would incorrectly get the same authentication information attached to it as the authenticated submission
32448bc
to
49783de
Compare
I pushed the typing changed and will merge it once CI passes |
Closes #4199 partly
Related PR: open-formulieren/open-forms-sdk#688
Changes
anonymous
option to submission endpointTODO:
FORM_AUTH_SESSION_KEY
is usedChecklist
Check off the items that are completed or not relevant.
Impact on features
Release management
I have updated the translations assets (you do NOT need to provide translations)
./bin/makemessages.sh
./bin/compilemessages_js.sh
Commit hygiene