Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GHES host check #1648

Merged
merged 2 commits into from Jan 31, 2024
Merged

Update GHES host check #1648

merged 2 commits into from Jan 31, 2024

Conversation

eggyhead
Copy link
Contributor

@eggyhead eggyhead commented Jan 31, 2024

What are we doing?

Currently, we are only checking equality against github.com to ensure artifact and cache actions are being run in a non-enterprise host. We need to update this check to allow requests from ghe.com and ghe.localhost, additional allowed hostnames for production and local development.

Fixes https://github.com/github/actions-results-team/issues/2208

How are we doing it?

  • We are including the known GItHub hostnames in the negative condition for isGhes

How do I test?

  • Run upload or download artifact from an allowed host using this toolkit package version


const hostname = ghUrl.hostname.trimEnd().toUpperCase()
const isGitHubHost = (hostname == 'GITHUB.COM')
const isProximaHost = (hostname.endsWith('GHE.COM') || hostname.endsWith('GHE.LOCALHOST'))

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
GHE.COM
' may be preceded by an arbitrary host name.
Copy link

Choose a reason for hiding this comment

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

???

Copy link

Choose a reason for hiding this comment

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

???

Copy link

Choose a reason for hiding this comment

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

Incomplete URL substring sanitization

'GHE.COM' may be preceded by an arbitrary host name.

Show more details

updating alowed hosts in artifact ghes check

using dot prepend ghe host
@eggyhead eggyhead force-pushed the eggyhead/ghescheck-updatehosts branch from 1e316cc to 3b02a6f Compare January 31, 2024 16:31
@eggyhead eggyhead marked this pull request as ready for review January 31, 2024 17:14
@eggyhead eggyhead requested review from a team as code owners January 31, 2024 17:14
Copy link

@chrisimap32 chrisimap32 left a comment

Choose a reason for hiding this comment

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

R

@chrisimap32
Copy link

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.

None yet

4 participants