Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19399,7 +19399,12 @@ var artifactMetadata = {
async function main() {
const [artifactDirPath] = process.argv.slice(2);
for (const [key, name] of Object.entries(artifactMetadata)) {
const content = await fs.promises.readFile(path.join(artifactDirPath, name), "utf8");
const expectedPath = path.join(artifactDirPath, name);
const realPath = await fs.promises.realpath(expectedPath);
if (expectedPath !== realPath) {
throw Error(`Value for unsafe-${key} not stored directly in file as expected, instead stored in ${realPath}`);
}
const content = await fs.promises.readFile(expectedPath, "utf8");
const outputName = `unsafe-${key}`;
console.info(`Setting output: ${outputName} = ${content}`);
(0, import_core.setOutput)(outputName, content.trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ async function main() {
const [artifactDirPath] = process.argv.slice(2);

for (const [key, name] of Object.entries(artifactMetadata)) {
const content = await fs.promises.readFile(path.join(artifactDirPath, name), 'utf8');
/** The expected path of the artifact */
const expectedPath = path.join(artifactDirPath, name);

// We confirm that the provided artifact path is actually in the expected location instead of pointing somewhere
// else to exfiltrate information.
const realPath = await fs.promises.realpath(expectedPath);
if (expectedPath !== realPath) {
throw Error(
`Value for unsafe-${key} not stored directly in file as expected, instead stored in ${realPath}`,
);
}

const content = await fs.promises.readFile(expectedPath, 'utf8');
const outputName = `unsafe-${key}`;

console.info(`Setting output: ${outputName} = ${content}`);
Expand Down