Repository navigation
Conversation
|
Heads up on the red CI, both failures are pre-existing on main and not from this change.
The jobs this PR affects are green: build-diff, test-version-file (.dvmrc and .tool-versions), and the new test-version-file-dvm. Happy to fix either one in a separate PR if that helps. |
|
The red CI here is pre-existing and unrelated to this PR — I reproduced it on unmodified Only one check actually failed: The The cause is the declare global {
interface ImportMeta {
dirname?: string;
filename?: string;
}
}Deno now ships I've deliberately left that out of this PR since it's unrelated to For what it's worth, this PR's own tests do pass: |
|
I’m concerned that this change allows an attacker to specify an attacker-controlled URL in the .dvmrc file, potentially causing CI to download and execute an untrusted binary. |
A version file is repo content, so it must not be able to choose what gets downloaded. Neither dvm's registry_binary key nor a URL in deno_version is accepted as a version: both fail parseVersionRange before any download. Cover both with a job that expects the action to fail. Signed-off-by: somaz <genius5711@gmail.com>
|
Good question. I traced it, and the file contents can't reach a download URL.
Two things specific to this PR:
Checked against the real functions: I've added a For completeness: the one path where file-derived bytes do reach a URL is |
The README documents that
deno-version-filecan read dvm's.dvmrc, but the parser only accepts a bare version string. dvm writes the file askey=value(configrc.rsserializes withformat!("{}={}", k, v)), sodeno_version=1.43.1falls through to the bare-version branch and fails withThe passed version range is not valid..dvmrcis a general key/value store rather than a single line, and dvm also recordsregistry_binary/registry_version, so the version is not necessarily on the first line. The new pattern scans every line for thedeno_versionkey. It runs only after the existing.tool-versionsmatch, and the two patterns are disjoint, so bare-version and.tool-versionsfiles behave exactly as before.Also tolerates spaces around
=(dvm's own reader trims both sides) and avprefix, consistent with the existing.tool-versionshandling.Validation:
deno lint,deno fmt --check,deno check src/main.tsall pass locallydeno run -A scripts/build.tsrebuiltdist/, and a second build is byte-identical, sobuild-diffstays cleantest-version-file-dvmjob writes a dvm-style.dvmrcwithdeno_versionon the second line, so it covers the multi-key case rather than just a prefix strip=/vprefix / CRLF, plus regressions for bare version, bare range (~1.32),.tool-versions, and amy_deno_versionx=string that must not matchrelated: #121