Secure development

Replacing long-lived workload secrets with federated identity

Effective policy: settings, server, key arranged to illustrate replacing long-lived workload secrets with federated identity.

Replacing long-lived workload secrets with federated identity connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding long-lived workload secrets with federated identity helps establish which security property the feature needs and where that property is actually enforced.

What does this involve?

Configuration can change an application's security boundary without changing its business code. Effective production values, inherited defaults, exposed services and operational interfaces need to be assessed together rather than as isolated files.

Before production use, test the permitted deployment and verify that unauthorised repositories, branches, and job contexts cannot obtain production credentials. Confirm that the authorised job cannot access resources outside its assigned permissions. Repeat these checks after changes to trust policies, claim formats, or workflow configuration. Use the platform's documented claims, such as the GitHub OIDC reference, to select relevant cases.

Enable cloud audit events for token exchange and role or service account use. Check which identity fields are recorded and correlate them with CI/CD run records; complete workflow attribution is not automatic. For example, Google Cloud requires enabling relevant data access logs and choosing an unambiguous subject mapping. Alert on unexpected identities and changes to federation trust or permissions.

Why it matters

Consider a realistic failure: a workload uses a long-lived secret where the platform can issue a short-lived identity bound to its actual environment.

A permissive setting can expose private information or administrative capabilities through a route the application owner did not expect. The consequence depends on how the service is actually deployed and which identities can reach it.

Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.

How penetration testers check for it

Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.

  • Review effective production settings and inherited defaults.
  • Identify exposed management and diagnostic interfaces.
  • Trace secret and connection configuration to its use.
  • Compare configured policy with observed behaviour.

How to fix it

Use the appropriate maintained mechanisms and verify the result in the actual production configuration.

  • Restrict access to the intended organisation, repository or project, and deployment context. Trusting a shared CI/CD issuer alone can admit other tenants. Prefer immutable, non-reusable organisation and repository identifiers where supported, rather than names that another owner could acquire. Google Cloud documents these tenant restrictions and identifier risks.
  • Allow only the required branches, environments, or workflows. Avoid wildcards that admit every repository or every job context. Verify which claims the cloud provider can actually enforce; a claim's presence in a token does not mean it is available as a policy condition. Follow the provider's integration documentation, such as GitHub's AWS OIDC configuration guidance.
  • Grant only the cloud operations and resources the deployment needs. Use separate identities and trust rules for production and non-production. Keep federation configuration and permission administration outside ordinary deployment roles to prevent a compromised job from widening its own access. See Google Cloud's federation security practices.
  • Enable OIDC token requests only for jobs that need cloud access. In GitHub Actions, set id-token: write at the job level; it permits token requests and does not itself grant cloud permissions. See GitHub's OIDC permission requirements.
  • Protect secrets and remove unnecessary diagnostic exposure.
  • Check configuration drift during deployment and maintenance.

A setting should be interpreted in its environment. A deliberately public resource and an unintended private exposure can look similar until ownership, purpose and reachable operations are established.

Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.

Read about our methodology or contact pentested.com to discuss secure development and code review.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo