Secure development

Hardening GitHub Actions workflows and runner permissions

Release boundary: code, package, server arranged to illustrate hardening github actions workflows and runner permissions.

Hardening GitHub Actions workflows and runner permissions 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 github actions workflows and runner permissions helps establish which security property the feature needs and where that property is actually enforced.

What does this involve?

Authorisation determines which resources and operations an established identity may use. It must be enforced where protected data is read or changed. User interface restrictions, obscure identifiers and documentation can help usability, but they do not replace the service's own permission decision.

Because a CI/CD pipeline usually has access to sensitive credentials and functions/endpoints, it must be treated as a critical asset, potentially even more critical than the source code it processes. Therefore, secure software development best practices must be applied, including (but not limited to): threat modeling, secure code reviews, security validation and penetration testing.

Assume breaches will happen and design for rapid response. Define clear incident response procedures with roles, communication and escalation paths. Continuously improve by actively learning from other incidents through publicly available post-mortems (e.g., Trivy post-mortem, Cline post-mortem).

Why it matters

Consider a realistic failure: an untrusted pull request influences a GitHub Actions job that holds a privileged deployment credential.

A missing check can expose another account's information or let an ordinary user perform a privileged action. The result should be described by the actual records and operations reached, including whether access crosses a customer or organisational boundary.

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.

  • Compare users with different roles and ownership relationships.
  • Exercise read, change, delete and alternate access paths.
  • Test nested resources, background processing and state changes.
  • Confirm rejection as well as the legitimate successful journey.

How to fix it

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

  • Secrets exfiltration. CI/CD pipelines often use long-lived credentials to access external services (e.g., cloud provider credentials or package registry tokens). Such secrets can be exfiltrated (printing to logs, sending to external endpoints or embedding them in artifacts) via remote code execution.
  • Denial-of-wallet attacks. CI/CD pipelines often integrate with paid external services, such as LLMs, for code review. If an attacker can repeatedly trigger pipelines or manipulate inputs to maximize resource consumption, this can lead to uncontrolled spending and financial impact.
  • If available, enable CodeQL actions scanning in your repositories to detect vulnerabilities in GitHub Actions workflows. In addition, use Zizmor for defense in depth. Periodically upgrade these tools, as new releases may contain updated detection rules.
  • Configure these tools to run on every relevant pull request and mark them as required status checks before merging. At a minimum, block merges when high or critical severity issues are detected.
  • Enforce permission checks at each protected operation.
  • Maintain regression cases for unauthorised users and changed permissions.

A successful response alone does not prove unauthorised access. Establish whose resource was affected and what the caller was legitimately entitled to do.

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