File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
github-actions/previews/upload-artifacts-to-firebase Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -19398,11 +19398,14 @@ var artifactMetadata = {
1939819398//
1939919399async function main() {
1940019400 const [artifactDirPath] = process.argv.slice(2);
19401+ const fullArtifactDirPath = await fs.promises.realpath(artifactDirPath);
1940119402 for (const [key, name] of Object.entries(artifactMetadata)) {
19402- const expectedPath = path.join(artifactDirPath , name);
19403+ const expectedPath = path.normalize(path. join(fullArtifactDirPath , name) );
1940319404 const realPath = await fs.promises.realpath(expectedPath);
1940419405 if (expectedPath !== realPath) {
19405- throw Error(`Value for unsafe-${key} not stored directly in file as expected, instead stored in ${realPath}`);
19406+ throw Error(`Value for unsafe-${key} not stored directly in file as expected,
19407+ expected: ${expectedPath}
19408+ got: ${realPath}`);
1940619409 }
1940719410 const content = await fs.promises.readFile(expectedPath, "utf8");
1940819411 const outputName = `unsafe-${key}`;
Original file line number Diff line number Diff line change @@ -21,17 +21,19 @@ import {artifactMetadata} from '../../constants.js';
2121
2222async function main ( ) {
2323 const [ artifactDirPath ] = process . argv . slice ( 2 ) ;
24+ /** The full path to the artifact directory. */
25+ const fullArtifactDirPath = await fs . promises . realpath ( artifactDirPath ) ;
2426
2527 for ( const [ key , name ] of Object . entries ( artifactMetadata ) ) {
2628 /** The expected path of the artifact */
27- const expectedPath = path . join ( artifactDirPath , name ) ;
29+ const expectedPath = path . normalize ( path . join ( fullArtifactDirPath , name ) ) ;
2830
2931 // We confirm that the provided artifact path is actually in the expected location instead of pointing somewhere
3032 // else to exfiltrate information.
3133 const realPath = await fs . promises . realpath ( expectedPath ) ;
3234 if ( expectedPath !== realPath ) {
3335 throw Error (
34- `Value for unsafe-${ key } not stored directly in file as expected, instead stored in ${ realPath } ` ,
36+ `Value for unsafe-${ key } not stored directly in file as expected,\n expected: ${ expectedPath } \n got: ${ realPath } ` ,
3537 ) ;
3638 }
3739
You can’t perform that action at this time.
0 commit comments