Skip to content

Conversation

@alegrey91
Copy link
Contributor

@alegrey91 alegrey91 commented Sep 23, 2024

Issue: rancher/rancher#45931

This depends on: rancher/rancher#48778 to be merged and refers to the following RFC: https://docs.google.com/document/d/1jN2faXl9FEb2E_9Ohm7uBrrVwuwnIj4HORiL4Wb9Udw/edit?tab=t.0
This PR adds validation functionality to the webhook, for a new user attribute: auth-user-session-idle-ttl-minutes.
This parameter differs from the existing auth-user-session-ttl-minutes as the former tracks UI activity such as mouse clicks and keystrokes, while the latter is a timer for user session.

Problem

Rancher has auth-user-session-ttl-minutes to set a max length a UI session (16hrs) can last, where has user is idle for a specific time and come back still session is valid now. i.e., There is no configurable parameter to set the idle session timeout.

Solution

For rancher/webhook I developed the validation function to be added to the validating webhook.
This will validate the user input for auth-user-session-idle-ttl-minutes, the new configurable parameter to set the idle session duration on the UI.

How to test it

Prerequisites: k3d running, with rancher instance up.
Build the branch:

make

Setup ngrok as follow:

ngrok http https://localhost:9443

Export the variables needed by the webhook and run it:

export KUBECONFIG=<rancher_kube_config>
export CATTLE_WEBHOOK_URL="https://<NGROK_URL>.ngrok.io"
./bin/webhook

Check with kubectl that the webhook is behaving in the right way, by changing the value field randomly:

kubectl edit settings auth-user-session-idle-ttl-minutes

CheckList

  • Test
  • Docs

@alegrey91 alegrey91 self-assigned this Oct 3, 2024
@alegrey91 alegrey91 force-pushed the feat/SURE-2982 branch 3 times, most recently from 0f3f475 to 7dddcf6 Compare February 12, 2025 12:46
@alegrey91 alegrey91 marked this pull request as ready for review February 19, 2025 10:39
@alegrey91 alegrey91 requested a review from a team as a code owner February 19, 2025 10:39
pmatseykanets
pmatseykanets previously approved these changes Feb 19, 2025
Copy link
Contributor

@JonCrowther JonCrowther left a comment

Choose a reason for hiding this comment

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

Functionally looks good, just a comment and test change

JonCrowther
JonCrowther previously approved these changes Feb 20, 2025
crobby
crobby previously approved these changes Feb 21, 2025
Copy link
Collaborator

@crobby crobby left a comment

Choose a reason for hiding this comment

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

Super tiny nit and a non-blocking question.
lgtm. very straightforward

crobby
crobby previously approved these changes Feb 21, 2025
JonCrowther
JonCrowther previously approved these changes Feb 21, 2025
Signed-off-by: Alessio Greggi <alessio.greggi@suse.com>
Signed-off-by: Alessio Greggi <alessio.greggi@suse.com>
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.

5 participants