Skip to content

Conversation

thyeggman
Copy link
Contributor

...

@Copilot Copilot AI review requested due to automatic review settings August 21, 2025 23:40
@thyeggman thyeggman requested a review from a team as a code owner August 21, 2025 23:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR prevents GitHub Actions runners from falling back to default tokens when downloading actions from GitHub.com in on-premises environments, specifically for GitHub Enterprise Cloud with data residency scenarios.

  • Adds logic to detect GitHub Enterprise Cloud environments with data residency
  • Implements conditional token fallback that prevents using default tokens for external action downloads
  • Introduces URL pattern validation to identify action downloads from GitHub.com

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Runner.Worker/ActionManager.cs Adds GitHub URL detection and conditional logic to prevent default token fallback for on-premises scenarios
src/Runner.Sdk/Util/UrlUtil.cs Implements new utility method to detect GHEC data residency fallback scenarios with regex pattern matching

// Default auth token
if (string.IsNullOrEmpty(actionDownloadInfo.Authentication?.Token))
// Use default auth token unless falling back from OnPrem
if (string.IsNullOrEmpty(actionDownloadInfo.Authentication?.Token) && !UrlUtil.IsGHECDRFallbackToDotcom(gitHubUrl, actionDownloadInfo))
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method IsGHECDRFallbackToDotcom is called with a potentially null gitHubUrl parameter. This will cause a null reference exception if both serverUrl and runnerSettings.GitHubUrl are null or empty.

Suggested change
if (string.IsNullOrEmpty(actionDownloadInfo.Authentication?.Token) && !UrlUtil.IsGHECDRFallbackToDotcom(gitHubUrl, actionDownloadInfo))
if (string.IsNullOrEmpty(actionDownloadInfo.Authentication?.Token) && (gitHubUrl == null || !UrlUtil.IsGHECDRFallbackToDotcom(gitHubUrl, actionDownloadInfo)))

Copilot uses AI. Check for mistakes.

@thyeggman thyeggman marked this pull request as draft August 21, 2025 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant