Skip to content

feat(server-nestjs): proactive GitLab mirror token rotation with enforced headroom - #2693

Merged
shikanime merged 1 commit into
mainfrom
feat/gitlab-mirror-token-rotation
Sep 8, 2026
Merged

feat(server-nestjs): proactive GitLab mirror token rotation with enforced headroom#2693
shikanime merged 1 commit into
mainfrom
feat/gitlab-mirror-token-rotation

Conversation

@shikanime

@shikanime shikanime commented Sep 7, 2026

Copy link
Copy Markdown
Member

Issues liées

Issues numéro:

#2691


Quel est le comportement actuel ?

Les tokens de miroir ne sont remplacés que de manière réactive (absents ou invalides à la lecture).
Un échec silencieux de rotation laisse alors le token valide jusqu'à son expiration, sans remplaçant préparé.

Quel est le nouveau comportement ?

Ajout de GITLAB_MIRROR_TOKEN_ROTATION_THRESHOLD_DAYS dans la config GitLab (par défaut 250, environ un tiers de la durée de vie par défaut de 365 jours).
Le token d'accès groupe est remplacé de manière préventive dès que l'âge du secret Vault dépasse ce seuil.
GITLAB_MIRROR_TOKEN_EXPIRATION_DAYS est désormais validé par le schéma afin que le seuil de rotation reste strictement inférieur à l'expiration.
Les tokens sont donc toujours remplacés avant d'expirer.

Cette PR introduit-elle un breaking change ?

Non.

Autres informations

@github-actions github-actions Bot added the built label Sep 7, 2026
@shikanime
shikanime force-pushed the feat/gitlab-mirror-token-rotation branch from 60a710f to a9a0c8d Compare September 8, 2026 15:17
…rced headroom

Mirror tokens were rotated only reactively (missing or invalid at read time),
so a silent rotation failure left the token valid until its expiration with no
replacement prepared.

Add GITLAB_MIRROR_TOKEN_ROTATION_THRESHOLD_DAYS (default 250, roughly a third
of the default 365-day token lifetime) to the GitLab config and proactively
rotate the group access token when the Vault secret age exceeds it.
GITLAB_MIRROR_TOKEN_EXPIRATION_DAYS is now schema-enforced so the rotation
threshold stays strictly below the expiration, meaning tokens are always
replaced before they expire.

Refs #2691
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: I6ac7f2390806c4f4c7c426d4d955c8ce6a6a6964
@shikanime
shikanime force-pushed the feat/gitlab-mirror-token-rotation branch from a9a0c8d to 62c50bf Compare September 8, 2026 15:21
@shikanime
shikanime marked this pull request as ready for review September 8, 2026 15:23
@shikanime
shikanime requested a review from a team as a code owner September 8, 2026 15:23
@shikanime shikanime self-assigned this Sep 8, 2026
@shikanime shikanime added technical debt Résoud de la dette technique refactor Refactor code and removed technical debt Résoud de la dette technique labels Sep 8, 2026
@shikanime shikanime added this to the 9.26.0 milestone Sep 8, 2026
@cloud-pi-native-sonarqube

Copy link
Copy Markdown

@shikanime
shikanime added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit f0139b6 Sep 8, 2026
64 checks passed
@shikanime
shikanime deleted the feat/gitlab-mirror-token-rotation branch September 8, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

built refactor Refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants