Skip to content

Conversation

@connelly38
Copy link
Member

In some Instance Principal cases, the security token returned from OCI Identity may have a very short expiration. This change removes the expiration check, and allows a single retry on requests that get specific authN errors.
It also adds trace-level logging of authentication token details.

In some Instance Principal cases, the security token returned
from OCI Identity may have a very short expiration. This change removes
the expiration check, and allows a single retry on requests that
get specific authN errors.
It also adds trace-level logging of authentication token details.
@connelly38 connelly38 requested a review from gmfeinberg January 4, 2023 20:27
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 4, 2023
/* allow a single retry on clock skew / auth errors */
String msg = iae.getMessage();
if ((msg.contains("clock skew") == false &&
msg.contains("request signature is invalid") == false) ||
Copy link
Contributor

@gmfeinberg gmfeinberg Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not do the right thing if IAM starts returning expired token exceptions. See the code I posted in slack. Look at the possible errors based on that code. It may not be worth the check on the message and just make this "if (kvRequest.getNumRetries() > 0)".
That is, I don't see a path where this exception happens where we wouldn't want to retry once

/* allow a single retry on clock skew errors */
if (iae.getMessage().contains("clock skew") == false ||
kvRequest.getNumRetries() > 0) {
/* allow a single retry on clock skew / auth errors */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe comment that these are errors indicating actual invalid/expired auth info vs a permission-related error

gmfeinberg
gmfeinberg previously approved these changes Jan 5, 2023
@connelly38 connelly38 merged commit 437d4a2 into main Jan 5, 2023
@connelly38 connelly38 deleted the bugfix/instance_principal_expirations branch January 5, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants