Add pages unique domain option
What does this MR do and why?
Problem
Currently, cookies of different gitlab-pages sites under the same namespace are leaked due to the gitlab-pages default URL format: namespace.gitlab.io/project
Solution
Add an option to enable users to create a unique subdomain for a gitlab-pages project, like: project-namespace-somerandomvalue.gitlab.io
How
based on the PoC !106961 (closed)
- Create two columns in the
project_settings
table:-
pages_unique_domain
(text): where the unique domain will be stored. (limit of 63 chars - https://www.freesoft.org/CIE/RFC/1035/9.htm) -
pages_unique_domain_enabled
(bool): if the unique domain feature is enabled
-
This way, we can keep the unique domain even if the user disables the feature.
- Add a checkbox in
namespace/project/pages
(Project pages settings) allowing the user to enable the feature (pages_unique_domain_enabled
)- Use a feature flag to control the checkbox
- The unique subdomain can follow a format like:
projectpath-namespacepath-randomstring
- project path: up to 48 chars
- namespace path: complete value up to 48 chars
- random string:
SecureRandom.hex(size)
to fill the value to 63 chars
Examples:
project path | namespace path | unique domain |
---|---|---|
project | namespace | project-namespace-c226671dcc75af60ff0c42aa4b46cdc4704d3b83c302a |
pppppppppppppppppppppppppppppppppppppppp (40 chars) | namespace | pppppppppppppppppppppppppppppppppppppppp-namespa-0f932f0421b616 |
ppppppppppppppppppppppppppppppppppppppppppppppppp (49 chars) | namespace | pppppppppppppppppppppppppppppppppppppppppppppppp-dccac2434fcf48 |
Related to: #388178 (closed)
database migration
Extracted to: !111613 (merged)
Screenshots or screen recordings
Screen_Recording_2023-01-16_at_19.42.00
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Kassio Borges