Skip to main content
Use a private test repository to verify that Forge brokers a GitHub credential and blocks a specific REST API operation. Both requests in this recipe are read-only.

Set up the Resource

  1. Use an online Resource Gateway with outbound HTTPS access to api.github.com.
  2. Create a short-lived fine-grained GitHub personal access token for the private test repository. Select only that repository and use Metadata read access. GitHub requires this permission for Get a repository and Get all repository topics.
  3. In Policies → Resources, select New resource. Name it GitHub API qualification. Select HTTP, enter api.github.com on port 443, and turn on Use HTTPS. Assign the gateway and save.
  4. On the Resource page, add a Bearer token credential with the GitHub token. Assign it to the test user. Forge adds the GitHub token to permitted upstream requests. See Credentials and identity.
  5. Open Connect directly. Download the trust certificate and select Generate access. Use the generated Forge access credential in the direct client.

Establish a direct-access baseline

Replace resources.example.com, OWNER, and REPO with your gateway hostname and test repository. Run the setup in Bash or Zsh. When read waits for input, paste the short-lived Forge access token and press Enter.
Confirm that both calls return HTTP 200. Check the private repository name in the first response. The second response contains a names array, which can be empty.

Block the topics endpoint

Create a Resource policy named Block GitHub test repository topics and scope it to GitHub API qualification. Set Condition type to Match all and add the following conditions.
  • HTTP method Equals GET.
  • HTTP path Equals /repos/OWNER/REPO/topics. Substitute the same owner and repository you used in the baseline.
Select Block and Enforce. Set the user message to GitHub test repository topics are blocked by Forge. Enable and save the policy. See Resource Policies. Generate a fresh Forge access token and repeat both requests. The repository request returns HTTP 200. The topics request returns HTTP 403 with the Forge message and policy ID. In Live → Resources, confirm an allowed repository request and a topics request blocked by the named policy. Verify that both events identify the test user. Clear the temporary client credential when you finish.

Repeat with automatic routing

Select only the enrolled test devices for this run. Once a test device reports Active routing and trusts the organization inspection CA, enable Automatic routing on the Resource. Wait for the device to receive the updated configuration. Use fresh connections to the original hostname. See Automatic routing. On the test device, replace OWNER and REPO with the same values you used for direct access.
Verify the same HTTP 200 and Forge 403 outcomes. Check the user and device in Live → Resources. Automatic routing uses the enrolled device identity, and the gateway supplies the assigned GitHub credential. To check upstream receipt independently, repeat the policy test with a separate HTTPS Resource pointing at a private test server that logs both paths. After the policy is active, the server log should contain the allowed request and no entry for the blocked request. The GitHub test above verifies provider authentication and the Forge decision. The private server test verifies forwarding behavior with origin logs.