mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix regex in response to security scan concern in CI build
This commit is contained in:
parent
130493e43d
commit
5eaf8ba876
1 changed files with 3 additions and 3 deletions
|
|
@ -27,18 +27,18 @@ export function isValidGitRepositoryUrl(url: string): boolean {
|
|||
// - https://gitlab.com/username/repo
|
||||
// - https://bitbucket.org/username/repo
|
||||
const httpsPattern =
|
||||
/^https?:\/\/[a-zA-Z0-9_.-]+(\.[a-zA-Z0-9_.-]+)*\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+(\/.+)*(\.git)?$/
|
||||
/^https?:\/\/(?:[a-zA-Z0-9_-]+\.)*[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+(?:\/[^/]+)*(?:\.git)?$/
|
||||
|
||||
// SSH pattern
|
||||
// Examples:
|
||||
// - git@github.com:username/repo.git
|
||||
// - git@gitlab.com:username/repo.git
|
||||
const sshPattern = /^git@[a-zA-Z0-9_.-]+(\.[a-zA-Z0-9_.-]+)*:([a-zA-Z0-9_.-]+)\/([a-zA-Z0-9_.-]+)(\.git)?$/
|
||||
const sshPattern = /^git@(?:[a-zA-Z0-9_-]+\.)*[a-zA-Z0-9_-]+:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)(?:\.git)?$/
|
||||
|
||||
// Git protocol pattern
|
||||
// Examples:
|
||||
// - git://github.com/username/repo.git
|
||||
const gitProtocolPattern = /^git:\/\/[a-zA-Z0-9_.-]+(\.[a-zA-Z0-9_.-]+)*\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+(\.git)?$/
|
||||
const gitProtocolPattern = /^git:\/\/(?:[a-zA-Z0-9_-]+\.)*[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+(?:\.git)?$/
|
||||
|
||||
return httpsPattern.test(trimmedUrl) || sshPattern.test(trimmedUrl) || gitProtocolPattern.test(trimmedUrl)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue