IP Allow Lists Configuration

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 10 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Managing GitHub Actions: IP Allow Lists Configuration

Introduction: Why Securing Your CI/CD Pipeline Matters

In modern software development, the Continuous Integration and Continuous Deployment (CI/CD) pipeline is the heartbeat of your engineering organization. It is the automated engine that builds, tests, and deploys your code into production environments. Because this pipeline possesses high-level access to your source code, your secrets, and your cloud infrastructure, it becomes a primary target for malicious actors. If a bad actor gains control over your runner environment, they could theoretically inject malicious code, exfiltrate environment variables, or pivot into your internal network.

GitHub Actions is an incredibly powerful tool, but its flexibility can introduce security risks if not managed correctly. One of the most effective ways to secure your organization’s runner environment is by implementing IP Allow Lists. An IP Allow List acts as a digital gatekeeper, ensuring that only trusted network traffic can communicate with your GitHub environment or that your runners only interact with specific, pre-authorized endpoints. By restricting network access based on source IP addresses, you significantly reduce the attack surface of your CI/CD infrastructure.

This lesson explores the intricacies of configuring IP Allow Lists for GitHub Actions. We will cover the conceptual underpinnings, the practical implementation steps for both GitHub-hosted and self-hosted runners, and the architectural best practices required to keep your pipeline secure without hindering developer productivity. Whether you are managing a small startup team or a large enterprise, understanding how to control network traffic flow is a critical skill for any DevOps engineer or security practitioner.


Not read yet

Understanding the Concept of IP Allow Lists

At its core, an IP Allow List is a security policy that defines a set of IP addresses or CIDR (Classless Inter-Domain Routing) blocks that are permitted to access a specific resource. In the context of GitHub, this usually manifests in two primary scenarios. First, you may want to restrict access to your GitHub organization so that only users or services coming from your corporate network can perform sensitive actions. Second, and more importantly for this lesson, you may want to restrict the network access of your self-hosted runners to ensure they only communicate with necessary endpoints, or ensure that your internal services only accept requests from your authorized runner IP addresses.

When you use GitHub-hosted runners, the IP addresses are dynamic and managed by GitHub. This creates a challenge: how do you allow access to your internal databases or firewalled servers if the runner IP changes every time a job runs? This is where IP Allow Lists on the GitHub side, combined with specific network configurations on your infrastructure side, become essential. By understanding how to manage these lists, you gain control over the perimeter of your deployment environment.

The Two Sides of the Security Perimeter

It is helpful to view this security model from two distinct perspectives:

  1. Inbound Restrictions: Limiting which IP addresses can access your GitHub organization’s resources (e.g., preventing a developer from pushing code from an unapproved coffee shop Wi-Fi).
  2. Outbound Restrictions: Ensuring your CI/CD runners only communicate with approved external services, preventing data exfiltration or connections to command-and-control servers during a compromise.

Callout: Inbound vs. Outbound Security Understanding the difference between inbound and outbound security is vital. Inbound rules protect your organization from unauthorized access by outside entities. Outbound rules (often managed via egress proxies or firewall rules on your runner host) protect your organization from internal threats or compromised workflows attempting to communicate with malicious external hosts.


Not read yet

Configuring IP Allow Lists for GitHub Organizations

If you are a GitHub Enterprise Cloud or GitHub Team customer, you have access to organization-level IP allow list settings. This feature allows you to restrict access to your organization’s resources—including the ability to trigger actions—to a specific set of IP addresses.

Step-by-Step Configuration

  1. Access Organization Settings: Navigate to your GitHub organization, click on "Settings" in the top menu, and then select "Security" from the left-hand sidebar.
  2. Locate IP Allow List: Under the "Security" section, you will find "IP allow list." Click on this to expand the configuration panel.
  3. Enable the Feature: Check the box that says "Enable IP allow list."
  4. Add IP Ranges: Click "Add" to input your trusted CIDR blocks. You can add your office VPN range, your data center range, or specific static IPs used by your corporate egress points.
  5. Set Exceptions (Optional): You can configure specific settings for integration apps, but generally, you want to keep the list as restrictive as possible.

Note: Be extremely careful when enabling this feature. If you do not include your own current IP address in the list, you will immediately lock yourself out of your organization’s administrative settings. Always verify your current public IP before saving the configuration.

Best Practices for Organization-Level Lists

  • Use CIDR Notation: Always define ranges using CIDR notation (e.g., 192.168.1.0/24) rather than single IPs to account for DHCP fluctuations in corporate networks.
  • Regular Audits: Conduct quarterly reviews of your IP allow list. Remove ranges that are no longer in use, such as old office locations or decommissioned VPN concentrators.
  • Monitoring: Use GitHub Audit Logs to track any denied access attempts. This can help you identify if a legitimate service or developer is being blocked by a new policy change.

Not read yet

Managing Network Access for Self-Hosted Runners

Self-hosted runners offer more flexibility than GitHub-hosted runners because they run on your own infrastructure (virtual machines, Kubernetes clusters, or physical servers). This means you have full control over the network environment, allowing for more granular IP management.

Why Self-Hosted Runners Need Network Restrictions

When you deploy a self-hosted runner, it establishes an outbound connection to GitHub to listen for new jobs. Once it receives a job, it executes the code provided in the workflow. If that code is malicious, it might try to connect to an external server to download a payload or upload stolen secrets. By placing your self-hosted runner in a restricted subnet with a strict egress firewall, you can prevent these unauthorized connections.

Implementing Egress Filtering

The most effective way to manage network access for self-hosted runners is to use a combination of cloud-native security groups and egress proxies.

Using Cloud Security Groups (AWS/Azure/GCP)

If your runners are on AWS EC2 instances, you should attach a Security Group that explicitly defines permitted traffic.

  • Inbound: Strictly deny all inbound traffic. The runner only needs to initiate outbound connections to GitHub.
  • Outbound: Limit traffic to the specific endpoints required by your workflow. For example, if your workflow only deploys to an S3 bucket, restrict outbound traffic to the S3 API endpoint and GitHub’s domain.

Using Egress Proxies

For more advanced setups, route all runner traffic through an egress proxy server (like Squid or a dedicated enterprise proxy). The proxy can inspect the traffic and enforce domain-based filtering.

# Example: Configuring a proxy for a self-hosted runner
# Create a .env file in the runner directory
export HTTP_PROXY=http://proxy.yourcompany.com:8080
export HTTPS_PROXY=http://proxy.yourcompany.com:8080
export NO_PROXY=localhost,127.0.0.1,github.com

Tip: Always configure the NO_PROXY environment variable correctly. If you fail to exclude internal services or the GitHub API from the proxy, your runner may fail to connect to the orchestrator, causing your workflow to hang indefinitely.


Not read yet

Addressing the Challenge of Dynamic IPs with GitHub-Hosted Runners

A common pain point for teams using GitHub-hosted runners is that their internal services (like a database or a staging API) are protected by a firewall that only allows specific IPs. GitHub-hosted runners have dynamic IPs that change frequently, making it impossible to add them to a traditional static allow list.

Strategy 1: Using a Static Outbound Proxy

Instead of trying to whitelist the entire pool of GitHub-hosted runner IPs, you can route your runner’s requests through a static proxy server that has a fixed IP address. You would then add that single static IP to your internal firewall’s allow list.

Strategy 2: Using Service Principals and Managed Identities

Rather than relying on IP-based authentication, shift your security model toward identity-based authentication. Use OpenID Connect (OIDC) to allow your GitHub Actions workflows to authenticate with your cloud provider (e.g., AWS, Azure, GCP) without needing long-lived credentials or fixed IP addresses.

Example: OIDC with AWS

Instead of storing AWS_ACCESS_KEY_ID as a secret, configure a trust relationship between your GitHub repository and an AWS IAM role.

# Workflow snippet for OIDC authentication
permissions:
  id-token: write
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          role-to-assume: arn:aws:iam::123456789012:role/my-github-role
          aws-region: us-east-1

By using OIDC, you eliminate the need to maintain complex IP allow lists for your cloud infrastructure, as the authentication is based on the identity of the workflow rather than the IP address of the runner.


Not read yet

Common Pitfalls and How to Avoid Them

Even with the best intentions, managing IP allow lists can go wrong. Here are some of the most frequent mistakes teams make and how to prevent them.

1. The "Lock-Out" Scenario

As mentioned earlier, failing to include your own current IP address when setting up organization-level allow lists is a classic mistake.

  • Prevention: Always keep a "break-glass" account or a secondary administrative path that is not subject to the IP allow list, or ensure you are testing the configuration from a network that is definitely included in the new range.

2. Over-Permissive Rules

Teams often set rules like 0.0.0.0/0 (allowing all traffic) because they are struggling with connectivity issues. This effectively renders the security policy useless.

  • Prevention: Start with a "Deny All" stance and add specific, required endpoints one by one. Use tools to monitor denied packets to identify exactly what is being blocked before opening up the firewall.

3. Ignoring DNS Resolution

Many firewalls allow you to whitelist domains, but if your runner needs to reach an API, it needs to resolve the IP address first. If your runner cannot reach a DNS server, it will fail to connect even if the IP is allowed.

  • Prevention: Ensure your runner environment has access to a trusted DNS resolver, especially if you are using strict network egress controls.

4. Hardcoding IPs in Scripts

Developers might hardcode IP addresses into their workflow scripts to bypass connectivity issues. This creates a maintenance nightmare when those IPs change.

  • Prevention: Use environment variables or secret management systems to store network configuration data, ensuring that changes can be made globally without modifying individual workflow files.

Not read yet

Comparison Table: Security Strategies

Strategy Security Level Maintenance Effort Best For
IP Allow Lists (Org) Moderate Low Restricting access to internal tools.
Egress Proxies High High Complex enterprise environments.
OIDC / Identity Very High Low Cloud-native deployments (AWS/Azure).
VPN Tunnels High Moderate Connecting runners to private data centers.

Callout: Why Identity Trumps IP In modern architecture, IP addresses are ephemeral and easily spoofed. Identity-based security, such as OIDC or mTLS (mutual TLS), provides a much stronger guarantee of who (or what) is accessing a resource. Whenever possible, prioritize identity-based controls over network-based allow lists.


Best Practices for Enterprise Environments

If you are managing GitHub Actions at scale, you need a strategy that balances security with the need for speed. Here are the industry-recommended best practices:

  1. Implement Infrastructure as Code (IaC): Use Terraform or Pulumi to manage your network security groups and IP allow lists. This ensures that your security configuration is version-controlled, auditable, and repeatable.
  2. Standardize Runner Images: Use custom runner images that have pre-configured network settings, proxy configurations, and security agents. This prevents "configuration drift" where one runner is secure and another is not.
  3. Use GitHub Actions Runners on Private Networks: If possible, place your self-hosted runners within a private VPC that has no direct internet access. Use a NAT Gateway or an egress proxy to control exactly which external services the runners can reach.
  4. Audit and Alert: Configure alerts for any unauthorized network connection attempts from your runner subnets. This is often the first sign of a compromised runner attempting to exfiltrate data.
  5. Least Privilege for Runners: Ensure that the service account or IAM role assigned to your runner has the absolute minimum permissions required to perform its tasks. Even if a runner is compromised, the blast radius is limited.

Not read yet

Step-by-Step: Setting Up a Secure Self-Hosted Runner Environment

If you need to secure a runner that handles sensitive data, follow these steps to build a hardened environment:

Phase 1: Network Isolation

  • Create a dedicated Subnet for your runners.
  • Configure a Network ACL (NACL) to deny all inbound traffic.
  • Configure an Egress Security Group to only allow outbound traffic to github.com and your internal artifact repository.

Phase 2: Compute Hardening

  • Use a minimal base OS (e.g., Alpine Linux or a hardened Ubuntu image).
  • Remove unnecessary packages (compilers, network scanners, etc.) that aren't required for your build process.
  • Enable disk encryption for the runner’s storage.

Phase 3: Identity Configuration

  • Instead of storing AWS keys, use an IAM Role associated with the runner’s instance profile.
  • Use the aws-actions/configure-aws-credentials action to inherit the identity of the host machine rather than using long-lived secrets.

Phase 4: Monitoring

  • Ship logs from the runner host to a centralized logging system (like Splunk or ELK).
  • Monitor for any connections to suspicious IP addresses or unexpected DNS queries.

Not read yet

Common Questions (FAQ)

Q: Can I use IP allow lists with GitHub Free plan? A: No, organization-level IP allow lists are a feature reserved for GitHub Enterprise Cloud and GitHub Team customers.

Q: Does enabling IP allow lists affect GitHub Desktop or the command line? A: Yes, it affects all traffic to your organization's resources. If you are working from a location not on the allow list, you will be unable to pull, push, or interact with your repositories.

Q: What happens if my runner’s IP changes? A: If you are using self-hosted runners, you should assign them static private IPs within your VPC. If you are using GitHub-hosted runners, you cannot control the IP, so you should rely on identity-based authentication (OIDC) rather than IP allow lists.

Q: How do I test my IP allow list configuration? A: Use a secondary, non-restricted network (like a mobile hotspot) to attempt to access your organization's settings after you have configured the allow list. If you are blocked, you know the list is working, and you can adjust it before locking out your primary network.


Not read yet

Key Takeaways

As we conclude this lesson, keep these fundamental principles in mind for managing your GitHub Actions environment:

  • Security is Layered: IP allow lists are only one part of a defense-in-depth strategy. Combine them with identity-based access (OIDC), strict IAM policies, and continuous monitoring.
  • Prioritize Identity over IPs: Whenever the technology stack supports it, use OIDC or service principals. This removes the fragility associated with managing dynamic IP addresses.
  • Automate Your Infrastructure: Use Infrastructure as Code to manage your security groups and allow lists. Manual configuration is prone to human error and difficult to audit.
  • Test Before You Enforce: Always verify your network configurations from a safe, redundant connection before applying restrictive policies that could lock out your entire team.
  • Monitor Egress Traffic: Most breaches involve outbound communication to a malicious server. Controlling and monitoring your egress traffic is just as important as blocking inbound threats.
  • Maintain Least Privilege: Every runner should have only the permissions and network access required for its specific task. Do not grant broad, organization-wide network access to a runner that only builds one microservice.
  • Regular Reviews: Security is not a "set it and forget it" task. Schedule recurring audits of your IP allow lists and firewall rules to ensure they remain aligned with your current network architecture.

By methodically applying these practices, you can create a secure, stable, and efficient CI/CD pipeline that protects your organization’s most valuable assets while empowering your developers to ship code with confidence. Managing runners is a fundamental operational task that requires both technical precision and a security-first mindset. Keep these lessons in mind as you scale your infrastructure, and always look for ways to transition from brittle network-based security to robust identity-based controls.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.