Client Secret Key Generation Can Generate Invalid Keys

Zach Gummow 20 Reputation points
2023-12-11T22:33:02.42+00:00

I wasn't sure exactly where to bring up this issue since this is more of a bug report and MS wanted our company to pay for technical support to send this report through the Azure portal. I posted some feedback here: https://feedback.azure.com/d365community/idea/0ba2ec94-7498-ee11-a81c-6045bd7fe045

Contents of that post:

When working with Azure AD B2C, my company has discovered a bug with client secret key generation. Reproduction steps:

  1. Navigate to Certificates and Secrets
  2. Add a new client secret
    1. Generate keys until a period is present in the key
  3. Copy the key value
  4. Navigate to Policy Keys
  5. Use the generated client secret key that contains a period for a policy
  6. Wait several minutes for the key change to take effect
  7. Attempt to utilize the relevant B2C key
  8. An error occurs

There seems to be some issue with periods, and perhaps other special characters that are present in generated keys. I don't have a full listing of those problem characters, but a period broke it for me when I was attempting to reproduce the error. Perhaps this is a encoding/decoding issue or other related problem. 

We can work around this issue as we can just generate keys until we get one that works, but this key bug should be addressed at some point.

Is there anything else I can do to report this issue?

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
{count} votes

Accepted answer
  1. Akshay-MSFT 17,956 Reputation points Microsoft Employee Moderator
    2024-01-03T11:31:10.1033333+00:00

    @Zach Gummow

    Could you please confirm if :

    • You are using the secret to create a new policy key with expiry time same, as defined while generating the secret?
    • You are using the secret to edit an existing policy key with expiry time same, as defined while generating the secret?
    • You are using the secret to create a new policy key with expiry time different from what was defined while generating the secret?

    Update #1

    @Zach Gummow

    I would recommend to create a new policy and use your newly generated secret.

    As per, B2C policy key documentation:

    The keys in a keyset are not replaceable or removable. If you need to change an existing key:We recommend adding a new key with the activation date set to the current date and time. Azure AD B2C will activate the new key and stop using the prior active key.

    Alternatively, you can create a new keyset with the correct keys. Update your policy to use the new keyset, and then remove the old keyset.

    Please "Accept the answer (Yes)" and "share your feedback ". This will help us and others in the community as well.

    Thanks, Akshay Kaushik

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.