Skip to content
Merged
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 @@ -67,7 +67,7 @@ runs:
const {METADATA} = process.env;

const metadata = JSON.parse(METADATA);
core.setOutput('coverage-reports', metadata.reportPaths); // Trusted path as it comes from trusted metadata (=from `reports-group/load-metadata`)
core.setOutput('coverage-reports', metadata.reports); // Trusted path as it comes from trusted metadata (=from `reports-group/load-metadata`)

- name: Ensure at least one report to upload
if: ${{ '' == steps.build-uploader-options.outputs.coverage-reports }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ runs:

const metadata = JSON.parse(METADATA);
core.setOutput('name', metadata.name);
core.setOutput('files', metadata.reportPaths); // Trusted path as it comes from trusted metadata (=from `reports-group/load-metadata`)
core.setOutput('files', metadata.reports); // Trusted path as it comes from trusted metadata (=from `reports-group/load-metadata`)
if (metadata.flags.length > 0) {
core.setOutput('flags', metadata.flags);
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/reports-group/find-action/dist/index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ async function run() {
reports: formatList('reports'),
flags: formatList('flags'),
path: formatScalar('path'),
reportPaths: formatList('reportPaths')
};
}

Expand Down
8 changes: 4 additions & 4 deletions .github/actions/reports-group/node-sdk/src/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function trustFrom(workspacePath) {
},
/**
* @param {string} untrustedGroupPath
* @returns {{name: string, format: string, reports: string[], flags: string[], path: string, reportPaths: string[]}}
* @returns {{name: string, format: string, reports: string[], flags: string[], path: string}}
*/
trustedMetadataUnder: (untrustedGroupPath) => {
const trustedPath = helpers.trust(path.join(untrustedGroupPath, METADATA_FILENAME));
Expand All @@ -72,15 +72,15 @@ function trustFrom(workspacePath) {

const untrustedMetadata = JSON.parse(content);
const trustedGroupPath = path.dirname(trustedPath);
const trustedReportPaths = untrustedMetadata.reports.map(r => helpers.trust(r));
// Ensure `reports` hasn't been tampered with ! (may lead to files outside the directory)
const trustedReportPathsConverter = trustFrom(trustedGroupPath);

return {
name: untrustedMetadata.name,
format: untrustedMetadata.format,
reports: trustedReportPaths,
reports: untrustedMetadata.reports.map(r => trustedReportPathsConverter.trust(path.join(trustedGroupPath, r))),
flags: untrustedMetadata.flags,
path: withTrailingSeparator(trustedGroupPath),
reportPaths: trustedReportPaths.map(trustedFp => path.join(trustedGroupPath, trustedFp)),
};
}
};
Expand Down