-
Notifications
You must be signed in to change notification settings - Fork 70
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
ADR 019 password rotation #725
ADR 019 password rotation #725
Conversation
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 had one question about handling a potential null token. All looks good to me with nothing obvious standing out.
// The token has changed or the connection needs to re-authenticate but can use the same credentials. | ||
if (AuthorizationStatus == AuthorizationStatus.AuthorizationExpired || !token.Equals(AuthToken)) | ||
var authExpired = AuthorizationStatus == AuthorizationStatus.AuthorizationExpired; | ||
if (authExpired || !token.Equals(AuthToken)) |
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.
Is there a situation here where the code would need to handle a null token being supplied from the AuthTokenManager. Previous code threw an exception in that case (see line 354 for conditional on null check).
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.
Added a null check.
Replace Task with ValueTask for auth manager APIs.
} | ||
|
||
if (exception is AuthorizationException) | ||
{ | ||
// if an auth exception occured the pool member, all connections in the pool that are using that token | ||
// should be closed. This is because the token is now invalid and all connections using it will fail. | ||
foreach (var conn in _inUseConnections) |
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.
do we care about setting it for idle connections, _inUseConnections are connections that another session or transaction currently has borrowed.
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 think it's right to let those connections fail the next time they're attempted to be used?
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.
why do we want idle connections to lazily discover the auth token is expired but set in use connections as expired?
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.
Yeah, thinking about it, you're right, let me alter that.
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'm a bit late to the party, but please note that the TestKit tests for this feature introduced a new feature flag API_RETRYABLE_EXCEPTION = "Feature:API:RetryableExceptions"
. For better test coverage, I highly recommend implementing it in the backend.
commit 7b8ef91 Author: Richard Irons <[email protected]> Date: Thu Aug 31 11:58:24 2023 +0100 Version bump (neo4j#727) commit 6f36b08 Author: Richard Irons <[email protected]> Date: Tue Aug 22 12:31:10 2023 +0100 ADR 019 password rotation (neo4j#725) This PR updates the preview feature "re-auth" significantly. The changes allow for catering to a wider range of use cases including simple password rotation. As part of this PR, all auth-related namespaces have been moved to preview - previously some did not have this, although the classes therein would not have been usable. Since this is a preview feature all changes here are breaking changes. The OnTokenExpiredAsync method in the IAuthTokenManager interface was removed, and a new HandleSecurityExceptionAsync method was added in its place. The ExpirationBased method in AuthTokenManagers was renamed to Bearer, and a new Basic method was added to cater for password rotation. --------- Co-authored-by: grant lodge <[email protected]> commit 7c93291 Author: grant lodge <[email protected]> Date: Fri Aug 18 15:49:18 2023 +0100 Implement pipelined begin for executable query (neo4j#724) * Implement pipelined begin * Add unit tests commit d024d70 Author: grant lodge <[email protected]> Date: Wed Jul 26 14:53:47 2023 +0100 [5.11] Zoned date time fixes (neo4j#715) Fixes for ZonedDateTime. * Introduce Ambiguous bool property, Creating ZonedDateTime with out a datetime kind, or using a datetime kind local with a named Zone:Zone.of(string), meant we could create an ambiguous date time. * Introduce ZonedDateTime.AmbiguityReason enum flags type. * Introduce Reason AmbiguityReason property for ZonedDateTimes, to allow users to see why a value is considered ambiguous. * Introduce UtcSeconds long property which is the understood monotonic timestamp from unix epoch in UTC. * Fix ZonedDateTime lazily parsing when returned from a query, now it is parsed immediately. * Fix ZonedDateTime not supporting values outside of range of BCL Date Types * Add EpochTicks Property, and constructor which can be used for easy interop with nodatime's Instant
This PR updates the preview feature "re-auth" significantly. The changes allow for catering to a wider range of use cases including simple password rotation.
As part of this PR, all auth-related namespaces have been moved to preview - previously some did not have this, although the classes therein would not have been usable.
Since this is a preview feature all changes here are breaking changes.
The
OnTokenExpiredAsync
method in theIAuthTokenManager
interface was removed, and a newHandleSecurityExceptionAsync
method was added in its place.The
ExpirationBased
method inAuthTokenManagers
was renamed toBearer
, and a newBasic
method was added to cater for password rotation.