Skip to content

Pin now time during the access request creation#40325

Merged
jakule merged 5 commits intomasterfrom
jakule/session-ttl-drift
Apr 8, 2024
Merged

Pin now time during the access request creation#40325
jakule merged 5 commits intomasterfrom
jakule/session-ttl-drift

Conversation

@jakule
Copy link
Copy Markdown
Contributor

@jakule jakule commented Apr 8, 2024

To prevent time drift, this change pins the time during access time calculations.
Remove the fake clock from the tests to better simulate the real-time behavior.

changelog: Fix invalid session TTL when creating access request with tsh

The `clockwork` package was removed and handling of time elements has been refactored in codebase. The current time was set once and then passed as an argument to the functions that need it, reducing calls to retrieve the current time. This change simplifies the code and makes it more robust against time drifts.
jakule added 2 commits April 8, 2024 12:54
Removed the use of fake clock in tsh_test.go and kube_test.go to imitate real-world behavior more accurately. This change is aimed at improving the credibility and reliability of those test cases.
Copy link
Copy Markdown
Contributor

@kimlisa kimlisa left a comment

Choose a reason for hiding this comment

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

🙏

@jakule jakule marked this pull request as ready for review April 8, 2024 18:24
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2024

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@github-actions github-actions Bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Apr 8, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2024

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

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

Looks good, but I also think its odd that we do a time comparison (without rounding times) and then log the rounded version of the time. This makes troubleshooting difficult.

Should we either round before comparing, or log the exact values that we used to do the comparison?

@zmb3
Copy link
Copy Markdown
Collaborator

zmb3 commented Apr 8, 2024

/excludeflake *

jakule added 2 commits April 8, 2024 14:41
This commit updates the comments in `access_request.go` and `access_request_test.go` files to improve grammar and punctuation for better readability and understanding of the code. This includes correction of typographical errors, addition of punctuation where necessary, and clarification of some comments for more precise descriptions.
The code changes refine messages for validation errors related to TTL. The error messages returned when requested TTLs exceed the maximum allowed amounts are improved. Time is no longer rounded to minutes, providing more precise error messages.
@jakule
Copy link
Copy Markdown
Contributor Author

jakule commented Apr 8, 2024

Looks good, but I also think its odd that we do a time comparison (without rounding times) and then log the rounded version of the time. This makes troubleshooting difficult.

Should we either round before comparing, or log the exact values that we used to do the comparison?

I changed the logger to log the exact value.

@jakule jakule enabled auto-merge April 8, 2024 18:52
@jakule jakule added this pull request to the merge queue Apr 8, 2024
Merged via the queue into master with commit b234bfe Apr 8, 2024
@jakule jakule deleted the jakule/session-ttl-drift branch April 8, 2024 19:20
@public-teleport-github-review-bot
Copy link
Copy Markdown

@jakule See the table below for backport results.

Branch Result
branch/v14 Failed
branch/v15 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants