No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] 49d42c28f5
Bump github.com/golang-jwt/jwt/v4 (#16)
Bumps the go_modules group with 1 update in the / directory: [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt).


Updates `github.com/golang-jwt/jwt/v4` from 4.5.1 to 4.5.2
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: direct:production
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-25 08:38:20 -04:00
.github Remove unneeded Actions workflow (#15) 2025-02-21 12:14:18 -05:00
go.mod Bump github.com/golang-jwt/jwt/v4 (#16) 2025-03-25 08:38:20 -04:00
go.sum Bump github.com/golang-jwt/jwt/v4 (#16) 2025-03-25 08:38:20 -04:00
LICENSE Add MIT license 2022-04-06 13:28:26 -04:00
oidc_gateway.go Update golang-jwt/jwt (v3) to golang-jwt/jwt/v4 2023-08-25 09:43:17 -04:00
oidc_gateway_test.go Update golang-jwt/jwt (v3) to golang-jwt/jwt/v4 2023-08-25 09:43:17 -04:00
README.md Fix minor typos in readme (#9) 2025-01-13 09:32:20 -05:00

actions-oidc-gateway-example

Run CI

Have you ever wanted to connect to a private network from a GitHub-hosted Actions runner?

This 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.

It is not intended to be used as-is.

At a minimum, you'd want to customize the claim check for your use case (see 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.

Then, 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.

Lastly, 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:

flowchart LR
    Runner-->|Actions OIDC Token| LB
    subgraph GitHub Actions
    Runner[Runner]
    end
    subgraph Private Network
    LB[Load Balancer]
    LB-->G1[This Gateway]
    LB-->G2[This Gateway]
    G1-->PS[Private Service]
    end

How would I use this?

Once you customize and deploy your gateway, you can configure your Actions workflow to make use of it:

...

jobs:
  your_job_name:
    ...
    permissions:
      id-token: write
    steps:
      ...

      - name: Get OIDC token and set OIDC_TOKEN environment variable
        run: |
          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&audience=api://ActionsOIDCGateway" | jq -r ".value")"  >> $GITHUB_ENV
          echo "::add-mask::$OIDC_TOKEN"

      - name: Example of using gateway as a proxy
        run: |
          curl -v -p --proxy-header "Gateway-Authorization: ${{ env.OIDC_TOKEN }}" -x https://your-load-balancer.example.com https://www.google.com

      - name: Example of an API gateway
        run: |
          curl -v -H "Gateway-Authorization: ${{ env.OIDC_TOKEN }}" https://your-load-balancer.example.com/apiExample

    ...