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

OCM-7188: GitHub IDP Add hostname validation #1909

Merged

Conversation

mnecas
Copy link
Contributor

@mnecas mnecas commented Apr 9, 2024

The openshfit validates the GitHub hostname and it can not match the [*.]github.com If the user would put the hostname 'github.com' the hive idp sync would fail as the admission controller would not allow to update the oauth cr

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 9, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 9, 2024

@mnecas: This pull request references OCM-7188 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.16.0" version, but no target version was set.

In response to this:

The openshfit validates the GitHub hostname and it can not match the [*.]github.com If the user would put the hostname 'github.com' the hive idp sync would fail as the admission controller would not allow to update the oauth cr

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 9, 2024
Copy link
Contributor

openshift-ci bot commented Apr 9, 2024

Hi @mnecas. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@robpblake
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 9, 2024
@mnecas mnecas force-pushed the add_idp_github_validation branch from 40cece2 to f0f9b61 Compare April 9, 2024 08:42
Copy link

codecov bot commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 21.42%. Comparing base (b3f87d7) to head (8c78469).
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1909      +/-   ##
==========================================
- Coverage   21.69%   21.42%   -0.27%     
==========================================
  Files         118      118              
  Lines       19782    20481     +699     
==========================================
+ Hits         4292     4389      +97     
- Misses      15165    15732     +567     
- Partials      325      360      +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mnecas mnecas force-pushed the add_idp_github_validation branch 2 times, most recently from 9b1fabb to 7949ca9 Compare April 9, 2024 12:12
if hostname == "github.com" || strings.HasSuffix(hostname, ".github.com") {
return fmt.Errorf(fmt.Sprintf("'%s' hostname cannot be equal to [*.]github.com", hostname))
}
if !(len(validation.IsDNS1123Subdomain(hostname)) == 0 || netutils.ParseIPSloppy(hostname) != nil) {
return fmt.Errorf(fmt.Sprintf("'%s' hostname must be a valid DNS subdomain or IP address", val.(string)))
Copy link
Contributor

Choose a reason for hiding this comment

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

@mnecas Minor, but you can just use the hostname variable rather than recasting the val again to a string.

The openshfit validates the GitHub hostname and it can not match the [*.]github.com
If the user would put the hostname 'github.com' the hive idp sync would
fail as the admission controller would not allow to update the oauth cr

Signed-off-by: Martin Necas <mnecas@redhat.com>
@mnecas mnecas force-pushed the add_idp_github_validation branch from 7949ca9 to 8c78469 Compare April 9, 2024 17:41
Copy link
Contributor

@robpblake robpblake left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2024
Copy link
Contributor

openshift-ci bot commented Apr 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mnecas, robpblake

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2024
Copy link
Contributor

openshift-ci bot commented Apr 10, 2024

@mnecas: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 336a4b2 into openshift:master Apr 10, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants