Compare commits

..
Author SHA1 Message Date
dependabot[bot] 361351a108 chore(deps): bump github/codeql-action/analyze from 4.38.2 to 4.39.0
Bumps [github/codeql-action/analyze](https://github.com/github/codeql-action) from 4.38.2 to 4.39.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee)

---
updated-dependencies:
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-16 10:53:20 +00:00
21 changed files with 53 additions and 299 deletions

No files matched your search

+1 -1
View File
@@ -73,4 +73,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
+8 -8
View File
@@ -27,7 +27,7 @@ jobs:
- name: Actionlint
uses: eifinger/actionlint-action@1fc89649be682d16ec5cf65ea16e269eb88d3982 # v1.10.2
- name: Run zizmor
uses: zizmorcore/zizmor-action@85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e # v0.7.1
uses: zizmorcore/zizmor-action@cc914d7f3750a2d13d75c7f184a1060aa0e9d482 # v0.6.4
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
@@ -54,7 +54,7 @@ jobs:
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
@@ -287,7 +287,7 @@ jobs:
checksum: "a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218"
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
@@ -326,7 +326,7 @@ jobs:
os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Install default version
uses: $/
- run: uv tool install ruff==0.14.10
@@ -339,7 +339,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
@@ -378,7 +378,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Install latest version
id: setup-uv
uses: $/
@@ -416,7 +416,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Install latest version
id: setup-uv
uses: $/
@@ -567,7 +567,7 @@ jobs:
expected-os: "windows-2025"
steps:
- if: runner.os == 'macOS'
uses: astral-sh/github-actions/demudhra@67dc9ee1ddc113eccd8116e7b949fb6cdcd89889 # 2026.11.16.0
uses: astral-sh/github-actions/demudhra@7aa50a3def9f5428c532b0ae972d1e5b357de5a5 # 2026.11.03.0
- name: Setup uv
id: setup-uv
uses: $/
+1 -1
View File
@@ -1 +1 @@
24.22.1
24.19.0
+1 -4
View File
@@ -6,7 +6,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
- Cache the installed version of uv to speed up consecutive runs on self-hosted runners
- Register problem matchers for error output
- (Optional) Persist the uv's cache in the GitHub Actions Cache
- Verify the SHA-256 checksum of the downloaded uv archive
- (Optional) Verify the checksum of the downloaded uv executable
## Contents
@@ -75,9 +75,6 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
# The checksum of the uv version to install
checksum: ""
# Require a checksum bundled with setup-uv or supplied through the checksum input
require-checksums: "false"
# Used when downloading uv from GitHub releases
github-token: ${{ github.token }}
+2 -2
View File
@@ -56,7 +56,7 @@ test("manifest checksums are used when no known checksum exists", async () => {
).rejects.toThrow("did not match");
});
test.each(["", undefined])("rejects missing checksums (%s)", async (hash) => {
test("empty manifest checksums are rejected", async () => {
await expect(
validateChecksum(
undefined,
@@ -64,7 +64,7 @@ test.each(["", undefined])("rejects missing checksums (%s)", async (hash) => {
"aarch64",
"pc-windows-msvc",
"1.2.3",
hash,
"",
),
).rejects.toThrow("No checksum found");
});
@@ -1,93 +0,0 @@
import { execFile, execFileSync } from "node:child_process";
import { createHash } from "node:crypto";
import fs from "node:fs";
import { createServer } from "node:http";
import type { AddressInfo } from "node:net";
import { tmpdir } from "node:os";
import path from "node:path";
import { promisify } from "node:util";
import { expect, test } from "@jest/globals";
import { getArch, getPlatform } from "../../src/utils/platforms";
test("enforces intrinsic checksums on downloads and tool-cache hits", async () => {
const platform = await getPlatform();
const target = `${getArch()}-${platform}`;
const windows = platform === "pc-windows-msvc";
const dir = fs.mkdtempSync(path.join(tmpdir(), "setup-uv-checksums-"));
const server = createServer();
try {
const member = windows ? "uv.exe" : `uv-${target}/uv`;
const archiveName = windows ? "uv.zip" : "uv.tar.gz";
fs.mkdirSync(path.dirname(path.join(dir, member)), { recursive: true });
fs.writeFileSync(path.join(dir, member), "test build");
execFileSync("tar", ["-acf", archiveName, member], { cwd: dir });
const archive = fs.readFileSync(path.join(dir, archiveName));
const digest = createHash("sha256").update(archive).digest("hex");
let downloads = 0;
server.on("request", (_req, res) => {
downloads++;
res.end(archive);
});
await new Promise<void>((resolve) =>
server.listen(0, "127.0.0.1", resolve),
);
const address = server.address() as AddressInfo;
function install(version: string, strict: boolean, checksum = "") {
const manifest = JSON.stringify({
artifacts: [
{
archive_format: windows ? "zip" : "tar.gz",
platform: target,
sha256: digest,
url: `http://127.0.0.1:${address.port}/${archiveName}`,
},
],
version,
});
return promisify(execFile)(process.execPath, ["dist/setup/index.cjs"], {
env: {
"INPUT_ACTIVATE-ENVIRONMENT": "false",
INPUT_CHECKSUM: checksum,
"INPUT_MANIFEST-FILE": `data:application/json,${encodeURIComponent(manifest)}`,
"INPUT_NO-PROJECT": "false",
"INPUT_PYTHON-VERSION": "3.13",
"INPUT_REQUIRE-CHECKSUMS": String(strict),
INPUT_VERSION: version,
"INPUT_WORKING-DIRECTORY": dir,
PATH: process.env.PATH,
RUNNER_TEMP: dir,
RUNNER_TOOL_CACHE: path.join(dir, "cache"),
SystemRoot: process.env.SystemRoot,
},
timeout: 10_000,
});
}
const version = "99.0.0";
await install(version, false);
await expect(install(version, true)).rejects.toMatchObject({
stdout: expect.stringContaining(
`No bundled checksum for ${target}-${version}`,
),
});
expect(downloads).toBe(1);
await install(version, true, digest);
expect(downloads).toBe(2);
await install(version, true, digest);
expect(downloads).toBe(2);
await expect(install(version, true, "0".repeat(64))).rejects.toMatchObject({
stdout: expect.stringContaining("did not match"),
});
// The custom manifest also offers these bytes under a known release version.
await expect(install("0.9.26", true)).rejects.toMatchObject({
stdout: expect.stringContaining("did not match"),
});
await expect(install(version, true, "../uv")).rejects.toMatchObject({
stdout: expect.stringContaining("Expected a SHA-256 checksum"),
});
} finally {
server.close();
fs.rmSync(dir, { force: true, recursive: true });
}
}, 30_000);
-1
View File
@@ -26,7 +26,6 @@ export function createSetupInputs(
pythonDir: "/tmp/uv-python-dir",
pythonVersion: "",
quiet: false,
requireChecksums: false,
resolutionStrategy: "highest",
restoreCache: false,
saveCache: true,
-6
View File
@@ -109,15 +109,9 @@ describe("loadInputs", () => {
expect(inputs.exportPythonArch).toBe(false);
expect(inputs.venvPath).toBe("/workspace/.venv");
expect(inputs.manifestFile).toBeUndefined();
expect(inputs.requireChecksums).toBe(false);
expect(inputs.resolutionStrategy).toBe("highest");
});
it("loads require-checksums", () => {
mockInputs["require-checksums"] = "true";
expect(loadInputs().requireChecksums).toBe(true);
});
it("uses the Python version from an explicitly selected .tool-versions file", () => {
mockInputs["working-directory"] = createTempProject({
".tool-versions": "uv 0.12.3\npython 3.13.1t\n",
-2
View File
@@ -19,8 +19,6 @@ inputs:
type: string
checksum:
type: string
require-checksums:
type: boolean
github-token:
type: string
enable-cache:
-3
View File
@@ -30,9 +30,6 @@ inputs:
checksum:
description: "The checksum of the uv version to install"
required: false
require-checksums:
description: "Require a SHA-256 checksum bundled with setup-uv or supplied through the checksum input."
default: "false"
github-token:
description:
"Used when downloading uv from GitHub releases."
Generated Vendored
-2
View File
@@ -66242,7 +66242,6 @@ function loadInputs() {
const noProject = getBooleanInput("no-project");
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
const checksum = getInput("checksum");
const requireChecksums = getBooleanInput("require-checksums");
const enableCache = getEnableCache();
const restoreCache2 = getInput("restore-cache") === "true";
const saveCache4 = getSaveCache();
@@ -66287,7 +66286,6 @@ function loadInputs() {
pythonDir,
pythonVersion,
quiet: quiet2,
requireChecksums,
resolutionStrategy,
restoreCache: restoreCache2,
saveCache: saveCache4,
Generated Vendored
+21 -60
View File
@@ -95330,24 +95330,6 @@ var fs10 = __toESM(require("node:fs"), 1);
// src/download/checksum/known-checksums.json
var known_checksums_default = {
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
@@ -101027,7 +101009,11 @@ async function validateChecksum(checksum, downloadPath, arch3, platform2, versio
const hasManifestChecksum = manifestChecksum !== void 0 && manifestChecksum !== "";
const checksumToUse = hasProvidedChecksum ? checksum : knownChecksum ?? (hasManifestChecksum ? manifestChecksum : void 0);
if (checksumToUse === void 0) {
throw new Error(`No checksum found for ${key} in manifest.`);
if (manifestChecksum !== void 0) {
throw new Error(`No checksum found for ${key} in manifest.`);
}
debug(`No checksum found for ${key}.`);
return;
}
const checksumSource = hasProvidedChecksum ? "provided checksum" : knownChecksum !== void 0 ? `KNOWN_CHECKSUMS entry for ${key}` : "manifest checksum";
debug(`Validating checksum using ${checksumSource}.`);
@@ -102902,30 +102888,18 @@ function minSatisfying3(versions, version3) {
}
// src/download/download-version.ts
function getIntrinsicChecksum(key, providedChecksum) {
const checksum = providedChecksum || KNOWN_CHECKSUMS[key];
if (!checksum) {
throw new Error(
`No bundled checksum for ${key}. With require-checksums enabled, update setup-uv or provide the checksum input for this archive.`
);
}
if (!/^[a-f0-9]{64}$/.test(checksum)) {
throw new Error(`Expected a SHA-256 checksum for ${key}.`);
}
return checksum;
}
function tryGetFromToolCache(arch3, version3, toolCacheName = TOOL_CACHE_NAME) {
function tryGetFromToolCache(arch3, version3) {
debug(`Trying to get uv from tool cache for ${version3}...`);
const cachedVersions = findAllVersions(toolCacheName, arch3);
const cachedVersions = findAllVersions(TOOL_CACHE_NAME, arch3);
debug(`Cached versions: ${cachedVersions}`);
let resolvedVersion = evaluateVersions(cachedVersions, version3);
if (resolvedVersion === "") {
resolvedVersion = version3;
}
const installedPath = find(toolCacheName, resolvedVersion, arch3);
const installedPath = find(TOOL_CACHE_NAME, resolvedVersion, arch3);
return { installedPath, version: resolvedVersion };
}
async function downloadVersion(platform2, arch3, version3, checksum, githubToken, manifestUrl, downloadFromAstralMirror = true, toolCacheName = TOOL_CACHE_NAME) {
async function downloadVersion(platform2, arch3, version3, checksum, githubToken, manifestUrl, downloadFromAstralMirror = true) {
const artifact = await getArtifact(version3, arch3, platform2, manifestUrl);
if (!artifact) {
throw new Error(
@@ -102945,8 +102919,7 @@ async function downloadVersion(platform2, arch3, version3, checksum, githubToken
version3,
resolvedChecksum,
manifestChecksum,
githubTokenForUrl(downloadUrl, githubToken),
toolCacheName
githubTokenForUrl(downloadUrl, githubToken)
);
} catch (err) {
if (mirrorUrl === void 0) {
@@ -102963,8 +102936,7 @@ async function downloadVersion(platform2, arch3, version3, checksum, githubToken
version3,
resolvedChecksum,
manifestChecksum,
githubTokenForUrl(artifact.downloadUrl, githubToken),
toolCacheName
githubTokenForUrl(artifact.downloadUrl, githubToken)
);
}
}
@@ -102981,7 +102953,7 @@ function githubTokenForUrl(downloadUrl, githubToken) {
return void 0;
}
}
async function downloadArtifact(downloadUrl, artifactName, platform2, arch3, version3, checksum, manifestChecksum, githubToken, toolCacheName) {
async function downloadArtifact(downloadUrl, artifactName, platform2, arch3, version3, checksum, manifestChecksum, githubToken) {
info2(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = await downloadTool(
downloadUrl,
@@ -103013,7 +102985,12 @@ async function downloadArtifact(downloadUrl, artifactName, platform2, arch3, ver
const extractedDir = await extractTar2(downloadPath);
uvDir = path15.join(extractedDir, artifactName);
}
const cachedToolDir = await cacheDir(uvDir, toolCacheName, version3, arch3);
const cachedToolDir = await cacheDir(
uvDir,
TOOL_CACHE_NAME,
version3,
arch3
);
return { cachedToolDir, version: version3 };
}
function getMissingArtifactMessage(version3, arch3, platform2, manifestUrl) {
@@ -103044,7 +103021,6 @@ function loadInputs() {
const noProject = getBooleanInput("no-project");
const venvPath = getVenvPath(workingDirectory, activateEnvironment2);
const checksum = getInput("checksum");
const requireChecksums = getBooleanInput("require-checksums");
const enableCache = getEnableCache();
const restoreCache3 = getInput("restore-cache") === "true";
const saveCache2 = getSaveCache();
@@ -103089,7 +103065,6 @@ function loadInputs() {
pythonDir,
pythonVersion,
quiet: quiet2,
requireChecksums,
resolutionStrategy,
restoreCache: restoreCache3,
saveCache: saveCache2,
@@ -103527,20 +103502,7 @@ async function setupUv(inputs, platform2, arch3) {
versionFile: inputs.versionFile,
workingDirectory: inputs.workingDirectory
});
let checksum = inputs.checksum;
let toolCacheName = TOOL_CACHE_NAME;
if (inputs.requireChecksums) {
checksum = getIntrinsicChecksum(
`${arch3}-${platform2}-${resolvedVersion}`,
inputs.checksum
);
toolCacheName = `${TOOL_CACHE_NAME}-${checksum}`;
}
const toolCacheResult = tryGetFromToolCache(
arch3,
resolvedVersion,
toolCacheName
);
const toolCacheResult = tryGetFromToolCache(arch3, resolvedVersion);
if (toolCacheResult.installedPath) {
info2(`Found uv in tool-cache for ${toolCacheResult.version}`);
return {
@@ -103552,11 +103514,10 @@ async function setupUv(inputs, platform2, arch3) {
platform2,
arch3,
resolvedVersion,
checksum,
inputs.checksum,
inputs.githubToken,
inputs.manifestFile,
inputs.downloadFromAstralMirror,
toolCacheName
inputs.downloadFromAstralMirror
);
return {
uvDir: downloadResult.cachedToolDir,
-18
View File
@@ -47954,24 +47954,6 @@ var semver = __toESM(require_semver(), 1);
// src/download/checksum/known-checksums.json
var known_checksums_default = {
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
+1 -3
View File
@@ -15,9 +15,7 @@ This document covers advanced options for configuring which version of uv to ins
Use `latest-known` to install the newest uv version whose checksums were bundled with the version of setup-uv used by your workflow. Version resolution is performed locally without fetching the latest release, so updating setup-uv also updates the version selected by `latest-known`.
When `manifest-file` is set, `latest-known` still selects a version from setup-uv's bundled checksum table.
By default the custom manifest supplies the artifact and checksum. To require a bundled or explicitly
supplied checksum, enable `require-checksums`. [Checksum validation](customization.md#validate-checksum)
When `manifest-file` is set, `latest-known` still selects a version from setup-uv's bundled checksum table, but the artifact and checksum come from the custom manifest.
```yaml
- name: Install the latest version of uv known to setup-uv
+1 -24
View File
@@ -4,7 +4,7 @@ This document covers advanced customization options including checksum validatio
## Validate checksum
Downloaded archives are automatically verified using checksums bundled with this action or,
Downloaded executables are automatically verified using checksums bundled with this action or,
for newer, not yet bundled versions, the checksum from [`astral-sh/versions`](https://github.com/astral-sh/versions).
You can specify a checksum to override those values. The sha256 hashes can also be found on the
[releases page](https://github.com/astral-sh/uv/releases) of the uv repo.
@@ -17,29 +17,6 @@ You can specify a checksum to override those values. The sha256 hashes can also
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
```
For an additional layer of protection, you can set `require-checksums: true`.
This prevents setup-uv from trusting an unknown version's checksum from
[`astral-sh/versions`](https://github.com/astral-sh/versions) *unless* it is also
present in the action's own bundled data *or* explicitly provided with `checksum`.
This can be combined with `version: latest-known` to select the newest bundled release,
meaning that this newer requires an external checksum source:
```yaml
- name: Install the latest known version of uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: latest-known
require-checksums: true
```
With this mode, you'll need to update setup-uv itself to get newer uv versions
*unless* you explicitly pass in a `checksum` with a version that post-dates the setup-uv
release.
On runners with a persistent tool cache, this mode reuses only installations previously verified
against the same digest. The first run may download uv again.
## Manifest file
By default, setup-uv reads version metadata from
+1 -1
View File
@@ -38,7 +38,7 @@ Material failures are unauthorized executable selection, credential disclosure,
### Security invariants
1. **Published runtime:** review `action.yml`, committed `dist/*.cjs`, and runner-interpreted shipped files; source-only fixes do not protect consumers.
2. **Executable identity:** precedence is workflow version, version file, project configuration, then `latest`. Manifest authority, platform, variant, URL, checksum, mirror fallback, extraction, and cache placement must bind the intended artifact. A tool-cache hit bypasses download validation and depends on cache provenance. With `require-checksums`, only entries keyed by the explicit or bundled archive digest are eligible.
2. **Executable identity:** precedence is workflow version, version file, project configuration, then `latest`. Manifest authority, platform, variant, URL, checksum, mirror fallback, extraction, and cache placement must bind the intended artifact. A tool-cache hit bypasses download validation and depends on cache provenance.
3. **Credential recipients:** tokens and URL credentials may reach only workflow-authorized origins, redirects, paths, and logs. Metadata authority does not imply token-recipient authority.
4. **Executable boundaries:** checkout-selected interpreters are authorized by default. Explicit workflow selections must win, and independent cache, runner, or remote state must not substitute executables or gain additional authority.
5. **Paths and action channels:** path/environment changes, virtual-environment clearing, outputs, state, and problem matchers must affect only authorized targets and keep untrusted values as data.
+5 -1
View File
@@ -23,7 +23,11 @@ export async function validateChecksum(
: (knownChecksum ?? (hasManifestChecksum ? manifestChecksum : undefined));
if (checksumToUse === undefined) {
throw new Error(`No checksum found for ${key} in manifest.`);
if (manifestChecksum !== undefined) {
throw new Error(`No checksum found for ${key} in manifest.`);
}
core.debug(`No checksum found for ${key}.`);
return;
}
const checksumSource = hasProvidedChecksum
-18
View File
@@ -1,22 +1,4 @@
{
"aarch64-apple-darwin-0.13.9": "5aeca67f2283f75235de40d0bd9c0a5bbc5fce23b6d48b3bf9fa1b2db08382ca",
"aarch64-pc-windows-msvc-0.13.9": "72eed595983a4d7d22d79f21065b0f4479cc7e5c7a89104bb410c8f47559a878",
"aarch64-unknown-linux-gnu-0.13.9": "0797542018e541a9288855df555c8077eed06f7a47d206362030480e8ecc9f3d",
"aarch64-unknown-linux-musl-0.13.9": "37fbb7c5bc66cf99c12aa881949d216181e201dec449772c4329e56487d61179",
"arm-unknown-linux-musleabihf-0.13.9": "b43b18e668c94f60e39fb91994cd5b4f17474f81d4967039071afb8f18a6b72d",
"armv7-unknown-linux-gnueabihf-0.13.9": "8bd2ce216e6d3fe825ec0fde4532dea708964e8c419844d2ed8e9e7901a7a11e",
"armv7-unknown-linux-musleabihf-0.13.9": "477c4d3759aaf68d76e570da03438d80a6445118e2a3d74500a98144c54324db",
"i686-pc-windows-msvc-0.13.9": "eb4bd7285a512ebc4122f65a21b72e3f7072610d62164f43ca6aca280c39f6fd",
"i686-unknown-linux-gnu-0.13.9": "ef1d3f7464e650d639f41f10130b2d9cb06d4171dd9778beb7f93a6d498812c5",
"i686-unknown-linux-musl-0.13.9": "0fc2dc2355d4d9c8b3695c3a0aedeb6d62ef921e6e78db1bbc0ff32857b944b7",
"powerpc64le-unknown-linux-gnu-0.13.9": "5c074a4a008037787c665081116b5b7bc77161d1b5b47ca936732f84b498b317",
"riscv64gc-unknown-linux-gnu-0.13.9": "96543eb42d59426db0092f1d860f319abb87c83aaa413a9710108cbd4f68c34b",
"riscv64gc-unknown-linux-musl-0.13.9": "0cf8c79c766dcbbc641e2a40f7433491c279a5b39869d6138bcd1c71adf82f93",
"s390x-unknown-linux-gnu-0.13.9": "7e15c75fbd907334790d60037e492877ed053dff82cc1c0e2a1de0825d0d3864",
"x86_64-apple-darwin-0.13.9": "617a3211261b0fc739562f0071aa34e9739797c510208ede8e2977c30903d041",
"x86_64-pc-windows-msvc-0.13.9": "edd61f7f5728a56cc62455386661860bdfc7bab65872f39b0c25bdcc1d8e1beb",
"x86_64-unknown-linux-gnu-0.13.9": "a7fbaff2b9a271d85c1bdb540941090fd1ce011797b4abeb48e4dcd39c2471d5",
"x86_64-unknown-linux-musl-0.13.9": "58ccf5f1792b8a5a88d01bc910ea131a8b3db4a319a17ad5fad75e0845a3e271",
"aarch64-apple-darwin-0.13.8": "6b71028a6b904f2ae3340ef52e595512de807d06c0a20eaef2f692581b246558",
"aarch64-pc-windows-msvc-0.13.8": "59e6d919bed1f72035e622a7c930058f08a8931c4c78ceaf9f56e7fb74dd2c48",
"aarch64-unknown-linux-gnu-0.13.8": "74f2f5c6024d397481db228db8fc25eed420db192243f88438c118e7e013e585",
+8 -25
View File
@@ -11,40 +11,22 @@ import {
import * as log from "../utils/logging";
import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum";
import { KNOWN_CHECKSUMS } from "./checksum/known-checksums";
import { getArtifact } from "./manifest";
export { resolveVersion } from "../version/resolve";
export function getIntrinsicChecksum(
key: string,
providedChecksum: string,
): string {
const checksum = providedChecksum || KNOWN_CHECKSUMS[key];
if (!checksum) {
throw new Error(
`No bundled checksum for ${key}. With require-checksums enabled, update setup-uv or provide the checksum input for this archive.`,
);
}
if (!/^[a-f0-9]{64}$/.test(checksum)) {
throw new Error(`Expected a SHA-256 checksum for ${key}.`);
}
return checksum;
}
export function tryGetFromToolCache(
arch: Architecture,
version: string,
toolCacheName = TOOL_CACHE_NAME,
): { version: string; installedPath: string | undefined } {
core.debug(`Trying to get uv from tool cache for ${version}...`);
const cachedVersions = tc.findAllVersions(toolCacheName, arch);
const cachedVersions = tc.findAllVersions(TOOL_CACHE_NAME, arch);
core.debug(`Cached versions: ${cachedVersions}`);
let resolvedVersion = tc.evaluateVersions(cachedVersions, version);
if (resolvedVersion === "") {
resolvedVersion = version;
}
const installedPath = tc.find(toolCacheName, resolvedVersion, arch);
const installedPath = tc.find(TOOL_CACHE_NAME, resolvedVersion, arch);
return { installedPath, version: resolvedVersion };
}
@@ -56,7 +38,6 @@ export async function downloadVersion(
githubToken: string,
manifestUrl?: string,
downloadFromAstralMirror = true,
toolCacheName = TOOL_CACHE_NAME,
): Promise<{ version: string; cachedToolDir: string }> {
const artifact = await getArtifact(version, arch, platform, manifestUrl);
@@ -90,7 +71,6 @@ export async function downloadVersion(
resolvedChecksum,
manifestChecksum,
githubTokenForUrl(downloadUrl, githubToken),
toolCacheName,
);
} catch (err) {
if (mirrorUrl === undefined) {
@@ -110,7 +90,6 @@ export async function downloadVersion(
resolvedChecksum,
manifestChecksum,
githubTokenForUrl(artifact.downloadUrl, githubToken),
toolCacheName,
);
}
}
@@ -149,7 +128,6 @@ async function downloadArtifact(
checksum: string | undefined,
manifestChecksum: string | undefined,
githubToken: string | undefined,
toolCacheName: string,
): Promise<{ version: string; cachedToolDir: string }> {
log.info(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = await tc.downloadTool(
@@ -187,7 +165,12 @@ async function downloadArtifact(
uvDir = path.join(extractedDir, artifactName);
}
const cachedToolDir = await tc.cacheDir(uvDir, toolCacheName, version, arch);
const cachedToolDir = await tc.cacheDir(
uvDir,
TOOL_CACHE_NAME,
version,
arch,
);
return { cachedToolDir, version };
}
+3 -23
View File
@@ -5,14 +5,9 @@ import * as exec from "@actions/exec";
import { restoreCache } from "./cache/restore-cache";
import {
downloadVersion,
getIntrinsicChecksum,
tryGetFromToolCache,
} from "./download/download-version";
import {
STATE_UV_PATH,
STATE_UV_VERSION,
TOOL_CACHE_NAME,
} from "./utils/constants";
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants";
import { CacheLocalSource, loadInputs, type SetupInputs } from "./utils/inputs";
import * as log from "./utils/logging";
import {
@@ -152,21 +147,7 @@ async function setupUv(
versionFile: inputs.versionFile,
workingDirectory: inputs.workingDirectory,
});
let checksum = inputs.checksum;
let toolCacheName = TOOL_CACHE_NAME;
if (inputs.requireChecksums) {
checksum = getIntrinsicChecksum(
`${arch}-${platform}-${resolvedVersion}`,
inputs.checksum,
);
// A regular tool-cache entry may have been verified using a manifest checksum.
toolCacheName = `${TOOL_CACHE_NAME}-${checksum}`;
}
const toolCacheResult = tryGetFromToolCache(
arch,
resolvedVersion,
toolCacheName,
);
const toolCacheResult = tryGetFromToolCache(arch, resolvedVersion);
if (toolCacheResult.installedPath) {
log.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
return {
@@ -179,11 +160,10 @@ async function setupUv(
platform,
arch,
resolvedVersion,
checksum,
inputs.checksum,
inputs.githubToken,
inputs.manifestFile,
inputs.downloadFromAstralMirror,
toolCacheName,
);
return {
-3
View File
@@ -30,7 +30,6 @@ export interface SetupInputs {
noProject: boolean;
venvPath: string;
checksum: string;
requireChecksums: boolean;
enableCache: boolean;
restoreCache: boolean;
saveCache: boolean;
@@ -64,7 +63,6 @@ export function loadInputs(): SetupInputs {
const noProject = core.getBooleanInput("no-project");
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
const checksum = core.getInput("checksum");
const requireChecksums = core.getBooleanInput("require-checksums");
const enableCache = getEnableCache();
const restoreCache = core.getInput("restore-cache") === "true";
const saveCache = getSaveCache();
@@ -112,7 +110,6 @@ export function loadInputs(): SetupInputs {
pythonDir,
pythonVersion,
quiet,
requireChecksums,
resolutionStrategy,
restoreCache,
saveCache,