Do not generate Twitter/OpenGraph meta tags on the Sign in page
Summary
Usually, when repo URLs appear on chat apps Twitter/OpenGraph cards are expanded based on the resource's <meta>
tags. However, when hitting internal/private (auth-required) repos, gitlab redirects to https://<instance>/users/sign_in
which also contains several <meta>
tags:
<meta content="object" property="og:type">
<meta content="GitLab" property="og:site_name">
<meta content="Sign in" property="og:title">
<meta content="GitLab.com" property="og:description">
<meta content="https://gitlab.com/assets/gitlab_logo-7ae504fe4f68fdebb3c2034e36621930cd36ea87924c11ff65dbcb8ed50dca58.png" property="og:image">
<meta content="64" property="og:image:width">
<meta content="64" property="og:image:height">
<meta content="https://gitlab.com/users/sign_in" property="og:url">
<meta content="summary" property="twitter:card">
<meta content="Sign in" property="twitter:title">
<meta content="GitLab.com" property="twitter:description">
<meta content="https://gitlab.com/assets/gitlab_logo-7ae504fe4f68fdebb3c2034e36621930cd36ea87924c11ff65dbcb8ed50dca58.png" property="twitter:image">
This info is a bit superfluous when it comes to particular repo/MR/issue/pipeline URLs and when using a chatbot that posts frequent updates/events you'll end up with many "Sign in" cards without actual content in the chat channel.
Examples:
Couple of examples on what other GIT hosting platforms do:
-
https://github.com/user/whatever - 404'd without checking resource existence; no
<meta>
tags. -
https://bitbucket.org/salfageme/documento - here, repository has to exist & be secret to display the sign in page (potentially bad for security); no
<meta>
tags.
e.g. how does it get rendered in Telegram:
gitlab-ce2024184 gitlab-ce2975007
Edited by Samuel Alfageme