Hostile 99% github Download

github/codeql-action 0fa1882f994fbd81a47ab0804f93354f5ea40147

“Actions for running CodeQL analysis”

Targets fixed list of Node home files.env configuration file

Evidence

imports fs index.ts · lines 1–39
1
2import * as core from '@actions/core'
3import * as yaml from 'js-yaml'
4import * as fs from 'fs'
5import * as assert from 'assert'
6
7const actualConfig = loadActualConfig()
8
9const rawExpectedConfig = process.argv[3].trim()
10if (!rawExpectedConfig) {
11 core.setFailed('No expected configuration provided')
12} else {
13 core.startGroup('Expected generated user config')
14 core.info(yaml.dump(JSON.parse(rawExpectedConfig)))
15 core.endGroup()
16}
⋯9 lines
26
27function loadActualConfig() {
28 if (!fs.existsSync(process.argv[2])) {
29 core.info('No configuration file found')
30 return undefined
31 } else {
32 const rawActualConfig = fs.readFileSync(process.argv[2], 'utf8')
33 core.startGroup('Actual generated user config')
34 core.info(rawActualConfig)
35 core.endGroup()
36
37 return yaml.load(rawActualConfig)
38 }
39}
Imports the Node.js fs module index.js · lines 1–43
1'use strict'
2
3const core = require('@actions/core')
4const fs = require('fs')
5
6const sarif = JSON.parse(fs.readFileSync(core.getInput('sarif-file'), 'utf8'))
7const rules = sarif.runs[0].tool.extensions.flatMap(ext => ext.rules || [])
8const ruleIds = rules.map(rule => rule.id)
9
10// Check that all the expected queries ran
11const expectedQueriesRun = getQueryIdsInput('queries-run')
12const queriesThatShouldHaveRunButDidNot = expectedQueriesRun.filter(queryId => !ruleIds.includes(queryId))
13
14if (queriesThatShouldHaveRunButDidNot.length > 0) {
15 core.setFailed(`The following queries were expected to run but did not: ${queriesThatShouldHaveRunButDidNot.join(', ')}`)
16}
17
⋯4 lines
22
23if (queriesThatShouldNotHaveRunButDid.length > 0) {
24 core.setFailed(`The following queries were NOT expected to have run but did: ${queriesThatShouldNotHaveRunButDid.join(', ')}`)
25}
26
27
28core.startGroup('All queries run')
29rules.forEach(rule => {
30 core.info(`${rule.id}: ${(rule.properties && rule.properties.name) || rule.name}`)
31})
32core.endGroup()
33
34core.startGroup('Full SARIF')
35core.info(JSON.stringify(sarif, null, 2))
36core.endGroup()
37
⋯6 lines
Parenthesized anonymous function opener git-utils.test.js · lines 14–24
14:36… lt", { enumerable: true, value: v });
15}) : function(o, v) {
16 o["default"] = v;
17});
18var __importStar = (this && this.__importStar) || (function () {
19 var ownKeys = function(o) {
20 ownKeys = Object.getOwnPropertyNames || function (o) {
21 var ar = [];
22 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23 return ar;
24 …
Calls JSON.stringify() git-utils.test.js · lines 172–181
172:40… sVars)(tmpDir, tmpDir);
173 const envFile = path.join(tmpDir, "event.json");
174 fs.writeFileSync(envFile, JSON.stringify({
175 repository: {
176 default_branch: "main",
⋯5 lines
Five numeric or wildcard cron-shaped fields git-utils.test.js · lines 187–192
187:11… .writeFileSync(envFile, JSON.stringify({
188 schedule: "0 0 * * *",
189 }));
190 process.env["GITHUB_EVENT_NAME"] = "schedule";
191 process.env["GITHUB_REF"] = "refs/heads/main";
192 …

Showing the top 5 files — 4 more files (80 regions) not shown.

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.