-
Branch mapping
Branch mapping restricts which branches are allowed to deploy to a given environment. For instance, configure your
productionenvironment to accept deployments only frommainor branches matching a release pattern. If someone triggers a production deployment from a personal feature branch, GitHub prevents the job from progressing to the environment approval step. -
Manual approvals
Add a human approval gate by requiring reviewers for an environment. When a job targets the
productionenvironment, GitHub pauses the workflow and notifies the configured reviewers. The deployment cannot continue until a reviewer clicks Approve, creating an auditable change-control record tied to that deployment.

- Environment secrets Store production credentials (for example, database passwords or API keys) as secrets scoped specifically to an environment. Environment-scoped secrets are only accessible when the workflow run reaches that environment — and because access requires both the branch to be allowed and any required approvals to be granted, those secrets are protected by both technical and human controls. This prevents a developer from exposing production secrets from a feature branch.

When using OIDC, ensure your cloud trust policy restricts accepted claims (repository, ref, environment, etc.) to follow the principle of least privilege. Misconfigured trust policies can accidentally widen access.

Exam-focused summary
- Environments map deployments to specific branches and prevent unapproved branches from reaching sensitive gates.
- Environment-scoped secrets are only accessible after branch restrictions and manual approvals are satisfied.
- OIDC replaces static cloud keys by exchanging a signed JWT for temporary credentials when claims match the cloud provider’s trust policy.

- Security hardening with OpenID Connect (GitHub Docs)
- Introduction to JSON Web Tokens (JWT)
- AWS Identity and Access Management (IAM)
Remember: combine branch restrictions, required reviewers, and environment-scoped secrets to build an auditable, secure deployment workflow. For cloud providers, prefer OIDC-based short-lived credentials over static keys.