Why locking sensitive Magento configuration values matters for a stolen admin login
Locking sensitive Magento configuration values means moving payment gateway credentials, ERP and marketplace API keys and other security settings out of the admin form and into deployment-side configuration, so that a valid admin login alone cannot read or replace them. In a typical self-hosted store, these values sit in the admin where any user with access to the relevant configuration screen can view them, copy them or change them to point a payment or integration at an attacker-controlled endpoint. A stolen password, a phished session or a dormant agency account then becomes a route to money and customer data, not only to the storefront.
The control works by separating who can see a value from who can edit it. With config:sensitive:set, the value is written through the command line and stored in the configuration, and the admin is no longer the place where it is maintained. Magento also supports locked configuration, where a setting is defined in the environment configuration file so that the admin screen shows it as read-only. The values that usually belong in this set are payment gateway credentials and webhook secrets, ERP, PIM and marketplace API keys, mail and SMS provider credentials, and security settings such as the admin session and lockout behavior. Confirm the exact command syntax, which paths are supported as sensitive and how locked values are declared for the version you run in Adobe's configuration guide and the Magento Open Source documentation for your release, because behavior differs between versions.
Teams usually need this control in three situations: after staff turnover, when a former administrator may still know where credentials are kept; when an agency or contractor has admin access for a project and that access must end cleanly; and when a store has been through a suspected compromise and must rotate credentials without trusting the admin panel. Before rollout, ask your implementation partner to list every credential the store uses, name who needs to change each one and confirm which values can be locked in your version. A locked value still has to be rotated at the provider, and the new value must be deployed through your release process rather than typed into the admin.
Configuration options for sensitive values and when each fits
This table compares four ways a Magento Open Source store can hold a sensitive value, such as a payment credential or API key. Read each row to see who can change the value after deployment, where it lives, how it reaches production, and which teams it suits. The main takeaway is that the more the value is locked away from the admin panel, the more the change moves into your deployment pipeline.
| Option | Who can change it later | Where it is stored and how it is deployed | When it fits |
|---|---|---|---|
| Plain admin-editable config | Any admin user with access to the relevant Stores > Configuration section | Stored in the database; set through the admin panel and carried between environments by hand or by database copy | Low-risk settings that marketing or store staff change often; not suitable for credentials |
| Sensitive value set with config:sensitive:set | Anyone with shell access to the server who can run the command, but not admin users through the panel | Stored in the database, encrypted with the store encryption key; set per environment with the Magento CLI | Credentials you want kept out of the admin UI but still managed on each server; confirm the command and its behavior for your version in the Adobe configuration guide |
| Locked values in the deployment configuration | Only engineers who change the deployment configuration and deploy it; the admin panel shows the field as locked | Stored in app/etc/env.php or config.php and deployed with the code; treat the file as a secret and keep it out of version control | Payment gateway keys, ERP and API credentials, and security settings that should change only through a reviewed release |
| Environment values in the deployment pipeline | Whoever controls the CI/CD secrets store and the pipeline that writes the configuration | Injected at build or deploy time from a secrets manager or pipeline variables; the value never sits in the repository | Teams with a mature pipeline and multiple environments that need audited, rotated secrets; confirm how your pipeline writes these values into the Magento configuration |
How Magento stores and resolves locked configuration
A locked configuration value is only as trustworthy as the place Magento reads it from, so the first thing to understand is that a setting can come from more than one source. Magento keeps most store configuration in the core_config_data table of the database, which is what the admin screens edit. Values can also be set in the deployment configuration file app/etc/env.php and related files, and some installations supply values through environment variables. When Magento loads a setting, it follows a documented order of precedence across these sources. A value locked in a deployment file or environment source takes priority over the same setting saved in the database, and the admin form then shows that value as read-only. That is the mechanism that stops a stolen admin login from changing it. Confirm the exact file locations, the precedence order and which settings can be locked in Adobe's configuration documentation for your release line before you rely on any of them.
Sensitive values such as payment gateway credentials and API keys are stored encrypted, and the encryption key in env.php is what decrypts them at runtime. The key does not sit in the database, so a compromised database alone does not expose plain text credentials. The consequence runs the other way too: database dumps, replicas and backups still contain the encrypted values, and they can only be read with the matching key. Any backup you keep must therefore be stored with the key that was active when it was taken, and key rotation changes what a restore requires. Plan where the key lives, who can read it, and how a backup from before a rotation would be decrypted. Ask your team to test a restore into a non-production environment, because a backup whose key has been lost is recoverable only in theory.
Before you change anything, inventory every sensitive setting in the admin and record where each one currently resolves from. Check whether the value is stored in the database, set in a deployment file or supplied by an environment variable, and note any value that exists in more than one place, because the one that wins may not be the one you edited. Confirm with Adobe's documentation how a locked value is reported in the admin and in the command line, so your team knows what a read-only field means during an incident. Then decide which team owns each value, where its source of truth lives, and how a change is made through your deployment pipeline rather than by hand on the server.
Where a sensitive value comes from and who can change it
A locked value starts in the deployment layer, either app/etc/env.php or a pipeline secret that is written with config:sensitive:set or config:set --lock-env. The admin UI sends a change request to the server, and the server checks whether the path is locked before it writes to the database. Only the deployment side can change a locked value, so an admin session with stolen credentials is stopped at the trust boundary. Check that the encryption key and your database backups are protected, because both still hold the values after locking.
Admin changes are blocked for locked values, while the deployment layer and backups still hold the data.
Setup sequence for locking payment credentials and API keys
This sequence moves payment gateway credentials, integration API keys and security settings out of editable admin fields and into sources the admin cannot overwrite. Each step ends with a check, so the team can confirm the result on staging before any change reaches production.
Inventory every sensitive value
List each payment credential, ERP, PIM and marketplace API key, mail or messaging secret, and security setting. Check the Stores configuration screens and the settings pages of every installed extension, and record the scope (default, website or store view), the current storage location and the person who owns each value. Compare the list against the live admin and the code repository, and confirm that no sensitive value is missing before moving on.
Decide which values to lock
Agree with the store owner, the security lead and each integration owner which values will be locked and where each one will be sourced, either from the deployment configuration or from a secret store the team controls. Record one owner per value and note which integrations read it. The check is a decision table in which every row has a source and an owner, with no value left undecided.
Confirm the documented method for your release
Read Adobe's configuration documentation for your exact Magento Open Source version to confirm how config:sensitive:set and locked configuration behave. Check which config paths they support, what the command writes to the environment and configuration files, and whether any steps differ from older releases. Behavior can change between releases, so do not rely on an older guide. Record the version, the documented steps and open questions for your partner or Adobe support.
Apply the values on a staging copy
Build a staging copy from a recent production backup. Set each value only through the documented command or deployment configuration, and keep the admin screen out of this step. Store the commands in version control or the runbook instead of shell history or chat. The check is that the staging configuration shows each value at the expected scope, and that a cache flush does not reset any of them.
Clear stored plaintext copies
Where the documentation says the database copy must be removed, delete the stored plaintext rows for each locked path on staging, then flush the caches and run any reindex the documentation requires. Record each path cleared and the query or command used. The check is that a read of the configuration table returns no plaintext secret for those paths, and the value still resolves from its locked source in the storefront and in the integration.
Verify locked state and live calls
Sign in to the staging admin with a test account that does not own the values, and open each locked field. Confirm that it displays as locked, cannot be edited and does not reveal the secret. Then run a test checkout in the payment gateway's sandbox and one read or write call for each integration using its test credentials. The check is that the test order completes and each integration call returns the expected response.
Document rollback and secret holders
Write the rollback procedure, including how to restore the previous configuration source and which backups hold earlier values. Name who can change the deployment secrets, who approves those changes and where the secrets are stored, and limit access to the people named in the record. The check is that someone outside the build team can follow the rollback on staging and reach the same working state, and that the access list matches the owners recorded in the decision table.
Which values to lock first, by category
Payment gateway credentials are usually the first values to move because a changed gateway secret, merchant identifier or environment switch can redirect card transactions or let an attacker test stolen card data. Typical values include the gateway API secret, the merchant account identifier, the sandbox or production mode flag and any webhook signing secret. If an attacker changes them, the result is direct financial exposure and changed payment routing, which also feeds into your PCI DSS scoping work.
- API secret and merchant ID: the private credential the gateway extension uses to authorize charges. Confirm which config path the extension reads at runtime.
- Environment switch: a flag that points the store at sandbox or live gateway endpoints. A silent change can send live orders to a test account.
- Webhook or callback secret: used to verify gateway notifications. Confirm whether the extension checks signatures against the stored value before you move it.
- Vault and token settings: confirm the extension does not depend on values encrypted with the store key in a way that breaks when the storage location changes.
Before moving any gateway value, confirm the path with the gateway extension documentation and place a test order in the sandbox after the change.
Integration keys let an ERP, PIM or middleware connector read orders and write catalog, price and stock data. Many are issued to an integration user rather than a person, so they outlive staff changes and are easy to forget during reviews. If an attacker changes the endpoint or the key, order and customer data can be sent to the wrong system, and prices or stock levels can be overwritten.
- Endpoint URLs: the address the connector sends orders to or pulls catalog data from. Redirecting it moves customer and order data to another host.
- Integration tokens or client secrets: confirm whether the token comes from the admin integration screen and whether the connector caches it between requests.
- Sync schedule and batch size: changes can cause duplicate orders or overwrite stock counts with stale data.
- Attribute mapping settings: confirm which Magento attributes the connector writes back, since a changed mapping can alter prices or product data in bulk.
Ask the integration owner which values the connector reads at runtime, whether it caches them, and whether a token rotation requires a restart or a cache flush.
Carrier and marketplace keys are credentials for third-party accounts that bill, ship or publish on your behalf. A changed carrier account number can send labels and charges to another account, and altered marketplace credentials can publish listings or pull order data from a different seller account. These values are often set at store view or website scope, which makes them easy to miss in a review.
- Carrier account numbers and API keys: tie shipments and billing to your account. Confirm whether the carrier module reads them from the default, website or store view scope.
- Marketplace seller credentials: let the connector publish listings and retrieve orders. Confirm how the connector refreshes tokens and whether it stores them in the database.
- Tracking and label callback URLs: confirm whether they are set per store view and whether the carrier validates the callback origin.
- Sandbox and test account flags: carry the same risk as payment environment switches, so check them alongside production credentials.
For each value, record every scope where it is stored, because a locked value at one scope does not change what another scope holds.
Security settings control how difficult it is to reach the admin and how long a session remains valid. An attacker with a stolen admin login can change lockout thresholds, session lifetimes or two-factor settings to make the next intrusion easier and to hide it. Locking these values stops the admin account from weakening the defenses that protect it, and the change is visible in configuration history when someone tries to edit them.
- Session lifetime and lockout settings: control how long a session stays valid and how failed logins are handled. Confirm the exact configuration keys in your Magento version before locking.
- Two-factor authentication providers: locking the provider list stops an attacker from disabling 2FA. Confirm that every admin user has finished enrolment first, so a lock does not leave someone without a working method.
- CAPTCHA settings: protect login and other forms. Confirm the site keys and which forms the setting covers before you lock it.
- Admin path and secret key settings: affect URLs, deployment scripts and bookmarks. Confirm that no pipeline or staff routine depends on the current value.
- Content Security Policy settings: Adobe documents that from 2.4.7, CSP runs in restrict mode by default on storefront and admin payment pages, so confirm the policy works before you lock any change to it.
After each change, test admin login, 2FA enrolment and a checkout payment page on staging.
Security and operational risks that remain after locking
Locking sensitive values moves them out of the admin, but the secrets still exist in configuration, backups, pipelines and people's hands. The cards below cover the places where a locked value can still leak or be changed, and what the operator must own for each.
Encryption key and restored backups
Values stored with config:sensitive:set are encrypted with the store's encryption key, which normally sits in app/etc/env.php. A database backup restored without the matching key yields unreadable values, while a backup restored alongside the key yields working credentials. Store backups and key copies in separate, access-controlled locations. Confirm who can restore backups and whether restore tests exercise the key path.
Pipeline and CI secrets
Deployment pipelines often hold the plaintext values needed to run config:sensitive:set or to write env.php during a build. Those variables can appear in build logs, cached images or job histories. The locked value is only as protected as the pipeline runner that sets it. Check who can read CI variables, whether logs mask them, and whether runners are isolated per environment.
Server users who read config files
Locking hides values from the admin interface, not from the filesystem. Any operating system user or process that can read app/etc/env.php or the web root's deployment files can read the encryption key and, with database access, the stored values. Restrict file ownership to the deployment user, keep the PHP-FPM pool user separate from maintainers, and review who holds shell or SSH access to the store host.
Extensions that log or echo values
A third-party module can read a locked value through the configuration API and write it to a log, an error message, a debug page or an external service. Locking does not stop code that is already running with access to the value. Review the extensions that touch payment, shipping or ERP settings, check their logging and error output, and confirm that test and staging environments do not receive production credentials.
Change control for locked source
Locked values are usually set in configuration files or deployment scripts, so a change to those files becomes the new control point. A commit that alters the lock, the value or the script can bypass the admin entirely. Require review for changes to deployment configuration, keep the repository access list short, and record who approved each change to a credential or security setting.
Rotating credentials after compromise
If an attacker reads a locked value or the encryption key, locking offers no protection for that credential going forward. Rotation means changing the secret at the provider, updating the locked value, and treating any copy of the old value as exposed. Plan the order of these steps before an incident, and confirm with each payment or ERP vendor how quickly they can issue replacement keys.
Questions buyers ask before locking Magento configuration
Can our own team lock Magento configuration values without a partner?
Yes, if your team already runs Magento Open Source with a version-controlled deployment and has someone comfortable with the command line. The work is a short list of steps: decide which values move out of the admin, store them in your secrets store, write them to the environment with config:sensitive:set or the environment configuration, and lock the rest so the admin cannot edit them. The harder part is proving the change works in every environment without breaking checkout, which is where teams without staging parity usually need outside help. Ask your team to list the payment and API settings in scope before deciding who does the work.
What makes this work take longer or cost more?
Three factors drive most of the effort. The first is the number of integrations, since each payment gateway, ERP connector and marketplace feed holds its own credentials. The second is how many extensions read configuration at runtime, because each one needs checking to confirm it still reads values from the new source. The third is pipeline maturity: if deployments are manual, the configuration has to be applied by hand in every environment, and drift between staging and production becomes a risk. A quote should itemize the integrations in scope, the extensions reviewed, the pipeline changes, the staging work and the test runs.
How long does locking sensitive configuration usually take?
Duration depends on the same drivers as cost: how many integrations hold credentials, how many extensions read configuration, how mature your deployment pipeline is, and how closely staging matches production. A small store with one payment gateway and a working pipeline needs far less time than a multi-channel store with an ERP connector and manual releases. No fixed figure applies across those cases, so ask for a timeline that lists each integration and environment separately and states what it depends on. Timelines should also account for a test payment sandbox being available when the team needs it.
What do we need to give the team before the work starts?
The team needs four things. First, admin access with a role that can view the current configuration and the integration list. Second, access to the deployment pipeline and the repository that holds environment files. Third, a secrets store where the credentials can live, along with a named owner who can rotate them. Fourth, a test payment sandbox and test credentials for each gateway, so changes can be verified without touching live transactions. Confirm these access paths in writing at scoping, because a missing sandbox or secrets store is the most common reason verification gets delayed.
Does locking configuration stop an admin who has server access?
No. Locking stops changes made through the admin panel, but anyone with shell access to the server or the database can still alter stored values or the environment that supplies them. Locking is one layer of a wider control set that includes restricted server access, least privilege admin roles, two-factor authentication and monitoring of configuration changes. Treat it as a way to reduce what a stolen admin login can change, not as protection against a privileged insider. Your security team should confirm the threat model and the server access controls separately.
How do we verify the change and roll it back if something breaks?
Verification should cover each integration in each environment: a test payment, a test ERP sync, and a check that the admin shows the locked fields as read-only or sourced from the environment. Record the before and after state of every value and keep the previous configuration in version control so it can be restored. Rollback means reapplying the prior environment values and clearing the configuration cache, then rerunning the same checks. Ask the team to document the rollback steps and test them in staging before the production change, so the procedure is proven before it is needed.
What should a quote for this work itemize?
A useful quote lists each deliverable separately rather than giving one total. Expect line items for the configuration inventory, the list of values to move and lock, the secrets store integration, changes to the deployment pipeline, the extension compatibility review, staging and production changes, verification runs for each integration, and the rollback procedure with its test. Each item should name what it depends on, such as sandbox access or pipeline ownership. Ask which items are one-time work and which recur, such as credential rotation or a review after each Magento Open Source patch.
Limits to confirm in your environment before you lock values
Locking configuration only protects you if the release, extensions and hosting behave as the documentation describes. The cards below list what to confirm on your own store before you move credentials out of the admin, so a locked value does not fail silently or break a payment flow.
Honor of the locked value
Confirm that your installed Magento release and each payment or ERP extension read the value from the locked or sensitive configuration store rather than from the admin form or a copy in a database table. A payment extension that keeps its own cached copy of the credential can keep working with an old key, or fail after you change it. Test one transaction in a staging store and check where the extension reads its credential before you lock it in production.
Commands in your release line
Confirm which bin/magento config:sensitive:set and config lock commands exist in the release line you run, and what arguments they accept. Command names and flags can differ between releases, so copy the syntax from the documentation for your exact version, not from an older runbook or a forum post. Record the version next to the command in your change ticket.
Secret storage in your hosting
Confirm how your hosting platform stores the values that go into env.php or deployment configuration, who can read them, and whether they appear in CI logs, build artifacts or backups. Locking a value in the database does not help if the same secret sits in a plain-text pipeline variable that every developer can read. Ask your hosting or platform team to document the path from secret store to running store.
Scope across websites and stores
Confirm whether your payment, shipping and ERP settings are defined at default, website or store view scope. A value locked at one scope does not automatically cover another, so a second website can keep an unlocked credential. List every scope that holds a payment or integration credential and set or verify the value for each one.
Match between docs and your steps
Confirm that the Adobe documentation for your exact version matches each step in your runbook, including the order of commands, cache flushes and deployment steps. Documentation pages are versioned, and a step written for a newer release may not exist in yours. Treat any step you cannot find in the docs for your version as unverified until a test store confirms it.
Supported release line
Confirm that your store runs a release line that Adobe still supports under its lifecycle policy before you rely on these controls. Security behavior and commands are maintained on supported lines, and an unsupported line may not receive fixes for the settings you are locking. Check the end of regular support date for your line and plan an upgrade if it falls soon.
Lifecycle policyHow DeployOpen works on this
DeployOpen plans and delivers locked configuration work inside your own Magento Open Source environment, so the values that matter most never sit in the admin where a stolen login could change them. Scope, build, handover and support are agreed in writing, with fixed scope for the initial work and retainers available afterward.
How we scope
- Inventory every payment, shipping, ERP and API credential currently stored in the admin and its database tables.
- Agree which settings move to env.php or deployment-time configuration and which stay admin-editable.
- Document who holds deployment access, who may change locked values, and how changes get approved.
- Record the written scope, deliverables and timeline before any configuration change begins.
How we build
- Apply sensitive values through config:sensitive:set and env.php in a staging copy that mirrors production.
- Lock selected settings so admin edits are blocked, then confirm the storefront and integrations still work.
- Test that a logged-in admin without deployment access cannot read, change or override locked values.
- Review file permissions and shared configuration so secrets do not leak into version control or backups.
How we hand over
- Deliver a runbook listing each locked key, its storage location, owner and the command used to rotate it.
- Provide a change procedure for deployment pipelines so future releases keep locked values intact.
- Walk your operations and security staff through verification steps and the audit evidence to retain.
- Hand over test results showing before and after states for each locked setting.
How we support
- Offer ongoing support and upgrade coverage for locked configuration as a retainer after the initial engagement.
- Revalidate locked settings when Magento Open Source patches or extensions change configuration handling.
- Support credential rotation and key changes on the schedule your security team sets.
- Confirm current retainer terms and response expectations in the written quote before work starts.

