Include session_cookie_token_prefix in KAS session cookie
What does this MR do and why?
Builds upon the changes added in !145178 (merged) to add the configured prefix to the _kas_session
cookie used for the Kubernetes Dashboard. This will allow routing dashboard requests to the correct KAS/cell.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Configure GDK with KAS and an agent that is set up for user access
- Add
gdk.yml
config to use a cookie prefix:gitlab: rails: session_store: session_cookie_token_prefix: 'test_prefix_'
- Run
gdk reconfigure
andgdk restart
to pick up the changes. - Browse to the overview page of the agent
- In the network tab of developer tools, observe the prefix has been set in the cookie value, for example:
- In the browser console, execute the following (substituting the correct agent ID and KAS address):
fetch('https://gdk.test:3443/-/k8s-proxy/api/v1/namespaces', {credentials: 'include', headers: {'X-Csrf-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content, 'GitLab-Agent-Id': '17'}}).then((response) => response.json()).then((data) => console.log(data));
- The call should succeed and list the namespaces in your agent's cluster.
Related to #444679 (closed)
Edited by Tiger Watson