-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: improve ImplicitBearerToken #698
Conversation
FL-1067 Token expired just after login with username and password
ContextOn Lipome, see slack thread. Tanguy got an error "expired token", some minutes after login in with user and password Our interpretation of the issue:
SpecificationThere are several ways around this:
Acceptance criteriaUsing |
9c998ed
to
c0a6b5c
Compare
a11ebc3
to
801dd21
Compare
798adda
to
4bf67b7
Compare
/e2e --tests sdk,frontend |
4bf67b7
to
89bb9b1
Compare
/e2e --tests sdk,frontend |
End to end tests: ✔️ SUCCESS “Carpe diem. Seize the day, boys.” ― John Keating, Dead Poets Society |
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.
Thanks for the PR
tokens = model.objects.filter(id=request.GET.get("id")) | ||
if len(tokens) == 1 and request.user == tokens[0].user: |
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.
Minor but if we expect only one object, or raise, get does the job
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.
My worry is since len(tokens) == 0
is a common outcome of the above request, I'd be using exceptions for control flow.
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 ask for forgiveness than permission ☯️
ff22581
to
5f0590e
Compare
Waiting for Substra/substra#381 to merge |
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
5f0590e
to
dc6c3a0
Compare
/e2e --tests sdk,substrafl --refs substra=feat/client-logout |
End to end tests: ✔️ SUCCESS |
Signed-off-by: Olivier Léobal <[email protected]>
/e2e --tests sdk,substrafl --refs substra=feat/client-logout |
End to end tests: ✔️ SUCCESS “Carpe diem. Seize the day, boys.” ― John Keating, Dead Poets Society |
### Added - New `SECRET_KEY` optional environment variable ([#671](#671)) - `/api-token-auth/` and the associated tokens can now be disabled through the `EXPIRY_TOKEN_ENABLED` environment variable and `server.allowImplicitLogin` chart value ([#698](#698)) - Tokens issued by `/api-token-auth/` can now be deleted like other API tokens, through a `DELETE` request on the `/active-api-tokens` endpoint ([#698](#698)) ### Changed - Increase the number of tasks displayable in frontend workflow [#697](#697) - BREAKING: Change the format of many API responses from `{"message":...}` to `{"detail":...}` ([#705](#705)) ### Removed - BREAKING: `SECRET_KEY_PATH` and `SECRET_KEY_LOAD_AND_STORE` environment variables ([#671](#671)) - Removed logic for storing `SECRET_KEY` at startup, in order to increase stability; it should be done at a higher level, i.e. the chart ([#671](#671)) ## Fixed - `/api-token-auth/` sometimes handing out tokens that are about to expire ([#698](#698)) Signed-off-by: Milouu <[email protected]>
Description
Solve the issue of sometimes issuing tokens that are about to expire, by just issuing an new token every time and relying on feat: add Client.logout and context manager substra#381 to clean them up
Add a new
server.allowImplicitLogin
option, allowing node admins to disable the option altogether in order to improve security practices.Extend
/active-api-tokens -X DELETE
to also be able to deleteImplicitBearerToken
, adding anid
field toImplicitBearerToken
for this purpose. This is to enable users to terminate their sessions, as per security recommendations (this is leveraged by feat: add Client.logout and context manager substra#381)Closes FL-1067, FL-1140
Companion to Substra/substra-documentation#336
How has this been tested?
Tried it on my machine
Checklist