Skip to content

Commit ce97dfe

Browse files
committed
Sanitise artifact name
1 parent 003044e commit ce97dfe

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/init-action-post.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/init-action-post-helper.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,9 @@ test("tryUploadSarifIfRunFailed - uploads as artifact for risk assessments", asy
672672
logger,
673673
);
674674

675-
const expectedName = `sarif-artifact-${debugArtifacts.getArtifactSuffix(matrix)}`;
675+
const expectedName = debugArtifacts.sanitizeArtifactName(
676+
`sarif-artifact-${debugArtifacts.getArtifactSuffix(matrix)}`,
677+
);
676678
t.is(result.upload_failed_run_skipped_because, undefined);
677679
t.is(result.upload_failed_run_error, undefined);
678680
t.is(result.sarifID, expectedName);

src/init-action-post-helper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
import {
1616
getArtifactSuffix,
1717
getArtifactUploaderClient,
18+
sanitizeArtifactName,
1819
} from "./debug-artifacts";
1920
import * as dependencyCaching from "./dependency-caching";
2021
import { EnvVar } from "./environment";
@@ -233,7 +234,7 @@ async function maybeUploadFailedSarifArtifact(
233234
const client = await getArtifactUploaderClient(logger, gitHubVersion.type);
234235

235236
const suffix = getArtifactSuffix(actionsUtil.getOptionalInput("matrix"));
236-
const name = `sarif-artifact-${suffix}`;
237+
const name = sanitizeArtifactName(`sarif-artifact-${suffix}`);
237238
await client.uploadArtifact(
238239
name,
239240
[path.normalize(failedSarif.sarifFile)],

0 commit comments

Comments
 (0)