Skip to content

Add the ability to prevent the masking of clientId - #634

Open
Waiariki Koia (the-coding-cuzzy) wants to merge 1 commit into
Azure:masterfrom
the-coding-cuzzy:not-mask-client-id
Open

Add the ability to prevent the masking of clientId#634
Waiariki Koia (the-coding-cuzzy) wants to merge 1 commit into
Azure:masterfrom
the-coding-cuzzy:not-mask-client-id

Conversation

@the-coding-cuzzy

Copy link
Copy Markdown

What changed

mask-client-id, a new optional boolean input defaulting to true:

- uses: azure/login@v3
  with:
    client-id: ${{ vars.AZURE_CLIENT_ID }}
    tenant-id: ${{ vars.AZURE_TENANT_ID }}
    subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
    mask-client-id: false   # default: true
  • action.yml - declares the input with default: true
  • src/common/LoginConfig.ts - LoginConfig gains a maskClientId field and the existing this.mask(this.servicePrincipalId) call is now gated on it.
  • README.md - input table row, a mask-client-id section, and the existing client-id masking note now points at the opt-out.
  • __tests__/LoginConfig.test.ts - three cases covering the input set to true, set to false, and absent.

Scope and default behaviour

Existing workflows are unaffected. The input defaults to true and every current caller keeps masking the client ID.
Only the client ID/service principal ID is in scope. servicePrincipalSecret and the OIDC federated token are still masked unconditionally.
The gate applies to the client ID from either source - the client-id input or clientId inside creds - since both land in the same field.
A value passed from ${{ secrets.* }} is still masked by Actions itself regardless of this input. Opting out only has a visible effect for values that are not repository secrets, which is the case this is aimed at.

Note for reviewers

The input is parsed as "anything other than an explicit false means mask":

this.maskClientId = core.getInput('mask-client-id').toLowerCase() !== "false";

The other boolean inputs in LoginConfig use === "true", which resolves to false when the input is absent. That is fine for enable-AzPSSession and allow-no-subscriptions, but for a masking flag it fails in the unsafe direction - a missing input would silently stop masking. Inverting the comparison keeps a missing or malformed value on the masked path.

Happy to switch to core.getBooleanInput or to match the surrounding style instead if you would prefer consistency here.

@the-coding-cuzzy

Waiariki Koia (the-coding-cuzzy) commented Aug 25, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Global Dairy Trade"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant