Skip to content

Action should respect no_proxy/NO_PROXY environment variable #812

Description

@sbroetz

Describe the bug
If the environment variable http_proxy or HTTP_PROXY is set, the specified proxy is used even if the target host is set in a no_proxy or NO_PROXY environment variable.

To Reproduce
Steps to reproduce the behavior:

  1. Use the following GitHub workflow:
name: 'My Workflow'
on:
  push:
    branches:
      - main
jobs:
  my_build:
    name: 'My Build'
    steps:
      - name: 'Make Runner Environment Available to Job Steps'
        run: |
          echo "http_proxy=http://proxy.example.com:3128/" >> $GITHUB_ENV
          echo "https_proxy=http://proxy.example.com:3128/" >> $GITHUB_ENV
          echo "no_proxy=localhost,ecr.aws" >> $GITHUB_ENV
          echo "HTTP_PROXY=http://proxy.example.com:3128/" >> $GITHUB_ENV
          echo "HTTPS_PROXY=http://proxy.example.com:3128/" >> $GITHUB_ENV
          echo "NO_PROXY=localhost,ecr.aws" >> $GITHUB_ENV
      - name: 'Prepare Docker Image'
        run: |
          # build steps which require a working proxy configuration
      - name: 'Login to ECR'
        uses: aws-actions/amazon-ecr-login@v2
  1. Ensure that the proxy blocks requests to ecr.aws (because you wouldn't want to transmit the image through the internet, if the action runner and the proxy are already sitting in AWS)

Expected behavior
The ECR login is successful, the proxy is not contacted because of the no_proxy entry.

Observed behaviour
The ECR login fails due to a "403 Forbidden" response sent by the proxy. The ECR login request can be observed in the proxy logs

Additional information
The bug can be worked around by nuking the proxy configuration before the 'Login to ECR' step.

Environment

  • Enterprise account on github.com
  • GitHub Action runner in AWS CodeBuild without direct access to the internet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions