Skip to content
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

Populate AWS-generated tokens with default lease TTL to fix comparisons against role max #4107

Merged
merged 2 commits into from
Mar 8, 2018

Conversation

jefferai
Copy link
Member

@jefferai jefferai commented Mar 8, 2018

@vishalnayak @kevinwang Can you see if this fixes the problem instead? This won't override the role set TTL (which is allowed to be longer than the system) and is quite a bit simpler.

Copy link
Contributor

@kevinwang kevinwang left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix.

}
if resp.Auth.TTL > shortestMaxTTL {
resp.Auth.TTL = shortestMaxTTL
resp.AddWarning(fmt.Sprintf("Effective TTL of '%s' exceeded the effective max_ttl of '%s'; TTL value is capped accordingly", (resp.Auth.TTL / time.Second), (shortestMaxTTL / time.Second)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Division by time.Second should be removed here to fix the print statement. ((1 * time.Second) / time.Second evaluates to 1 nanosecond) Same on line 1325.

Copy link
Member Author

Choose a reason for hiding this comment

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

We display ttl/max_ttl in seconds to the user...so I think this behavior is actually what we want right?

Copy link
Contributor

Choose a reason for hiding this comment

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

When we divide the TTL by time.Second, the print statement looks like this:

  * Effective TTL of '2.7648ms' exceeded the effective max_ttl of '600ns'; TTL
  value is capped accordingly

With the fix:

  * Effective TTL of '768h0m0s' exceeded the effective max_ttl of '10m0s'; TTL
  value is capped accordingly

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, ok. That's because we need to print it as a digit, not a string.

vishalnayak
vishalnayak previously approved these changes Mar 8, 2018
@jefferai jefferai merged commit be04e96 into master Mar 8, 2018
@jefferai jefferai deleted the issue-4086 branch March 8, 2018 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants