-
Notifications
You must be signed in to change notification settings - Fork 119
Fix/1180-Add validation to prevent URLs in org , Enterprise and repo fields improv #1368
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
base: main
Are you sure you want to change the base?
Fix/1180-Add validation to prevent URLs in org , Enterprise and repo fields improv #1368
Conversation
Unit Test Results 1 files 1 suites 10m 23s ⏱️ Results for commit eb6d32f. ♻️ This comment has been updated with latest results. |
There was a problem hiding this 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 adds validation to several command argument classes to reject full URL inputs for organization, repository, and enterprise name parameters, throwing user-friendly errors when URLs are provided. It also includes new unit tests to verify these validations.
- Introduced
ValidateNamesAreNotUrls
inMigrateRepoCommandArgs
and inline URL checks inMigrateOrgCommandArgs
andGenerateScriptCommandArgs
. - Updated existing
Validate
methods to call the new URL validation logic. - Added corresponding tests in three test files to ensure URL inputs throw the expected exceptions.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/gei/Commands/MigrateRepo/MigrateRepoCommandArgs.cs | Added ValidateNamesAreNotUrls and call in Validate() |
src/gei/Commands/MigrateOrg/MigrateOrgCommandArgs.cs | Added URL checks for source org, target org, and enterprise |
src/gei/Commands/GenerateScript/GenerateScriptCommandArgs.cs | Added URL checks for source and target org fields |
src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandArgsTests.cs | Added tests for URL inputs in org and repo fields |
src/OctoshiftCLI.Tests/gei/Commands/MigrateOrg/MigrateOrgCommandArgsTests.cs | Added tests for URL inputs in org and enterprise fields |
src/OctoshiftCLI.Tests/gei/Commands/GenerateScript/GenerateScriptCommandArgsTests.cs | Added tests for URL inputs in org fields |
4b76367
to
aa26cbf
Compare
aa26cbf
to
eb6d32f
Compare
Hi @dylan-smith could you please review my request |
…e test targeting
ThirdPartyNotices.txt
(if applicable)Added validation to ensure the following fields reject URLs and throw appropriate errors, as they are expected to contain plain names only:
GithubSourceOrg
GithubTargetOrg
SourceRepo
TargetRepo
Enterprise
These validations prevent incorrect usage like passing "https://github.com/org" instead of just "org".