Join our Newsletter — 33% off our NHI Course
Home› Guides› Production Data in Non-Production: A Safe Refresh Runbook…
Guide Data Security

Production Data in Non-Production: A Safe Refresh Runbook for Data, Credentials and Integrations

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 11 November 2026 12 min read
On this page

An environment refresh copies far more than test data: it carries production logins, password hashes, API keys stored in tables, live email addresses and webhook targets into an environment with weaker controls. The policy question of whether production data may be used outside production is covered in the Environment Separation guide, and masking techniques in the Tokenisation and Data Masking Guide. This guide is the operational runbook for when a copy happens: how to plan the refresh, move the data safely, reset every credential and integration that came with it, verify the result and remove it on time. It is for platform engineers, DBAs, release managers and the security teams that approve refreshes.

Key takeaways

  • A restore is a credential copy. Database backups and snapshots include logins, role memberships and often password hashes, plus any secrets the application stores in tables.
  • Neutralise before you open. Reset credentials, rewrite contact details and disable outbound integrations before any tester or job can connect to the refreshed environment.
  • Mask in flight, not after. Data should be masked or subset before it lands in the lower environment; masking after the restore leaves a window where raw data sits in a weaker place.
  • Dynamic masking is not a copy control. Query-time masking hides values in results but leaves stored data unchanged, so it does not make a copied database safe.
  • Every copy has an owner and an end date. Track refreshed copies like any other sensitive data store and delete them on schedule.

What a refresh actually carries

Item copiedWhere it livesRisk in non-productionRunbook action
Database logins and role membershipsEngine catalogue (restored with the database or server)Production DBA and application logins work in test; developers inherit production-level rolesDrop or disable production logins; recreate environment-specific ones
Password hashesEngine catalogue; PostgreSQL global dumps unless excludedOffline cracking; same passwords may work in productionExclude from dumps; reset all passwords after restore
Application secrets in tablesConfiguration, integration and tenant tablesAPI keys, OAuth refresh tokens and SMTP passwords that reach live third partiesReplace with test credentials or null them in the copy pipeline
End-user credentialsUser tables (hashes, MFA seeds, recovery codes)Account takeover in production if seeds or hashes leakReplace with synthetic values; never copy MFA seeds
Contact detailsCustomer, employee and supplier tablesTest jobs email or text real people; personal data exposureMask or rewrite to a controlled domain
Outbound endpointsWebhook, payment, partner API and file transfer settingsTest transactions sent to live partners or payment providersRepoint to stubs or disable before start-up
Scheduled jobsDatabase agents, application schedulersProduction jobs run from test, double processing or sendingDisable jobs at restore; enable selectively
Encryption keys and certificatesKey references, wallets, certificate storesTest can decrypt production data or impersonate production servicesUse separate keys per environment; re-encrypt the copy

The PostgreSQL documentation is a good example of the credential point: pg_dumpall --globals-only and --roles-only include role definitions, and the separate --no-role-passwords option exists so that roles restore with a null password and password authentication fails until a new password is set.

Choosing the refresh method

The Environment Separation guide sets which data types are allowed. Once a copy is approved, the method decides how much risk travels with it.

MethodWhat movesCredential exposureBest for
Full snapshot or backup restoreEverything, including catalogue and secretsHighest; full reset neededRare, approved diagnosis in an environment secured as production
Logical export of selected schemasChosen objects; globals only if requestedMedium; depends on export optionsIntegration testing with realistic structure
Masked subset through a pipelineSampled rows, masked during extractionLow if secrets columns are in the masking rulesMost test and performance work
Synthetic generation from schemaNo production rowsNone from data; still check seeded configDevelopment, training, outsourced work
  • Cross-account snapshots: Amazon RDS lets you share a manual snapshot privately with up to 20 AWS accounts, or publicly with all accounts if unencrypted. Encrypted snapshots cannot be made public, and snapshots encrypted with the default AWS KMS key cannot be shared, which makes customer managed keys a useful control point: AWS documents copying the snapshot under a customer managed key whose policy names the target account, and the target then copies it again under its own key. Because the source account controls that key policy, it can scope exactly which account can read the copy. Only share with the named target account, never with all, and check sharing with describe-db-snapshot-attributes.
  • Query-time masking: Microsoft describes Azure SQL dynamic data masking as hiding values in query results while the data in the database is not changed, and users with administrative rights such as server admin or db_owner see original data. A copy made from a database with dynamic masking contains the real values.
  • Pseudonymised copies: the ICO is clear that pseudonymised data remains personal data for anyone who holds the additional information needed to re-identify it. Keep that information out of the lower environment entirely. See the Pseudonymisation Techniques Guide.

The refresh runbook

The sequence below is an NHI Mgmt Group recommendation. The order matters: nothing should be able to connect to the environment until the neutralisation steps are complete.

  1. Approve: record the requester, purpose, data classes, approver (the data owner, not the requester's manager), target environment and deletion date. This is the evidence NIST SP 800-53 SA-3(2) auditors ask for.
  2. Isolate the target: block inbound user access and outbound network egress from the target environment for the duration of the restore, except to the restore source.
  3. Extract with exclusions: exclude role passwords and global objects where the tooling allows, and apply masking and secret-nulling rules during extraction so raw values never land in the target.
  4. Restore with jobs disabled: restore with schedulers, database agents, replication and mail features disabled, so no production job runs from the copy.
  5. Reset database identities: drop or disable every production login and role that is not needed, create environment-specific logins with new passwords from the target environment's vault, and remap application users. See the Secrets Management Guide.
  6. Replace application secrets: overwrite API keys, OAuth client secrets and refresh tokens, SMTP and payment credentials, and signing keys stored in tables with test values. Treat any production secret found later as exposed and rotate it in production.
  7. Rewrite contacts and endpoints: change email addresses and phone numbers to a controlled test domain or masked values, and point webhooks, payment and partner endpoints at stubs.
  8. Reset end-user authentication: replace user password hashes with a known test value or disable users, and clear MFA seeds, recovery codes and session tables.
  9. Verify: run automated checks (see below) before opening access. Fail the refresh if any check fails.
  10. Open access: enable test users and jobs selectively, and record the environment in the data inventory with its owner and deletion date.
  11. Expire: delete or re-mask the copy on the recorded date, and delete intermediate exports, snapshots and shared snapshot permissions.

Rollback: if verification fails, do not attempt to fix forward in an open environment. Keep access blocked, drop the restored databases and rerun from the extraction step with corrected rules.

Verification checks

  • Login diff: compare the list of logins and role members with the expected environment baseline; any production-only login is a failure.
  • Secret scan: scan configuration tables and exported files for credential patterns and known production key prefixes. See the Secret Sprawl Measurement Guide.
  • Canary values: seed known canary records in production (a fake customer with a unique email) and confirm they appear masked in the copy.
  • Endpoint check: query outbound configuration for any production hostname or live payment endpoint.
  • Egress test: confirm the environment cannot reach production databases, identity providers or partner endpoints.
  • Job state: confirm all schedulers and agents are disabled or on an approved allow list.

Beyond the database: other stores that travel

Refresh runbooks often stop at the relational database. Production data and secrets also travel through other stores, and each needs the same neutralisation.

  • Object storage: uploaded documents, images and exports copied with a bucket sync. Copy only the prefixes the test needs, apply the same masking decision to documents (which often cannot be masked and should be replaced with samples), and keep production bucket policies and access keys out of the target configuration.
  • Search indexes and caches: search clusters and caches rebuilt from production carry unmasked text fields. Rebuild them from the masked copy rather than snapshotting the production index.
  • Message queues and event streams: replaying production events into test can resend real notifications and carry tokens embedded in payloads. Replay only from masked or synthetic event sets.
  • Application configuration and environment files: copying a production configuration bundle to speed up a refresh is a common way production secrets reach test. Generate configuration per environment from its own vault path.
  • SaaS sandboxes: many SaaS platforms offer full-copy sandboxes refreshed from production. Apply the same runbook: check what the platform rewrites automatically and what it does not, reset integration users and connected app secrets, and disable outbound messaging until verified. Confirm current sandbox behaviour in the vendor's documentation.
  • Logs and backups of the copy: the non-production environment's own backups and logs now contain whatever the copy contained. Include them in the deletion step.

Where identity fits

Refreshes cross the line between environments, so the identities involved deserve attention.

  • Refresh pipeline identity: the job that reads production and writes to test is a privileged machine identity with read access to production data. Give it a dedicated identity, read-only on the source, no interactive login, and a named owner. See the Service Account Security Guide.
  • Test accounts: the environment-specific logins and test users created after the refresh need owners and expiry like any other test account. See the Test Accounts Governance Guide.
  • Shared credentials between environments: a password or key that works in both test and production turns any test compromise into a production compromise. Every environment gets its own vault path and its own keys.

Small and large organisations

SituationRecommended approach (NHI Mgmt Group)Trade-off
Small team, one or two applicationsSynthetic or seeded data by default; scripted restore with a post-restore SQL script that resets logins, secrets and contacts; manual approval logScripts drift as schemas change; review them with each release
Mid-size, regular test refreshesMasked subset pipeline with rules for secret columns, automated verification gate, copies registered in the data inventoryPipeline needs ownership and maintenance
Large or regulatedTest data management platform, no full copies outside production-grade environments, data owner approval workflow, automated expiryCost and lead time; some defects are harder to reproduce

Detection and measurement

Monitor for snapshot sharing changes and cross-account restores, large exports from production databases, logins to non-production using production account names, outbound connections from test to production or live partners, and refreshed environments past their deletion date.

  • Approved copies: percentage of production copies outside production with a recorded approval and owner.
  • Verification pass rate: refreshes that pass all checks first time.
  • Secrets found: production secrets found in non-production per quarter (each triggers production rotation).
  • Overdue copies: non-production copies past their deletion date.
  • Time to neutralise: time between restore completion and credential reset completion.

Framework mapping

Control areaNIST SP 800-53 Rev 5NIST CSF 2.0
Approval and protection of live data in testSA-3(2) Use of Live or Operational DataPR.DS-01
Credential reset and separate secretsIA-5 Authenticator ManagementPR.AA-01
Masking and data minimisationSI-12 Information Management and RetentionPR.DS-01
Encryption of copiesSC-28 Protection of Information at RestPR.DS-01
Deletion on scheduleSI-12, MP-6 Media SanitizationPR.DS-01

Common failure patterns

  • Restore first, mask later: the copy lands raw and the masking job runs the next day, or fails silently, leaving real data open to every tester.
  • Production logins survive: the restored database still accepts the production application login, and its password is the same in both environments.
  • Integration keys still live: a payment or messaging key in a settings table lets test code send real transactions or messages.
  • Customers emailed from test: a scheduled job sends notifications to real customer addresses because contacts were not rewritten.
  • Snapshots shared too widely: a snapshot shared to a broad set of accounts, or left shared after the refresh, becomes an uncontrolled copy.
  • Copies never deleted: a diagnostic copy approved for two weeks is still running a year later with no owner.

Practitioner checklist

  • Require a recorded approval, owner and deletion date for every production copy outside production.
  • Exclude role passwords and global objects from exports where tooling allows.
  • Mask personal data and null secret columns during extraction, not after restore.
  • Restore with jobs, mail and replication disabled and egress blocked.
  • Reset all database logins and application secrets using the target environment's vault.
  • Rewrite contacts and repoint outbound endpoints to stubs.
  • Run automated verification and fail the refresh on any finding.
  • Rotate in production any production secret found in a lower environment.
  • Delete copies, intermediate exports and snapshot shares on schedule.

Standards and references

Related NHI Mgmt Group resources: Environment Separation · Tokenisation and Data Masking Guide · Test Accounts Governance Guide · Anonymisation and Re-identification Risk Guide

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
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 11 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org