Skip to content

Commit 29fcd1d

Browse files
committed
fix: shell injection in CLONE_TYPE_TAG and use per_page for commits API
1 parent d8036b8 commit 29fcd1d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/VCS/Adapter/Git/GitLab.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function getLatestCommit(string $owner, string $repositoryName, string $b
313313
{
314314
$ownerPath = $this->getOwnerPath($owner);
315315
$projectPath = urlencode("{$ownerPath}/{$repositoryName}");
316-
$url = "/projects/{$projectPath}/repository/commits?ref_name=" . urlencode($branch) . "&limit=1";
316+
$url = "/projects/{$projectPath}/repository/commits?ref_name=" . urlencode($branch) . "&per_page=1";
317317

318318
$response = $this->call(self::METHOD_GET, $url, ['PRIVATE-TOKEN' => $this->accessToken]);
319319

@@ -386,7 +386,7 @@ public function generateCloneCommand(string $owner, string $repositoryName, stri
386386
break;
387387
case self::CLONE_TYPE_TAG:
388388
$tagName = escapeshellarg($version);
389-
$commands[] = "git fetch --depth=1 origin refs/tags/{$version} && git checkout FETCH_HEAD";
389+
$commands[] = "git fetch --depth=1 origin refs/tags/{$tagName} && git checkout FETCH_HEAD";
390390
break;
391391
default:
392392
throw new Exception("Unsupported clone type: {$versionType}");

0 commit comments

Comments
 (0)