IP Allow Lists and Networking

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 12 read · keep scrolling

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

Manage GitHub Actions for Enterprise: IP Allow Lists and Networking

Introduction: The Security Perimeter of Automation

In the modern enterprise, GitHub Actions has become the backbone of CI/CD pipelines. As organizations scale their automation, the number of workflows, secrets, and deployment environments grows exponentially. While GitHub Actions offers immense flexibility, this capability introduces a significant attack surface if left unmanaged. One of the most critical components of securing an enterprise-grade GitHub environment is controlling network access.

When you use GitHub-hosted runners, your automation jobs execute on infrastructure managed by GitHub, which resides outside your corporate firewall. Conversely, self-hosted runners operate within your own infrastructure, potentially exposing internal services to the public internet if not configured correctly. Managing IP allow lists and network configurations is not merely a "nice-to-have" security feature; it is a fundamental requirement for compliance, data sovereignty, and preventing unauthorized access to your internal resources.

This lesson explores how to manage GitHub Actions at scale by implementing IP allow lists, configuring self-hosted runner networking, and architecting a secure perimeter for your automation. We will look at how to bridge the gap between cloud-based runners and private network resources, ensuring that your CI/CD processes remain both efficient and secure.


Not read yet

Understanding the Network Architecture of GitHub Actions

To manage networking effectively, you must first understand the two primary runner models and how they interact with the network. GitHub-hosted runners are ephemeral virtual machines managed by GitHub. Every time a job runs, a fresh environment is provisioned. These runners have dynamic IP addresses, which makes traditional firewall rule-based access control difficult.

Self-hosted runners, on the other hand, are machines you manage. You install the runner application on your own servers, virtual machines, or container clusters. Because these runners sit within your own network, they can access internal resources like databases, internal APIs, and private package registries without needing to expose those resources to the public internet.

The Challenge of Dynamic IPs

When using GitHub-hosted runners, your jobs connect to your internal systems from a pool of IP addresses maintained by GitHub. If you restrict access to your internal environment to only specific IP addresses, you must account for the fact that GitHub's IP ranges change periodically. GitHub provides a public API to retrieve these IP ranges, but manually updating firewall rules is error-prone and inefficient.

The Role of IP Allow Lists

IP allow lists are a security control that limits access to your GitHub organization’s resources to only those requests originating from trusted IP addresses. By enabling an IP allow list, you ensure that even if an attacker gains access to a user’s credentials or a repository secret, they cannot interact with your organization's data unless they are connecting from a known, approved location—such as your corporate office or a specific VPN gateway.

Callout: IP Allow Lists vs. Network Policies It is important to distinguish between IP allow lists and internal network policies. An IP allow list is an inbound control: it dictates who can talk to GitHub. Network policies for self-hosted runners are outbound controls: they dictate what your runners can talk to once they are running. Both are essential for a complete security posture.


Not read yet

Implementing IP Allow Lists for GitHub Organizations

For enterprises, the IP allow list is your primary defense against unauthorized access. When you enable this feature, any request to your organization's resources that does not originate from an authorized IP address will be blocked, regardless of whether the user has valid authentication credentials.

Step-by-Step: Configuring IP Allow Lists

  1. Navigate to Organization Settings: Log in as an organization owner and go to the "Settings" tab of your enterprise organization.
  2. Access Security Settings: In the left sidebar, select "Security" and then "Allowed IP addresses."
  3. Define Authorized Ranges: Input the CIDR blocks for your corporate offices, VPN gateways, or specific cloud VPCs that your developers use.
  4. Enable the Policy: Toggle the "Enable IP allow list configuration" switch.
  5. Testing and Verification: Before finalizing, ensure that at least one of your current IP addresses is in the allow list; otherwise, you will immediately lock yourself out of your own organization.

Warning: The Lockout Risk Enabling IP allow lists without thorough preparation is a common cause of administrative lockouts. Always ensure that your current IP address is included in the list, and have a "break-glass" procedure or a secondary administrator with a different network path ready to revert the changes if something goes wrong.

Managing Dynamic Ranges

GitHub publishes its IP ranges via a public API. If you need to allow GitHub-hosted runners to access internal resources, you must periodically refresh your firewall rules to match the current ranges. Automating this process is a best practice. You can write a script that queries the GitHub API, compares the current ranges with your existing firewall rules, and updates them accordingly.

# Example: Fetching GitHub IP ranges for Actions
curl -s https://api.github.com/meta | jq '.actions'

This command returns a list of IP ranges that GitHub-hosted runners use. You can integrate this into your CI/CD pipeline or a scheduled cron job to ensure your firewall rules stay synchronized with GitHub’s infrastructure updates.


Not read yet

Networking for Self-Hosted Runners at Scale

When your organization requires access to private resources that cannot be exposed to the internet, self-hosted runners are the preferred solution. However, self-hosted runners introduce their own set of networking complexities. You must ensure that the runner can communicate with GitHub to receive jobs, while simultaneously ensuring that the runner does not become a pivot point for an attacker to enter your private network.

Runner Communication Patterns

Self-hosted runners use a "pull" model. They initiate an outbound connection to GitHub over HTTPS (port 443) to poll for new jobs. They do not require inbound connections from GitHub. This is a significant security advantage, as it means you do not need to open any inbound ports on your corporate firewall.

Securing the Runner Environment

To manage runners at scale, you should treat them as cattle, not pets. Use infrastructure-as-code (IaC) tools like Terraform or Pulumi to provision your runner instances. This ensures that every runner is configured identically and that networking rules are consistently applied.

Network Isolation Best Practices

  • Segmented Subnets: Place your self-hosted runners in a dedicated, isolated subnet. This subnet should have no direct path to your sensitive production databases or customer data stores unless explicitly required.
  • Egress Filtering: Use an egress proxy or a firewall to restrict where the runner can send data. A runner should only be able to communicate with the GitHub API, your internal package registries, and specific deployment targets.
  • DNS Resolution: Ensure that your runners are using a secure, authorized DNS server to prevent DNS hijacking or man-in-the-middle attacks.

Note: Using Proxies If your runners operate in a strictly locked-down network, you may need to configure them to use an outbound proxy. You can set the https_proxy environment variable in the runner's configuration, allowing it to reach GitHub through your enterprise proxy server.


Not read yet

Advanced Networking: Private Networking with GitHub Enterprise

For the highest level of security, GitHub Enterprise customers can leverage Private Networking. This feature allows GitHub-hosted runners to communicate with your internal resources without traversing the public internet.

How Private Networking Works

Private networking establishes a secure tunnel between GitHub’s infrastructure and your private network (such as an AWS VPC or an Azure VNet). When a job requires access to an internal resource, the traffic is routed through this private path, keeping the data isolated from the public web.

Implementing Private Connections

To implement private connections, you typically work with your cloud provider's networking components, such as AWS PrivateLink or Azure Private Link. You configure a service endpoint in your VPC that GitHub can connect to.

  1. Set up the Private Link: Create the necessary endpoint service in your cloud environment.
  2. Configure GitHub Enterprise: Provide the necessary connection details to your GitHub Enterprise support representative or through the enterprise settings console.
  3. Update Security Groups: Modify your security groups and network ACLs to allow traffic originating from the specific private IP ranges assigned to the GitHub tunnel.

This approach eliminates the need to maintain IP allow lists for GitHub-hosted runners, as the traffic is inherently trusted within your private network architecture.


Not read yet

Common Pitfalls and How to Avoid Them

Managing networking at scale is difficult, and even experienced teams encounter common issues. Awareness of these pitfalls is the first step toward building a robust system.

1. Over-Permissive Firewall Rules

A common mistake is allowing the entire self-hosted runner subnet full access to the internal network. Even if your runners are "trusted," they are running third-party code from your repository. If a malicious actor compromises a dependency in your workflow, they could use the runner as a launchpad to scan your internal network.

  • The Fix: Implement "Least Privilege" networking. Use security groups or host-based firewalls to restrict the runner to only the specific ports and IP addresses it needs to perform its job.

2. Ignoring Egress Traffic

Many organizations focus heavily on inbound traffic but leave egress traffic wide open. A compromised runner might attempt to exfiltrate data to an external command-and-control server.

  • The Fix: Implement strict egress filtering. Only allow traffic to known, approved endpoints. Monitor for anomalous outbound traffic patterns from your runner subnets.

3. Hardcoding IP Addresses

Hardcoding IP addresses in your configuration files or firewall rules is a recipe for failure. As your infrastructure grows, these hardcoded values will become outdated and difficult to track.

  • The Fix: Use dynamic references. Use your cloud provider’s service tags or tags assigned to your runner instances to manage firewall rules, rather than raw IP addresses.

4. Lack of Monitoring and Logging

Without visibility, you cannot manage security. If you don't log the network activity of your runners, you will have no way of knowing if they are being misused.

  • The Fix: Enable VPC flow logs or similar network logging capabilities. Centralize these logs in a SIEM (Security Information and Event Management) system to detect suspicious patterns.

Not read yet

Comparison of Runner Networking Options

Feature GitHub-Hosted Runners Self-Hosted Runners
Network Location Managed by GitHub Within your VPC/Network
Inbound Access Not required Not required
Outbound Access To GitHub (Public) To GitHub (Public/Proxy)
Internal Access Requires Private Link Native access
Maintenance None (Managed by GitHub) Full (OS, patches, network)

Best Practices for Scaling Network Security

When scaling GitHub Actions across an entire enterprise, consistency is the key to security. You cannot manage individual runners by hand. Instead, you must build a platform-level approach to networking.

Use Infrastructure as Code (IaC)

Every network configuration related to your runners should be defined in Terraform or a similar tool. This allows you to peer-review changes to firewall rules, maintain a history of changes, and quickly roll back if a configuration change breaks your CI/CD pipelines.

Implement Automated Testing for Network Rules

Just as you test your application code, you should test your infrastructure. Use tools like terratest to verify that your runner subnets have the correct network policies applied. Before deploying a change to your firewall rules, run a suite of tests to ensure that the runner can still reach the necessary internal APIs while remaining blocked from sensitive zones.

Centralize Runner Management

Avoid letting individual teams manage their own runner networking. Instead, create a "Platform Engineering" or "DevOps" team that provides standardized, pre-configured runner templates. These templates should include:

  • Pre-configured security groups.
  • Standardized logging and monitoring agents.
  • Hardened base images (e.g., using CIS benchmarks).
  • Automated updates for the runner software.

Adopt a "Zero Trust" Mindset

Even if your runners are inside your network, treat them as if they are public. Do not rely on network location as a primary security control. Use identity-based access (like GitHub OIDC) to authenticate your runners to internal services, rather than relying on IP-based trust. This ensures that even if an attacker compromises the network, they still need valid, short-lived credentials to access your internal resources.


Not read yet

Deep Dive: Using OIDC for Secure Authentication

One of the most effective ways to reduce the burden on your network security is to stop relying on long-lived secrets and IP-based trust. OpenID Connect (OIDC) allows your GitHub Actions workflows to request short-lived, scoped access tokens directly from your cloud provider (like AWS, Azure, or GCP).

Why OIDC Matters for Networking

When you use OIDC, you don't need to store sensitive credentials in GitHub secrets. The runner proves its identity to the cloud provider, which then grants temporary access to specific resources. This means the runner doesn't need to be "trusted" based on its IP address; it is trusted based on its cryptographic identity.

Implementation Example

To use OIDC with AWS, you configure an OIDC provider in your AWS account that trusts GitHub's OIDC endpoint. In your workflow, you then request a token:

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      id-token: write # Required to request the OIDC token
      contents: read
    steps:
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123456789012:role/my-github-role
          aws-region: us-east-1

By using this pattern, you significantly reduce the risk associated with network exposure. Even if an attacker finds a way to reach your internal network from a runner, they would still need to compromise the OIDC identity, which is much harder than simply spoofing an IP address.


Not read yet

Managing Networking for Hybrid Environments

Many enterprises operate in hybrid environments, with some resources on-premises and others in the cloud. This adds a layer of complexity to runner networking.

The Hybrid Connectivity Challenge

If your runners are in the cloud but need to access on-premises data, you need a site-to-site VPN or a dedicated connection (like AWS Direct Connect or Azure ExpressRoute). You must ensure that your runner subnet can route traffic to your on-premises data center through these tunnels.

Routing and Latency

When routing traffic through a hybrid connection, latency can become an issue. CI/CD pipelines are sensitive to latency; if your runner has to traverse a long network path to fetch dependencies, your build times will increase.

  • Best Practice: Place your runners as close to the data as possible. If a team is primarily working on internal services located in the London data center, their runners should be deployed in a London-based cloud region or on-premises near that data center.

DNS in Hybrid Environments

One of the most common issues in hybrid networking is DNS resolution. Your cloud-based runner might not be able to resolve your internal on-premises hostnames. Ensure that your DNS forwarders are correctly configured to bridge the gap between your cloud VPC and your on-premises DNS infrastructure.


Not read yet

Monitoring and Auditing: Your Safety Net

Even with the best configuration, you must have a way to audit your networking. Security is not a static state; it is a continuous process of verification.

Audit Logs

GitHub provides audit logs that track configuration changes to your organization, including changes to IP allow lists. You should export these logs to a central logging system (like Splunk, ELK, or a cloud-native logger) and set up alerts for any modifications to security settings.

Network Flow Analysis

If you are using self-hosted runners, you should monitor the network flow logs of the subnets where those runners reside. Look for:

  • Unexpected Outbound Traffic: If a runner is suddenly talking to a foreign IP address, it may be compromised.
  • Port Scanning: If a runner is attempting to connect to multiple internal ports in a short period, it may be performing reconnaissance.
  • High Data Egress: If a runner is sending large amounts of data to an external location, it could be an indicator of data exfiltration.

Regular Security Reviews

Schedule regular reviews of your network topology. As your infrastructure changes, your security assumptions may become obsolete. Every quarter, review your IP allow lists, your runner security groups, and your OIDC configurations to ensure they still align with your security requirements.


Not read yet

Quick Reference: Checklist for Enterprise Network Security

Before you finish this module, ensure you have addressed the following items in your enterprise environment:

  • IP Allow Lists: Enabled and restricted to known corporate ranges.
  • Break-Glass Access: A secondary admin account with a valid network path is prepared.
  • Self-Hosted Runner Isolation: Runners are placed in a dedicated, isolated subnet.
  • Egress Filtering: Egress traffic is restricted to known, necessary endpoints.
  • OIDC Adoption: Long-lived secrets have been replaced with OIDC tokens where possible.
  • Infrastructure as Code: All network configurations are managed via version-controlled templates.
  • Monitoring: Network flow logs are enabled and being monitored for anomalous behavior.

Common Questions (FAQ)

Q: Can I use both GitHub-hosted and self-hosted runners?

A: Yes, many enterprises use a hybrid approach. They use GitHub-hosted runners for standard, low-sensitivity workflows and self-hosted runners for workflows that require access to internal networks or specialized hardware.

Q: How often should I rotate my IP allow list?

A: You should only update it when your network infrastructure changes (e.g., adding a new office location or a new VPN gateway). If you are using GitHub-hosted runners, you should automate the synchronization of GitHub's published IP ranges.

Q: Are self-hosted runners inherently more secure than GitHub-hosted runners?

A: Not necessarily. While they offer more control over the network, they also shift the responsibility of patching and hardening the underlying OS to you. If you fail to patch your self-hosted runners, they become a significant security risk.

Q: What is the most common cause of network-related build failures?

A: DNS resolution issues and firewall misconfigurations are the most frequent culprits. When a runner cannot reach a resource, always check if it can resolve the hostname and if the firewall allows the specific port/protocol combination.


Not read yet

Conclusion: Key Takeaways

Managing GitHub Actions networking at scale is a critical responsibility for any enterprise. By implementing the right controls, you can enable your developers to move quickly while keeping your internal resources safe.

  1. Defense-in-Depth: Never rely on a single security control. Combine IP allow lists, network segmentation, and identity-based access (OIDC) for a robust perimeter.
  2. Automate Everything: Manual network management is a recipe for error. Use Infrastructure as Code to define and manage your runner networking, ensuring consistency across your organization.
  3. Minimize Access: Apply the principle of least privilege to your runner network policies. If a runner doesn't need access to a specific internal database, block that traffic.
  4. Visibility is Mandatory: You cannot secure what you cannot see. Enable logging for all network activity related to your CI/CD pipelines and integrate those logs into your central security monitoring.
  5. Prepare for Failure: Always have a "break-glass" plan for when your security configurations prevent legitimate work. Test your recovery processes regularly.
  6. Embrace Identity over Location: Shift away from trusting IP addresses toward trusting identities. Using OIDC is the single most effective way to reduce the complexity and risk of your network security architecture.
  7. Continuous Improvement: Treat your network security as a living system. Review your policies, monitor for threats, and update your configurations as your enterprise grows and evolves.

By following these practices, you will transform your CI/CD infrastructure from a potential vulnerability into a secure, scalable, and efficient foundation for your enterprise's software development lifecycle. Remember that security is not a destination but a continuous commitment to vigilance and improvement.

Not read yet

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