{"id":15048239,"url":"https://github.com/github/actions-oidc-gateway-example","last_synced_at":"2025-04-06T02:08:04.317Z","repository":{"id":37545663,"uuid":"444856506","full_name":"github/actions-oidc-gateway-example","owner":"github","description":"Example of using Actions OIDC token to proxy into a private network","archived":false,"fork":false,"pushed_at":"2025-03-25T12:38:28.000Z","size":31,"stargazers_count":92,"open_issues_count":1,"forks_count":20,"subscribers_count":175,"default_branch":"main","last_synced_at":"2025-03-30T01:10:02.254Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-05T15:36:01.000Z","updated_at":"2025-03-27T19:24:35.000Z","dependencies_parsed_at":"2025-02-19T17:11:02.841Z","dependency_job_id":"b3434c6f-c76f-4eba-be83-db45a7dfb78d","html_url":"https://github.com/github/actions-oidc-gateway-example","commit_stats":{"total_commits":27,"total_committers":3,"mean_commits":9.0,"dds":0.07407407407407407,"last_synced_commit":"606c40fdcaae0782ee9cad1382cbf7d1b2e6c11f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Factions-oidc-gateway-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Factions-oidc-gateway-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Factions-oidc-gateway-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Factions-oidc-gateway-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/actions-oidc-gateway-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423513,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T21:09:40.870Z","updated_at":"2025-04-06T02:08:04.299Z","avatar_url":"https://github.com/github.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# actions-oidc-gateway-example\n\n[![Run CI](https://github.com/github/actions-oidc-gateway-example/actions/workflows/ci.yml/badge.svg)](https://github.com/github/actions-oidc-gateway-example/actions/workflows/ci.yml)\n\nHave you ever wanted to connect to a private network from a GitHub-hosted Actions runner?\n\nThis gateway is a reference implementation of how to authorize traffic from Actions into your private network, either as an API gateway or as an HTTP CONNECT proxy tunnel.\n\nIt is *not* intended to be used as-is.\n\nAt a minimum, you'd want to customize the claim check for your use case (see [Configuring the OIDC trust with the cloud](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#configuring-the-oidc-trust-with-the-cloud) for examples as to what's possible here). The default configuration only allows Actions from the repo `octo-org/octo-repo`.\n\nThen, if you're using this as an API gateway, you probably want to customize the existing `/apiExample` handler (unless you **really** need proxied access to the Bing homepage?). You could add additional handlers, and even customize the claim checking per handler if you'd like.\n\nLastly, you are responsible for deploying this gateway in a secure way with access to your private network. There's lots of different options here, but you probably want this gateway to be behind a load balancer that speaks TLS, with scoped network access to the private services it provides access to. That will probably look something like this:\n\n```mermaid\nflowchart LR\n    Runner--\u003e|Actions OIDC Token| LB\n    subgraph GitHub Actions\n    Runner[Runner]\n    end\n    subgraph Private Network\n    LB[Load Balancer]\n    LB--\u003eG1[This Gateway]\n    LB--\u003eG2[This Gateway]\n    G1--\u003ePS[Private Service]\n    end\n```\n\n## How would I use this?\n\nOnce you customize and deploy your gateway, you can configure your Actions workflow to make use of it:\n\n```yaml\n...\n\njobs:\n  your_job_name:\n    ...\n    permissions:\n      id-token: write\n    steps:\n      ...\n\n      - name: Get OIDC token and set OIDC_TOKEN environment variable\n        run: |\n          echo \"OIDC_TOKEN=$(curl -H \"Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN\" -H \"Accept: application/json; api-version=2.0\" \"$ACTIONS_ID_TOKEN_REQUEST_URL\u0026audience=api://ActionsOIDCGateway\" | jq -r \".value\")\"  \u003e\u003e $GITHUB_ENV\n          echo \"::add-mask::$OIDC_TOKEN\"\n\n      - name: Example of using gateway as a proxy\n        run: |\n          curl -v -p --proxy-header \"Gateway-Authorization: ${{ env.OIDC_TOKEN }}\" -x https://your-load-balancer.example.com https://www.google.com\n\n      - name: Example of an API gateway\n        run: |\n          curl -v -H \"Gateway-Authorization: ${{ env.OIDC_TOKEN }}\" https://your-load-balancer.example.com/apiExample\n\n    ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Factions-oidc-gateway-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Factions-oidc-gateway-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Factions-oidc-gateway-example/lists"}