Join our Newsletter — 33% off our NHI Course
Home› Guides› Secret in Security: Client Secrets, Shared Secrets and…
Guide Secrets Management

Secret in Security: Client Secrets, Shared Secrets and Kubernetes Secrets Distinguished

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

The word "secret" names at least four different things in security, and treating them as one leads to the wrong controls. An OAuth client secret is a password for an application. A shared secret in HMAC, RADIUS or TOTP is key material that two parties both hold. A Kubernetes Secret is an API object, a container for any sensitive value, which is not encrypted by default. And "secrets" in a secrets manager or CI system is a catch-all for every credential a workload uses. This guide sets the meanings side by side: who holds each one, how long it lives, where it should be stored and how it is rotated. It is written for developers and identity practitioners who are new to non-human identity (NHI) work. For the wider programme, see the Secrets Management Guide.

Key takeaways

  • A client secret is a credential, not a label. RFC 6749 treats it as the client's password; whoever holds it can act as the application at the token endpoint.
  • A shared secret is held by both sides. HMAC keys, RADIUS secrets and TOTP seeds sit on the verifier as well as the prover, so a server-side leak exposes every client.
  • A Kubernetes Secret is a container, not a control. The Kubernetes documentation states Secrets are stored unencrypted in etcd by default; base64 is encoding, not encryption.
  • Asymmetric beats shared where you can choose. RFC 9700 recommends mutual TLS or private_key_jwt for client authentication because the server then stores no symmetric key.
  • Every secret needs the same four lifecycle answers. Who owns it, where it is stored, when it expires and how it is revoked, whatever the word means in context.

Why secret means different things

The confusion is linguistic before it is technical. Protocol authors use "secret" for key material; platform authors use it for a storage object; security tooling uses it for anything a scanner should not find in a repository. A developer told to "rotate the secret" after an incident may rotate the Kubernetes object without changing the value inside it, or rotate the OAuth client secret without revoking tokens already issued with it.

Three questions separate the meanings quickly:

  • Is it a value or a container? A client secret, HMAC key or TOTP seed is a value. A Kubernetes Secret, a GitHub Actions secret or a vault path is a place where a value is kept.
  • Who else knows it? A client secret and a shared secret are both known to the verifier. A private key used for private_key_jwt is known only to its holder; the verifier holds the public key.
  • What does it prove? Most secrets prove the identity of a non-human caller: an application, a network device, a pipeline. That makes each one an NHI credential with an owner, scope and lifetime. See the Certificate vs Federated vs Secret Based Machine Identity guide.

OAuth client secrets

In OAuth 2.0 the client is the application, and RFC 6749 section 2.1 divides clients into confidential clients, "capable of maintaining the confidentiality of their credentials", and public clients, which cannot (installed native apps and browser-based apps). Only confidential clients should be issued a secret. Section 2.2 is explicit that the client identifier is not a secret: it is exposed to the resource owner and must not be used alone to authenticate the client.

The secret is sent to the token endpoint. RFC 6749 section 2.3.1 says clients MAY use HTTP Basic, and that putting the credentials in the request body is NOT RECOMMENDED. OpenID Connect Core section 9 names the registered methods:

Method (OIDC Core 9)What crosses the wireWhat the server storesNotes
client_secret_basicThe secret, in an HTTP Basic headerThe secret (or a verifier of it)Default when no method is registered
client_secret_postThe secret, in the request bodyThe secretDiscouraged by RFC 6749 2.3.1
client_secret_jwtA JWT signed with HMAC, keyed by the secretThe secret in usable formOIDC 16.19: HS256 needs at least 32 octets of key
private_key_jwtA JWT signed with the client's private keyThe client's public key onlyRecommended as asymmetric by RFC 9700
tls_client_auth / self_signed_tls_client_auth (RFC 8705)A client certificate in the TLS handshakeCertificate subject or public keyAlso binds tokens to the certificate
noneNothingNothingPublic clients; use PKCE

The difference that matters is the last column. With a client secret the authorisation server holds something that lets anyone impersonate the client; with private_key_jwt it holds only a public key. RFC 9700 (BCP 240, January 2025) recommends asymmetric client authentication for exactly this reason: the server does not need to store sensitive symmetric keys, which makes the method more robust against key leakage. See the JWT Client Authentication (private_key_jwt) Guide and the Client ID and Client Secret Guide for provider detail and rotation steps.

Rotating a client secret does not by itself end access gained with the old one. Access and refresh tokens already issued keep working until they expire or are revoked, so a leak response is rotate, revoke tokens, then review what the client did.

Shared secrets in protocols (HMAC, RADIUS, TOTP seeds)

A shared secret is symmetric key material that both parties hold so that each can compute or check the same value. Unlike a client secret it is often never transmitted: it keys a calculation.

  • HMAC keys: RFC 2104 section 3 says keys shorter than L bytes (the hash output length) are strongly discouraged, keys longer than the block size are hashed first, and keys should be random and refreshed periodically. Webhook signatures, signed cookies and client_secret_jwt all rely on this construction.
  • RADIUS shared secrets: RFC 2865 uses the secret between a network access server and the RADIUS server in an MD5 Response Authenticator and to hide the User-Password attribute. The RFC prefers a secret of at least 16 octets and says it MUST NOT be empty, because an empty secret lets packets be forged trivially. The server picks the secret by the client's source IP address. See the RADIUS Security Guide.
  • TOTP seeds: RFC 6238 builds a one-time password from a shared secret K and the time, with a default step of 30 seconds. Section 5.1 says keys SHOULD be the length of the HMAC output, the key store MUST be in a secure area, and recommends encrypting seeds with tamper-resistant hardware on the validation server. A stolen seed database is a stolen second factor for every enrolled user.
  • Pre-shared keys: IPsec site-to-site tunnels and WPA2-Personal Wi-Fi use the same idea: one value known to every party, so one leak opens every connection that uses it.

The common risk is concentration. The verifier must hold the secret in usable form, so verification servers, configuration backups and network device configs become high-value stores. Where the protocol allows, prefer per-client secrets over one shared value, and move to certificates or asymmetric keys where the protocol supports them (RADIUS over TLS, certificate-based EAP, IKEv2 with certificates).

Kubernetes Secrets objects

A Kubernetes Secret is an API object for a small amount of sensitive data. It holds whatever you put in it: a database password, a registry credential, a TLS key, or an OAuth client secret. The Kubernetes documentation warns that Secrets are, by default, stored unencrypted in etcd, and that anyone with API access or etcd access can read or modify them. The values in the manifest are base64 encoded; the documentation describes a base64 registry auth value as "obscured but not secret".

Read access is wider than many teams expect. The documentation states that anyone authorised to create a Pod in a namespace can read any Secret in that namespace, including indirectly by creating a Deployment, and that list or watch on Secrets reveals all Secret data in the namespace, not only the Secrets a Pod references.

Kubernetes factWhat it means in practice
Unencrypted in etcd by defaultConfigure encryption at rest (a KMS provider) on self-managed clusters; check the managed service setting
Pod creation grants Secret readTreat create on Pods, Deployments and Jobs as Secret access in RBAC reviews
list and watch reveal all dataGrant get on named Secrets, never list or watch, to workloads
Built-in types (Opaque, kubernetes.io/tls, kubernetes.io/dockerconfigjson, kubernetes.io/service-account-token, kubernetes.io/basic-auth, kubernetes.io/ssh-auth, bootstrap.kubernetes.io/token)The type is validation, not protection; an Opaque Secret is no weaker or stronger than a TLS one
1 MiB limit per SecretLarge blobs belong in an external store, not in Secrets
immutable: trueData cannot be changed, only deleted and recreated; useful against accidental edits, not against reads

Rotating a "Kubernetes Secret" therefore has two layers: change the value at its source (for example the database password or the client secret at the identity provider), then update the object. Updating only the object while the old value stays valid at the source rotates nothing. Detail on encryption, RBAC and audit logging is in the Kubernetes Secrets Security Guide, and the trade-offs of syncing from an external store are in Kubernetes Secrets vs External Secret Stores.

Other uses: secret managers, CI secrets, secret zero

  • Secrets managers: a "secret" in Vault, AWS Secrets Manager or Azure Key Vault is a stored, versioned, access-controlled value. The OWASP Secrets Management Cheat Sheet frames its lifecycle as creation, rotation, revocation and expiration, and prefers dynamic secrets with short leases where the target supports them. See Dynamic Secrets and Ephemeral Credentials Guide.
  • CI secrets: GitHub Actions defines secrets at repository, environment and organisation level, and does not pass them (other than GITHUB_TOKEN) to workflows triggered from forks. GitHub suggests OpenID Connect so that workflows can stop storing cloud credentials as long-lived secrets. A CI secret is only as safe as every script the job runs: in the Codecov Breach, a modified uploader script sent each job's environment variables, including cloud keys and tokens, to the attacker. See How to Audit CI/CD Secrets Scope.
  • Environment variables: a delivery mechanism, not a store. OWASP prefers orchestrator-mounted files or in-memory injection because environment variables leak through logs and dumps. See Environment Variables vs Secrets Manager.
  • Secret zero: the first credential a workload needs in order to fetch all the others. OWASP notes you must secure the primary secret of the secrets manager somewhere else. Platform identity (cloud instance roles, Kubernetes service account token projection, OIDC federation) is the usual way out. See the Secrets Zero Problem Guide.

Comparison table and handling rules

MeaningWhat it isWho holds itTypical lifetimeWhere to storeHow to rotate
OAuth client secretPassword for a confidential clientThe application and the authorisation serverSet by the provider and the registration; choose the shortest workable expirySecrets manager, injected at runtimeAdd new secret, deploy, remove old, revoke issued tokens if leaked; better, move to private_key_jwt or federation
HMAC key (webhooks, signed cookies)Symmetric key at least as long as the hash outputSigner and verifierUntil rotated; often never, which is the problemSecrets manager or KMS on both sidesSupport two active keys during overlap, then retire the old
RADIUS shared secretPer-client key for packet authenticationNetwork device and RADIUS serverYears in many estatesDevice config and server, both protected as credentialsChange on server and device together in a maintenance window; prefer RADIUS over TLS
TOTP seedPer-user key for one-time passwordsAuthenticator app and validation serverLife of the enrolmentEncrypted key store, hardware-backed where possibleRe-enrol the factor; bulk re-enrol after a seed store breach
Kubernetes SecretAPI object containing any sensitive valueThe cluster (etcd), any identity with read rightsAs long as the object existsetcd with KMS encryption, or synced from an external storeRotate the value at its source, then update or recreate the object and restart consumers
CI secretStored variable injected into jobsThe CI platform and every job that reads itUntil changed by handEnvironment-scoped, with approval gates; replace with OIDC federationRotate at the source, update the variable, review job logs

Handling rules that apply to every meaning:

  1. Name the value, not the container. Inventory records should say "Salesforce client secret for billing-sync, stored in Kubernetes Secret billing/sf-creds", not just "billing secret".
  2. Record an owner and an expiry. NIST SP 800-53 IA-5 (Authenticator Management) and NIST CSF 2.0 PR.AA-01 expect credentials for services to be managed, which needs both.
  3. Generate with enough entropy. At least the hash output length for HMAC, at least 32 octets for HS256 client_secret_jwt, at least 16 octets for RADIUS, from a cryptographic random generator.
  4. Protect at rest wherever it lands. SC-28 (Protection of Information at Rest) and CIS Safeguard 3.11 cover etcd, configuration backups and seed stores, not only the secrets manager.
  5. Prefer asymmetric or federated options. private_key_jwt, mTLS and workload identity federation remove the stored shared value.
  6. Treat rotation as source plus copies. A rotation is complete only when the old value is rejected at the source.

Detection and measurement

  • Kubernetes audit: log Secret get, list and watch at Metadata level and alert on list or watch by non-admin identities. These reads map to ATT&CK T1552.007 (Unsecured Credentials: Container API).
  • Repository and log scanning: client secrets and HMAC keys in code or CI logs map to T1552.001 (Credentials In Files). See Git Secret Scanning Guide.
  • Token endpoint telemetry: client authentication from new IP ranges or user agents, and failed client authentication spikes.
  • Metrics: percentage of confidential clients using private_key_jwt, mTLS or federation instead of a secret; percentage of client secrets with an expiry under 12 months; clusters with KMS encryption at rest enabled; RADIUS clients with a unique secret; median age of HMAC and webhook keys.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev. 5IA-5 Authenticator Management; SC-12 Cryptographic Key Establishment and Management; SC-28 Protection of Information at RestLifecycle of secrets and shared keys; encryption of stores
NIST CSF 2.0PR.AA-01; PR.DS-01Service credentials managed; data at rest protected
ISO/IEC 27001:2022 Annex AA.5.17 Authentication information; A.8.24 Use of cryptographyAllocation and handling of secrets; key management
MITRE ATT&CKT1552.001; T1552.007; T1528 Steal Application Access TokenHow secrets of each kind are taken

Practitioner checklist

  • Use the precise term in tickets and runbooks: client secret, shared secret, Kubernetes Secret object, CI secret.
  • Issue client secrets only to confidential clients; give public clients PKCE and no secret.
  • Plan migration of high-privilege confidential clients from client_secret_basic to private_key_jwt or mTLS.
  • Check HMAC, client_secret_jwt and RADIUS secrets against the minimum lengths in RFC 2104, OIDC Core 16.19 and RFC 2865.
  • Enable encryption at rest for etcd and remove list and watch on Secrets from workload service accounts.
  • Move CI cloud credentials to OIDC federation and scope remaining CI secrets to protected environments.
  • Give every secret, whatever its kind, an owner, an expiry and a documented revocation step.
  • After any leak, revoke at the source and invalidate tokens or sessions issued with the old value.

Standards and references

Related NHI Mgmt Group resources: Secrets Management Guide · Client ID and Client Secret Guide · Kubernetes Secrets Security Guide · Secrets Zero Problem Guide · OAuth 2.0 and OpenID Connect Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.