Skip to content

Fix GHES hostnames detection to use exact match for github.com #661

Closed as duplicate of#662
@jtquip88

Description

@jtquip88

Describe the bug

Currently, any hostname ending with "github.com" (such as "slack-github.com") is incorrectly identified as the public GitHub host github.com.

The fix changes the public github hostname check from a suffix match to an exact match:

Before: strings.HasSuffix(u.Hostname(), "github.com")
After: u.Hostname() == "github.com"

This ensures that GHES hostnames like "slack-github.com" are correctly identified as GitHub Enterprise Server instances rather than being treated as the public GitHub.com.
Alternative approaches:

  1. I am not sure if public github hosts can have subdomains, but if needed a regex can be used to match host name patterns.
  2. Add extra optional parameter like IS_GHES to explicitly indicate that this is a GHES instance.

Fixes #662

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions