The Cybersecurity and Infrastructure Security Agency published an unusually useful account of an incident inside its own environment. An investigative reporter contacted the agency after a security researcher, whose company continuously scans public source-code repositories, found CISA material in a public repository. It included Amazon Web Services GovCloud keys, infrastructure-as-code, build code and credentials tied to administrative and build activity.
CISA removed the public exposure, took the affected development resources offline, rotated credentials, revoked the individual’s access, preserved evidence and reviewed its telemetry. Its investigation found no evidence the exposed credentials were used outside its environments and no indication that customer or mission data was exposed.
That is a good outcome. It should not obscure the lesson.
Cloud credentials leave controlled environments through ordinary development behavior. Someone copies a repository to troubleshoot a build, tests an automation from a personal account, or saves configuration somewhere convenient. If the only thing standing between that and an incident is policy plus individual caution, one routine action becomes a serious event.
For growing SaaS companies and cloud-dependent businesses, this is not a story about a person making a mistake. It is a reminder to build systems in which a mistake is detected quickly, has limited consequences and can be investigated with confidence. CISA’s account offers seven lessons.
1. Credentials do not belong in source code
Cloud keys, passwords, tokens, certificates and other secrets should not be embedded in code. That applies to private repositories as much as public ones. A private repository reduces visibility. It is not a secrets manager. Private code still gets cloned to unmanaged devices, copied into personal accounts, exposed through account takeover, shared with contractors and swept into backups and exports.
Infrastructure-as-code raises the stakes. Terraform files, deployment scripts, CI/CD configuration and cloud templates describe how an environment is built and which identities can change it. Store credentials alongside that and an attacker gets the key and the map.
A mature workflow keeps secrets in an approved secrets manager and retrieves them only when needed. Production credentials are separated from development credentials, and deployment systems receive narrowly scoped, short-lived access rather than standing administrative keys.
The goal is not to tell developers to be more careful. The secure path has to be the easiest path. If retrieving an approved credential takes a ticket and copying it into a config file takes seconds, convenience wins eventually.
2. Shorten how long any credential stays useful
When an exposed credential is found, the response is revocation or rotation. Deleting it from the repository is not enough. Deleting a public file does not prove nobody copied it. Public repositories are indexed, mirrored, cached and continuously watched by researchers and by attackers. Treat the credential as compromised from the moment it became public.
CISA rotated more than the keys it found in the repository. It rotated credentials across the environments where the individual held administrative access, on the reasonable assumption that other tokens, service accounts, deployment credentials or configuration files might also have been reachable.
The stronger long-term move is to depend less on long-lived credentials at all: federated identity, workload identities, temporary deployment tokens, automatic rotation, credentials that expire without anyone remembering to expire them.
One question tests this: if one of our cloud keys became public today, how long would it stay useful? If the answer is months, or nobody knows, you are carrying avoidable exposure.
3. Development environments need least privilege too
Many organizations guard production closely and treat development and test as lower risk. That distinction is usually wrong. Development environments hold deployment pipelines, infrastructure definitions, application code, customer-like data, signing capability, database snapshots and trusted connections into production. A compromised development identity is a path to critical systems.
Build and automation identities deserve particular attention. A deployment process may need to create a limited set of resources in one environment. It rarely needs unrestricted administrator access across every account.
Every privileged development identity should have a documented purpose, an owner, a limited scope, an expiry or review date and a reliable audit trail. Development, test, build and production should use separate identities wherever practical.
Least privilege does not stop a credential from being exposed. It changes what happens next. A narrowly scoped key affects one development resource. An unrestricted administrative key puts the whole cloud environment in play. That difference decides whether an incident is a brief operational disruption or a material business event.
4. Contractor access is part of the design
CISA’s account highlights a common governance gap: contractors often receive substantial access to code, cloud platforms and development systems without the technical guardrails employees get.
A policy telling contractors not to use personal repositories is necessary and insufficient. External specialists need organization-managed identities, approved source-control accounts, clear device expectations and technical controls that make the permitted path obvious. Contractor access should have a business owner, a documented purpose, a defined scope and a scheduled review or expiry. Where possible, contractors work through organization-controlled GitHub, email, cloud and identity accounts, not personal ones.
Offboarding has to revoke more than interactive login: source-control tokens, cloud keys, CI/CD credentials, VPN, API tokens, service accounts, local repository copies and access to third-party development tools.
This is not about trusting contractors less. External access is a different operational relationship, and the company has to keep control of the identities, repositories and credentials used to do the work.
5. Secrets scanning has to run across the whole lifecycle
CISA reported tightening restrictions on uploads to public repositories and planning better monitoring for exposed secrets.
Combine preventive and detective controls. Prevention reduces the odds that code or credentials leave approved systems. Detection is the net when prevention fails. Scanning should start before code reaches a central repository: local pre-commit checks that warn before a credential is committed, pull-request scanning that blocks a merge, organization-level scanning of repositories and their history, and public-source monitoring for material tied to the company’s domains, projects and developers.
The response process matters as much as the scanner. A high-confidence alert is only worth anything if it reaches someone authorized to revoke the credential immediately. Decide which alerts block automatically, which need human validation and which trigger incident escalation. And test whether your scanner actually recognizes the credential formats you use: cloud keys, private keys, database connection strings, API tokens, internal service credentials.
A green dashboard does not prove there are no secrets. It proves the tool found none under its current configuration.
6. Logging decides whether leadership can understand the impact
CISA could say it found no evidence the credentials were used outside its environments. Reaching that conclusion requires usable logs.
Without them, an organization knows a key was exposed and has no reliable way to tell whether anyone used it. Leadership is left choosing between assuming no harm and treating the event as a potential compromise. Neither is a defensible position.
Cloud audit logs, identity-provider activity, source-control events, CI/CD actions, secrets-manager access, administrative changes and endpoint telemetry need to be retained long enough to support a real investigation, and they need to tie activity to identifiable users and workloads. “An administrator accessed the resource” is far less useful than which identity, from where, by what authentication method, and what changed.
A practical test: pick one privileged cloud credential and try to reconstruct every use of it over the last 30 days. If you cannot, treat that as an incident-readiness gap, not a monitoring enhancement. Logs are not useful because they exist. The team has to be able to retrieve, correlate and interpret them while an incident is unfolding.
7. Write the playbook for this specific scenario
One of CISA’s most candid observations was that it did not have a dedicated GitHub and cloud incident playbook when the incident began. It had broad response capability and still had to build part of the process during the event.
Most businesses are in the same position. The incident-response policy covers malware, ransomware and data breaches and says nothing about a public repository containing a privileged cloud key.
A focused playbook establishes who can take a repository offline, who preserves evidence before anything is deleted, who revokes credentials, and how the team finds the related keys that also need rotating. It names the source-control, cloud, identity, endpoint and deployment logs to review. It also covers the business decisions: were production systems reachable, was customer data at risk, does the cyber insurer need notice, and when do counsel, customers, regulators or law enforcement get involved. It does not need to predict every technical detail. Its job is to remove preventable delay from the first hour.
Then test it. A tabletop can start with exactly this scenario: a researcher emails to say a public GitHub repository contains your infrastructure code and a cloud administrator key. Work through validation, evidence preservation, rotation, revocation, log review, impact assessment and communication. End with assigned improvements, owners and dates, not a note that communication could be better.
Thirty days of work
None of this requires banning cloud development, prohibiting contractors or buying a new platform. A focused month reduces the risk substantially.
Week one. Inventory source-control organizations, personal-account usage, privileged cloud identities, long-lived access keys and every contractor with access to development or deployment systems.
Week two. Enable secrets scanning, review public-repository permissions, centralize production secrets, and revoke anything found in source code or repository history. Removing a secret from the latest version of a file does nothing if it is still valid and sits in an earlier commit.
Week three. Cut excessive administrative permissions and separate development, build, test and production identities. Replace static keys with federated or short-lived credentials wherever the platform supports it.
Week four. Run the tabletop. Confirm the team can remove public access, preserve evidence, revoke credentials, find related access, review logs, assess customer impact and make communication decisions.
The output is a short remediation roadmap: what was fixed, what remains open, who owns each item, and when leadership reviews it.
Resilience, not perfection
CISA’s experience makes a point worth keeping: a publicly exposed credential does not have to become a damaging breach. Fast reporting, usable logs, credential rotation, segmented access and decisive containment limited the outcome. Those capabilities are worth more than a policy that assumes nobody will ever make a mistake.
The goal is not a development environment where mistakes are impossible. It is one where risky actions are hard, exposed secrets are found fast, credentials are worth little, and the organization can find out what happened.
Source: CISA, Lessons from CISA’s Cyber Incident.