Join our Newsletter — 33% off our NHI Course
Governance, Ownership & Risk

Primary Key

← Back to Glossary
By NHI Mgmt Group Updated November 18, 2026 Domain: Governance, Ownership & Risk

A primary key is the field or field pair a system uses to identify one record uniquely. In identity systems, it should be stable and non-reusable. Email is usually a poor choice because it can change hands, while issuer plus subject from OpenID Connect stays tied to the identity provider’s assertion.

What Makes a Primary Key Security-Relevant

A primary key is more than a database convenience, because it is the stable identifier that other records, joins, audit trails, and access decisions rely on. When that identifier is weak, mutable, or reused, the system can confuse one entity for another, which is especially dangerous in identity and authorization flows.

In identity systems, the design choice matters because the key should continue to point to the same subject over time. A value that can be reassigned, such as an email address, can create ambiguity if it is later transferred, reclaimed, or repurposed.

Stability, Uniqueness, and Reuse

The core properties of a good primary key are uniqueness, persistence, and non-reuse. Uniqueness prevents collisions, while persistence ensures the record stays bound to the same subject even if a user changes names, tenants, addresses, or contact details.

Non-reuse is especially important in identity-oriented systems. If a deleted identifier can be reassigned to a different person or service, historical records may appear to belong to the wrong subject, and downstream systems may inherit incorrect trust or entitlement assumptions.

Primary Key Design in Identity Systems

In identity platforms, the best primary key is usually an internal immutable identifier, not a business attribute. OpenID Connect illustrates the pattern well, because issuer plus subject forms a stable pair that stays anchored to the identity provider’s assertion rather than to an attribute that may change outside the system.

That separation between internal identity and user-facing attributes reduces operational drift. The display name, email address, or login alias can change, but the underlying key remains the same, which helps preserve account continuity, correlation, and governance.

For a broader control perspective on identity data and access design, see NIST Privacy Framework for governance over identifiers and data handling, and NIST SP 800-63 Digital Identity Guidelines for identity proofing and authenticators that depend on stable subject binding.

Why Primary Keys Matter Across Systems

Primary keys are also a hidden integration contract. Data warehouses, application logs, entitlement stores, and API records often assume the same key will continue to represent the same subject, so a poor choice can ripple across reporting, incident response, and account lifecycle management.

That is why systems that expose externally meaningful identifiers should distinguish between human-readable attributes and durable record identifiers. When the business surface changes but the key does not, joins remain reliable and historical evidence stays interpretable.

For implementation patterns around durable identifiers in security-sensitive platforms, Azure SQL and Cosmos DB Security Guide and Dropbox Sign Security both show how stable keys, roles, and auditability support secure platform design.

Risk and Threat Considerations

Weak primary key design creates both integrity and security risk. If a primary key is guessable, mutable, or reused, records can be misattributed, access decisions can attach to the wrong subject, and attackers may exploit identifier confusion to reach data or actions that should belong to someone else.

Failure mechanism: A system binds identity, authorization, or history to a value that later changes hands or can be reassigned, then downstream services continue treating the old key as authoritative.

Impact: The result can be record corruption, incorrect account linkage, broken audit trails, privilege confusion, and in identity systems, mistaken trust in the wrong subject.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-63 and NIST SP 800-53 Rev 5 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
NIST SP 800-63Digital Identity GuidelinesDefines stable identity binding and authenticator lifecycle for digital subjects.
Recommendation — Use stable subject binding and avoid relying on mutable attributes as long-term identifiers.
NIST SP 800-53 Rev 5IA-4 — Identifier ManagementCovers assigning and managing identifiers that stay unique and traceable over time.
IA-5 — Authenticator ManagementSupports the lifecycle separation between identity identifiers and authenticators/credentials.
Recommendation — Assign identifiers that remain unique, controlled, and non-reusable across the record lifecycle. Separate identity identifiers from credentials and manage each through its own lifecycle.
ISO/IEC 27001:2022A.5.12 — Classification of informationSupports treating identity keys and linked records as governed information assets.
Recommendation — Classify and protect identifiers that anchor sensitive records and audit evidence.

Practitioner Guidance

What to watch for: Treat any primary key that comes from a mutable user attribute, reused external reference, or business field with changing ownership as a design smell. Durable systems usually separate the immutable internal key from presentation fields and from externally managed identifiers.

Governance implication: Decide which identifier is authoritative for joins, audit, lifecycle events, and security checks, then keep that choice consistent across applications and data stores. If an external identifier must be retained, make sure it is not also being used as the system’s long-term identity anchor.

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.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org