TOKEN CI Variable is automatically displayed as "[secure]" even if it's not specified

Replace this template with your information

Describe your question in as much detail as possible:
In gitlab.com I have a pipeline who build a multistage docker image to deliver a node app. My app consume a private repository hosted in a private gitlab package registry. Inside my docker I have two instruction to authorize the installation of my private library.

...
RUN npm config set "//gitlab.com/api/v4/projects/${LIB_GITLAB_ID}/packages/npm/:_authToken" "${LIB_GITLAB_TOKEN}"

In the job 1 I see in the log output:

...
#8 [dependencies 2/5] RUN npm config set "//gitlab.com/api/v4/projects/{id_displayed_as_expected}/packages/npm/:_authToken" "[secure]"

As you see It displays “[secure]” instead of the token value.

My first though was, ok it’s fine, Gitlab detect a variable named TOKEN so it hides it by default from the log output.

Problem is in the job 2 I see in the log output:

RUN npm config set "//gitlab.com/api/v4/projects/{id_displayed_as_expected}/packages/npm/:_authToken" "{token_displayed}"

As you see, this time the token is displayed. I suspect this command to invalidate the multi stage docker cache and force rebuilding the following layers.

Maybe my invalidation cache is not related to the command but, the fact is the CI variable is not handled and displayed consistently between jobs of the same pipeline.