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
4 changes: 2 additions & 2 deletions test/e2e/entrypoint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ test('whole action: entrypoint, KICS, JavaScript stage and GitHub', async (t) =>
assert.match(run.summary, /\| TOTAL \| 4 \|/, run.stdout + run.stderr)
})

await t.test('results.json is left readable for the next workflow steps', knownBug('KICS runs as root and writes mode 600, so later steps and upload-sarif cannot read it (#130)'), async (t) => {
const run = await runEntrypoint(t, { results: kicsResults(), resultsMode: '600' })
await t.test('results.json is left readable for the next workflow steps', async (t) => {
const run = await runEntrypoint(t, { results: kicsResults() })
const mode = fs.statSync(path.join(run.workspace, 'results.json')).mode
assert.notEqual(mode & 0o044, 0, `mode is ${(mode & 0o777).toString(8)}`)
})
Expand Down
5 changes: 2 additions & 3 deletions test/helpers/run-entrypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [ -n "$FAKE_KICS_RESULTS" ]; then
mkdir -p "$out"
file="$out/\${FAKE_KICS_NAME:-results}.json"
cp "$FAKE_KICS_RESULTS" "$file"
if [ -n "$FAKE_KICS_MODE" ]; then chmod "$FAKE_KICS_MODE" "$file"; fi
chmod 755 "$file" # KICS v2.1.20 writes its reports world-readable
fi
exit "\${FAKE_KICS_EXIT:-0}"
`
Expand All @@ -51,7 +51,7 @@ function write(file, content, mode) {
fs.writeFileSync(file, content, { mode })
}

async function runEntrypoint(t, { inputs = {}, results, kicsExitCode = 0, runMain = false, apiUrl, workspaceFiles = {}, resultsName, resultsMode } = {}) {
async function runEntrypoint(t, { inputs = {}, results, kicsExitCode = 0, runMain = false, apiUrl, workspaceFiles = {}, resultsName } = {}) {
const sandbox = fs.mkdtempSync(path.join(os.tmpdir(), 'kics-entrypoint-'))
t.after(() => fs.rmSync(sandbox, { recursive: true, force: true }))

Expand Down Expand Up @@ -81,7 +81,6 @@ async function runEntrypoint(t, { inputs = {}, results, kicsExitCode = 0, runMai
FAKE_KICS_RESULTS: resultsFile,
FAKE_KICS_EXIT: String(kicsExitCode),
FAKE_KICS_NAME: resultsName ?? '',
FAKE_KICS_MODE: resultsMode ?? '',
REAL_NODE: process.execPath,
MAIN_JS,
}
Expand Down
Loading