Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
yoanm committed Mar 20, 2024
1 parent 6a42239 commit f315931
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/actions/reports-group/create/dist/index.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/actions/reports-group/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function run() {
reports: trustedReportsMap.map(v => v.filename),
flags: FLAG_LIST_INPUT
};
core.info('Created');
core.info('metadata=' + JSON.stringify(trustedMetadata));

return res;
}
Expand All @@ -96,7 +96,7 @@ async function run() {
'Create metadata file',
async () => {
const trustedFp = trustedPathHelper.trust(path.resolve(trustedGroupDirectory, SDK.METADATA_FILENAME));
core.info('Create metadata file at ' + trustedFp + ' with: ' + JSON.stringify(trustedMetadata));
core.info('Create metadata file at ' + trustedFp);

fs.writeFileSync(trustedFp, JSON.stringify(trustedMetadata));

Check warning on line 101 in .github/actions/reports-group/create/index.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/actions/reports-group/create/index.js#L101

The application dynamically constructs file or path information.
});
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/reports-group/find/dist/index.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/actions/reports-group/load-metadata/dist/index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions .github/actions/reports-group/load-metadata/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ async function run() {
core.setFailed('Unable to retrieve any group. Something wrong most likely happened !');
}

return trustedMetadataPathList.map(async (trustedGroupPath) => {
const res = trustedMetadataPathList.map((trustedGroupPath) => {
core.info('Load '+ trustedGroupPath);

return trustedPathConverter.trustedMetadataUnder(trustedGroupPath);
const innerRes = trustedPathConverter.trustedMetadataUnder(trustedGroupPath);
core.info('DEBUG innerRes='+JSON.stringify(innerRes));

return innerRes;
});
core.info('DEBUG res='+JSON.stringify(res));

return res;
}
);
core.debug('Group paths=' + JSON.stringify(trustedMetadataList));
Expand Down
6 changes: 4 additions & 2 deletions .github/actions/reports-group/node-sdk/src/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function avoidPoisonNullBytesAttack(untrustedPath) {
}
}
function avoidRelativePathAttack(trustedRootPath, untrustedPath) {
const normalizedPath = path.normalize(path.resolve(untrustedPath));
const normalizedPath = path.resolve(untrustedPath);
if (normalizedPath.indexOf(trustedRootPath) !== 0) {
throw new Error(
'Potential "Relative Path" attack detected !\n'
Expand Down Expand Up @@ -63,8 +63,10 @@ function trustFrom(workspacePath) {
const trustedReportPaths = untrustedMetadata.reports.map(r => helpers.trust(r));

return {
...untrustedMetadata,
name: untrustedMetadata.name,
format: untrustedMetadata.format,
reports: trustedReportPaths,
flags: untrustedMetadata.flags,
path: trustedGroupPath,
reportPaths: trustedReportPaths.map(trustedFp => helpers.trust(path.join(trustedGroupPath, trustedFp))),

Check warning on line 71 in .github/actions/reports-group/node-sdk/src/path.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/actions/reports-group/node-sdk/src/path.js#L71

Detected possible user input going into a `path.join` or `path.resolve` function.
};
Expand Down

0 comments on commit f315931

Please sign in to comment.