Skip to content

Support predictable secret names for external consumers #138

@wingsofovnia

Description

@wingsofovnia

When integrating with external systems that issue NATS User JWTs (e.g., authorization services in a decentralized JWT schema), those systems need access to the Account Signing Key secret.

Following #44, NAUTH names secrets with a hash suffix derived from the account's public key:

<account>-ac-sign-<hash>

This solved #9 where orphaned account IDs could cause new accounts to overwrite existing secrets, leading to credential loss.

However, it makes the secret name unpredictable until the Account resource is created and reconciled. This makes it hard to reference the secret in a Helm chart or GitOps.

The deprecated naming templates (<account>-ac-root, <account>-ac-sign) would work for this use case, but, apart from being scheduled for removal #102, there is no (declarative) way to opt into the old naming for new accounts.

I suggest allowing user to specify custom/predictable secret names, e.g.

spec:
  secrets:
    rootName: "my-account-root"
    signName: "my-account-sign"

Users could set one, both, or neither (defaulting to hash-based naming for unspecified ones).

To mitigate #9, which motivated moving away from predictable secret names, if a secret with that name already exists, fail reconciliation with a clear error until a user manually deletes the existing secret.

Let me know if this approach works. I can try to pick this up if time allows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions