mirror of
https://github.com/actions/checkout.git
synced 2026-12-05 03:52:55 +08:00
Ignore a .git suffix when matching checkout repositories
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -196,6 +196,30 @@ describe('unsafe-pr-checkout-helper', () => {
|
||||
).rejects.toThrow()
|
||||
})
|
||||
|
||||
it('refuses pull_request_target when repository points at the fork with a .git suffix', async () => {
|
||||
setContext('pull_request_target', forkPullRequestTargetPayload())
|
||||
await expect(
|
||||
check({
|
||||
qualifiedRepository: `${FORK_QUALIFIED_REPO}.git`,
|
||||
ref: 'refs/heads/main',
|
||||
commit: '',
|
||||
allowUnsafePrCheckout: false
|
||||
})
|
||||
).rejects.toThrow()
|
||||
})
|
||||
|
||||
it('strips only one .git suffix from the repository', async () => {
|
||||
setContext('pull_request_target', forkPullRequestTargetPayload())
|
||||
await expect(
|
||||
check({
|
||||
qualifiedRepository: `${FORK_QUALIFIED_REPO}.git.git`,
|
||||
ref: 'refs/heads/main',
|
||||
commit: '',
|
||||
allowUnsafePrCheckout: false
|
||||
})
|
||||
).resolves.toBeUndefined()
|
||||
})
|
||||
|
||||
it('allows pull_request_target checkout of an unrelated third-party repo', async () => {
|
||||
setContext('pull_request_target', forkPullRequestTargetPayload())
|
||||
await expect(
|
||||
|
||||
Reference in New Issue
Block a user