A hard-coded password can leak through source files, build artifacts, and deployments. Learn why AEM teams should remove embedded credentials, store them in Cloud Manager secrets or a vault, and read them securely at runtime—making access control and secret rotation much easier.

Multiple Choice

A DevOps engineer is managing an AEM as a Cloud Service Sites environment. During final testing, a code quality check flags a hard-coded password in a service property. What should the DevOps engineer do?

Hard-coded credentials are a serious security risk, especially in a deployment pipeline. The test flags a password embedded in a service property to prevent secrets from being exposed in code, configuration files, or build artifacts. The correct course is to involve the development team and have them remove the password from the code and replace it with a secure secret reference. In practice, that means storing the credential in a secret management facility (for example, Cloud Manager secrets or a vault) and configuring the service to read the value at runtime from that secure store, typically via an environment variable or a secure property reference. This approach supports secret rotation, access control, and reduces the chance of leakage across versions and environments. Suppressing the warning or bypassing the check would weaken security and set a bad precedent, and ignoring the warning means the vulnerability would persist into production.

Why Hard-Coded Passwords Don’t Belong in AEM Cloud Service Code

A hard-coded password can look like a small mistake: one value tucked into a service property, easy to miss among lines of configuration. But once that value enters a codebase, it can travel much farther than its author intended—into version history, build artifacts, logs, and every environment where the code is deployed. For an AEM as a Cloud Service Sites environment, a code quality warning about an embedded password deserves a clear response: tell the development team and have them remove it.

That response isn’t a paperwork step. It’s how a deployment pipeline helps protect the system before risky code reaches production.

A password in code has a long memory

Developers sometimes add a credential directly to a property file to get a service working quickly. The trouble is that source code is built to be shared and retained. A password committed today may remain in repository history even after someone deletes it from the current version. It may also appear in a package or build artifact that gets copied between stages.

This creates several kinds of risk. Anyone with access to the repository or artifacts might be able to find the credential. If the same password is used in more than one place, a leak in one area could affect others. And if the password changes, teams may need to update and redeploy code just to keep a service running.

A quality check that detects a likely password is meant to catch this sort of issue early. It’s a useful signal—not an obstacle to get around.

Treat the warning as a security issue

When the check flags a service property, the DevOps engineer should inform the development team and ask them to remove the hard-coded value. The team can then change the service configuration so it reads the credential securely at runtime.

In an AEM Cloud Service setup, that generally means using an approved secret-management facility, such as Cloud Manager secrets or an organization’s vault. The service should obtain the value through a secure property reference or environment variable, according to the project’s configuration and platform guidance. The exact wiring can vary, but the principle stays the same: the secret should not be stored as plain text in application code or ordinary configuration.

This change also makes the system easier to manage. Teams can grant access to the secret only where it’s needed, rotate it without editing source files, and keep different environments from relying on one shared credential. It’s a cleaner separation: code describes how a service works; the secret store supplies sensitive values.

Why suppressing or bypassing the check backfires

It can be tempting to silence a warning and keep a release moving. A suppression annotation may make the alert disappear from the report, but it doesn’t remove the password. The risk remains; only the signal has been muted.

The same goes for bypassing a pipeline step or ignoring the warning. A deployment pipeline is there to enforce consistent checks, including checks that may feel inconvenient when a release is nearly ready. Contacting support to get around a security gate, or continuing without a fix, treats the detection as the problem rather than the exposed credential.

There are cases where a finding may be a false positive. If so, the team should review it and follow the organization’s documented process for resolving that finding. But a real password in a service property is not a harmless style issue. Suppressing it without removing the secret weakens the protection the check was designed to provide.

Remove the value—and consider what it touched

Once the team confirms that the property contains a real credential, they should remove it from the code and configure the service to read from the approved secure source. They should also consider whether the secret was committed previously or included in any build artifacts.

If it was exposed, deleting the current line may not be enough. The credential may need to be rotated, and the team may need to review repository history, artifact storage, and access logs under its security procedures. This is especially important if the password was reused or had broad permissions. A secret is a bit like a house key: taking a photo down from the noticeboard doesn’t make the old key safe again.

DevOps can help coordinate this work by explaining where the check found the value, identifying the affected build or environment, and making sure the corrected change passes the pipeline. The development team owns the code change, while security and platform teams can advise on rotation and secret storage. Clear handoffs keep a small finding from turning into a prolonged release issue.

Build a safer habit around configuration

The best fix is more than moving a password from one file to another. Teams should make it routine to keep credentials out of source control and to review how each service receives sensitive settings. Configuration reviews, repository scanning, and clear guidance on secret storage can catch problems before the final stages of a release.

It also helps to keep secrets narrow in scope. A service should receive only the credentials it needs, and environments should use appropriately separated values. Rotation should be possible without a code change. These habits reduce the impact of a leak and make routine operations less brittle.

None of this has to make development slower. In fact, a consistent secret-handling approach can save time later. Teams avoid emergency edits, reduce uncertainty during deployments, and know where to look when a credential needs to change.

A small alert can prevent a larger incident

A hard-coded password may occupy just one line, but its reach can extend across a repository, pipeline, and production system. In AEM as a Cloud Service, the sensible response is to involve the development team, remove the credential from code, and replace it with a secure runtime reference.

A quality check is doing its job when it catches a secret before deployment. The goal isn’t to make the warning disappear; it’s to make the underlying risk disappear.