mirror of
https://github.com/github/codeql-action
synced 2026-10-07 00:30:17 +03:00
Update isVersionInfo validation function with check lambda
This commit is contained in:
Generated
+114
-49
@@ -19897,10 +19897,10 @@ var require_oidc_utils = __commonJS({
|
||||
var _a2;
|
||||
const httpclient = _OidcClient.createHttpClient();
|
||||
const res = yield httpclient.getJson(id_token_url).catch((error3) => {
|
||||
throw new Error(`Failed to get ID Token.
|
||||
|
||||
throw new Error(`Failed to get ID Token.
|
||||
|
||||
Error Code : ${error3.statusCode}
|
||||
|
||||
|
||||
Error Message: ${error3.message}`);
|
||||
});
|
||||
const id_token = (_a2 = res.result) === null || _a2 === void 0 ? void 0 : _a2.value;
|
||||
@@ -35739,7 +35739,7 @@ var require_restError = __commonJS({
|
||||
} : void 0;
|
||||
Object.defineProperty(this, inspect_js_1.custom, {
|
||||
value: () => {
|
||||
return `RestError: ${this.message}
|
||||
return `RestError: ${this.message}
|
||||
${errorSanitizer.sanitize({
|
||||
...this,
|
||||
request: { ...this.request, agent },
|
||||
@@ -75738,7 +75738,7 @@ var require_cacheHttpClient = __commonJS({
|
||||
const cacheListResult = response.result;
|
||||
const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount;
|
||||
if (totalCount && totalCount > 0) {
|
||||
core31.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env["GITHUB_REF"]}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
|
||||
core31.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env["GITHUB_REF"]}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
|
||||
Other caches with similar key:`);
|
||||
for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) {
|
||||
core31.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`);
|
||||
@@ -88178,9 +88178,9 @@ var require_path_and_artifact_name_validation = __commonJS({
|
||||
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactNameCharacters) {
|
||||
if (name.includes(invalidCharacterKey)) {
|
||||
throw new Error(`The artifact name is not valid: ${name}. Contains the following character: ${errorMessageForCharacter}
|
||||
|
||||
|
||||
Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values()).toString()}
|
||||
|
||||
|
||||
These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.`);
|
||||
}
|
||||
}
|
||||
@@ -88194,9 +88194,9 @@ These characters are not allowed in the artifact name due to limitations with ce
|
||||
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactFilePathCharacters) {
|
||||
if (path30.includes(invalidCharacterKey)) {
|
||||
throw new Error(`The path for one of the files in artifact is not valid: ${path30}. Contains the following character: ${errorMessageForCharacter}
|
||||
|
||||
|
||||
Invalid characters include: ${Array.from(invalidArtifactFilePathCharacters.values()).toString()}
|
||||
|
||||
|
||||
The following characters are not allowed in files that are uploaded due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.
|
||||
`);
|
||||
}
|
||||
@@ -119373,10 +119373,10 @@ var require_oidc_utils2 = __commonJS({
|
||||
return __awaiter2(this, void 0, void 0, function* () {
|
||||
const httpclient = _OidcClient.createHttpClient();
|
||||
const res = yield httpclient.getJson(id_token_url).catch((error3) => {
|
||||
throw new Error(`Failed to get ID Token.
|
||||
|
||||
throw new Error(`Failed to get ID Token.
|
||||
|
||||
Error Code : ${error3.statusCode}
|
||||
|
||||
|
||||
Error Message: ${error3.message}`);
|
||||
});
|
||||
const id_token = (_a2 = res.result) === null || _a2 === void 0 ? void 0 : _a2.value;
|
||||
@@ -121141,9 +121141,9 @@ var require_path_and_artifact_name_validation2 = __commonJS({
|
||||
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactNameCharacters) {
|
||||
if (name.includes(invalidCharacterKey)) {
|
||||
throw new Error(`Artifact name is not valid: ${name}. Contains the following character: ${errorMessageForCharacter}
|
||||
|
||||
|
||||
Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values()).toString()}
|
||||
|
||||
|
||||
These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.`);
|
||||
}
|
||||
}
|
||||
@@ -121157,9 +121157,9 @@ These characters are not allowed in the artifact name due to limitations with ce
|
||||
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactFilePathCharacters) {
|
||||
if (path30.includes(invalidCharacterKey)) {
|
||||
throw new Error(`Artifact path is not valid: ${path30}. Contains the following character: ${errorMessageForCharacter}
|
||||
|
||||
|
||||
Invalid characters include: ${Array.from(invalidArtifactFilePathCharacters.values()).toString()}
|
||||
|
||||
|
||||
The following characters are not allowed in files that are uploaded due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.
|
||||
`);
|
||||
}
|
||||
@@ -141805,7 +141805,7 @@ var intCoreTag = defineScalarTag("tag:yaml.org,2002:int", {
|
||||
..."0123456789"
|
||||
],
|
||||
resolve: resolveYamlInteger$2,
|
||||
identify: (object) => Object.prototype.toString.call(object) === "[object Number]" && object % 1 === 0 && !Object.is(object, -0),
|
||||
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
||||
represent: (object) => object.toString(10)
|
||||
});
|
||||
var YAML_INTEGER_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)$");
|
||||
@@ -141833,7 +141833,7 @@ var intJsonTag = defineScalarTag("tag:yaml.org,2002:int", {
|
||||
implicit: true,
|
||||
implicitFirstChars: ["-", ..."0123456789"],
|
||||
resolve: resolveYamlInteger$1,
|
||||
identify: (object) => Object.prototype.toString.call(object) === "[object Number]" && object % 1 === 0 && !Object.is(object, -0),
|
||||
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
||||
represent: (object) => object.toString(10)
|
||||
});
|
||||
var YAML_INTEGER_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");
|
||||
@@ -141867,7 +141867,7 @@ var intYaml11Tag = defineScalarTag("tag:yaml.org,2002:int", {
|
||||
..."0123456789"
|
||||
],
|
||||
resolve: resolveYamlInteger,
|
||||
identify: (object) => Object.prototype.toString.call(object) === "[object Number]" && object % 1 === 0 && !Object.is(object, -0),
|
||||
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
||||
represent: (object) => object.toString(10)
|
||||
});
|
||||
var YAML_FLOAT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
||||
@@ -141900,7 +141900,7 @@ var floatCoreTag = defineScalarTag("tag:yaml.org,2002:float", {
|
||||
..."0123456789"
|
||||
],
|
||||
resolve: resolveYamlFloat$2,
|
||||
identify: (object) => Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || Object.is(object, -0)),
|
||||
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
||||
represent: representYamlFloat$2
|
||||
});
|
||||
var YAML_FLOAT_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$");
|
||||
@@ -141933,7 +141933,7 @@ var floatJsonTag = defineScalarTag("tag:yaml.org,2002:float", {
|
||||
implicit: true,
|
||||
implicitFirstChars: ["-", ..."0123456789"],
|
||||
resolve: resolveYamlFloat$1,
|
||||
identify: (object) => Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || Object.is(object, -0)),
|
||||
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
||||
represent: representYamlFloat$1
|
||||
});
|
||||
var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
||||
@@ -141970,7 +141970,7 @@ var floatYaml11Tag = defineScalarTag("tag:yaml.org,2002:float", {
|
||||
..."0123456789"
|
||||
],
|
||||
resolve: resolveYamlFloat,
|
||||
identify: (object) => Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || Object.is(object, -0)),
|
||||
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
||||
represent: representYamlFloat
|
||||
});
|
||||
var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", {
|
||||
@@ -142669,7 +142669,8 @@ var DEFAULT_CONSTRUCTOR_OPTIONS = {
|
||||
filename: "",
|
||||
schema: CORE_SCHEMA,
|
||||
json: false,
|
||||
maxMergeSeqLength: 20
|
||||
maxTotalMergeKeys: 1e4,
|
||||
maxAliases: -1
|
||||
};
|
||||
function eventPosition$1(event) {
|
||||
if ("tagStart" in event && event.tagStart !== NO_RANGE$2) return event.tagStart;
|
||||
@@ -142757,6 +142758,7 @@ function isMappingTag(tag) {
|
||||
}
|
||||
function mergeKeys(state, frame, source, sourceTag) {
|
||||
for (const sourceKey of sourceTag.keys(source)) {
|
||||
if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) throwError$1(state, `merge keys exceeded maxTotalMergeKeys (${state.maxTotalMergeKeys})`);
|
||||
if (frame.tag.has(frame.value, sourceKey)) continue;
|
||||
const err = frame.tag.addPair(frame.value, sourceKey, sourceTag.get(source, sourceKey));
|
||||
if (err) throwError$1(state, err);
|
||||
@@ -142766,14 +142768,8 @@ function mergeKeys(state, frame, source, sourceTag) {
|
||||
function mergeSource(state, frame, source, sourceTag) {
|
||||
state.position = frame.keyPosition;
|
||||
if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag);
|
||||
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) {
|
||||
const seen = /* @__PURE__ */ new Set();
|
||||
for (const element of source) {
|
||||
if (seen.has(element)) continue;
|
||||
seen.add(element);
|
||||
mergeKeys(state, frame, element, frame.tag);
|
||||
}
|
||||
} else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
||||
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source) mergeKeys(state, frame, element, frame.tag);
|
||||
else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
||||
}
|
||||
function addMappingValue(state, frame, key, value, tag) {
|
||||
state.position = frame.keyPosition;
|
||||
@@ -142794,7 +142790,6 @@ function addValue(state, value, tag) {
|
||||
} else if (frame.kind === "sequence") {
|
||||
if (frame.merge) {
|
||||
if (!isMappingTag(tag)) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
||||
if (frame.index >= state.maxMergeSeqLength) throwError$1(state, `merge sequence length exceeded maxMergeSeqLength (${state.maxMergeSeqLength})`);
|
||||
}
|
||||
const err = frame.tag.addItem(frame.value, value, frame.index++);
|
||||
if (err) throwError$1(state, err);
|
||||
@@ -142831,7 +142826,9 @@ function constructFromEvents(events, options) {
|
||||
position: 0,
|
||||
frames: [],
|
||||
anchors: /* @__PURE__ */ new Map(),
|
||||
tagHandlers: /* @__PURE__ */ Object.create(null)
|
||||
tagHandlers: /* @__PURE__ */ Object.create(null),
|
||||
totalMergeKeys: 0,
|
||||
aliasCount: 0
|
||||
};
|
||||
while (state.eventIndex < state.events.length) {
|
||||
const event = state.events[state.eventIndex++];
|
||||
@@ -142839,6 +142836,7 @@ function constructFromEvents(events, options) {
|
||||
switch (event.type) {
|
||||
case 1:
|
||||
state.anchors = /* @__PURE__ */ new Map();
|
||||
state.aliasCount = 0;
|
||||
state.tagHandlers = /* @__PURE__ */ Object.create(null);
|
||||
for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix;
|
||||
state.frames.push({
|
||||
@@ -142889,6 +142887,7 @@ function constructFromEvents(events, options) {
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`);
|
||||
const name = state.source.slice(event.anchorStart, event.anchorEnd);
|
||||
const anchor = state.anchors.get(name);
|
||||
if (!anchor) throwError$1(state, `unidentified alias "${name}"`);
|
||||
@@ -144509,19 +144508,29 @@ function isNumber(value) {
|
||||
function isStringOrUndefined(value) {
|
||||
return value === void 0 || isString(value);
|
||||
}
|
||||
var string = {
|
||||
validate: isString,
|
||||
required: true
|
||||
};
|
||||
var number = {
|
||||
validate: isNumber,
|
||||
required: true
|
||||
};
|
||||
function defaultCheck(validate) {
|
||||
return (arg) => ({ unknownKeys: [], invalidKeys: [], valid: validate(arg) });
|
||||
}
|
||||
function makeValidator(validate, required = true) {
|
||||
return {
|
||||
validate,
|
||||
check: defaultCheck(validate),
|
||||
required
|
||||
};
|
||||
}
|
||||
var string = makeValidator(isString);
|
||||
var number = makeValidator(isNumber);
|
||||
function optionalOrNull(validator) {
|
||||
return {
|
||||
validate: (val) => {
|
||||
return val === void 0 || val === null || validator.validate(val);
|
||||
},
|
||||
check: (val, opts, path30) => {
|
||||
if (val === void 0 || val === null) {
|
||||
return successfulCheckSchema();
|
||||
}
|
||||
return validator.check(val, opts, path30);
|
||||
},
|
||||
required: false
|
||||
};
|
||||
}
|
||||
@@ -144530,23 +144539,72 @@ function optional(validator) {
|
||||
validate: (val) => {
|
||||
return val === void 0 || validator.validate(val);
|
||||
},
|
||||
check: (val, opts, path30) => {
|
||||
if (val === void 0) {
|
||||
return successfulCheckSchema();
|
||||
}
|
||||
return validator.check(val, opts, path30);
|
||||
},
|
||||
required: false
|
||||
};
|
||||
}
|
||||
function validateSchema(schema, obj) {
|
||||
const result = checkSchema(schema, obj, { failFast: true });
|
||||
return result.valid;
|
||||
}
|
||||
function successfulCheckSchema() {
|
||||
return {
|
||||
valid: true,
|
||||
unknownKeys: [],
|
||||
invalidKeys: []
|
||||
};
|
||||
}
|
||||
function checkSchema(schema, obj, options = {}, path30 = "") {
|
||||
const result = successfulCheckSchema();
|
||||
const inputKeys = new Set(Object.keys(obj));
|
||||
const invalidKeys = /* @__PURE__ */ new Set();
|
||||
for (const [key, validator] of Object.entries(schema)) {
|
||||
const hasKey = key in obj;
|
||||
inputKeys.delete(key);
|
||||
invalidKeys.add(key);
|
||||
if (validator.required && !hasKey) {
|
||||
return false;
|
||||
result.valid = false;
|
||||
if (options.failFast) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (validator.required && (obj[key] === void 0 || obj[key] === null)) {
|
||||
return false;
|
||||
result.valid = false;
|
||||
if (options.failFast) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (hasKey && !validator.validate(obj[key])) {
|
||||
return false;
|
||||
if (hasKey) {
|
||||
const checkResult = validator.check(obj[key], options, `${path30}.${key}`);
|
||||
result.unknownKeys.push(...checkResult.unknownKeys);
|
||||
result.invalidKeys.push(...checkResult.invalidKeys);
|
||||
if (checkResult.invalidKeys.length > 0) {
|
||||
invalidKeys.delete(key);
|
||||
}
|
||||
if (!checkResult.valid) {
|
||||
result.valid = false;
|
||||
if (options.failFast) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
invalidKeys.delete(key);
|
||||
}
|
||||
return true;
|
||||
for (const remainingKey of inputKeys) {
|
||||
result.unknownKeys.push(`${path30}.${remainingKey}`);
|
||||
}
|
||||
for (const invalidKey of invalidKeys) {
|
||||
result.invalidKeys.push(`${path30}.${invalidKey}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// src/util.ts
|
||||
@@ -145778,11 +145836,17 @@ var fs3 = __toESM(require("fs"));
|
||||
var path3 = __toESM(require("path"));
|
||||
var COMMAND_CACHE_FILENAME = "codeql-action-command-cache.json";
|
||||
function isVersionInfo(x) {
|
||||
const isBooleanRecord = (obj) => isObject(obj) && Object.values(obj).every((val) => typeof val === "boolean");
|
||||
return isObject(x) && validateSchema(
|
||||
{
|
||||
version: string,
|
||||
features: {
|
||||
validate: (obj) => isObject(obj) && Object.values(obj).every((val) => typeof val === "boolean"),
|
||||
validate: isBooleanRecord,
|
||||
check: (obj) => ({
|
||||
unknownKeys: [],
|
||||
invalidKeys: [],
|
||||
valid: isBooleanRecord(obj)
|
||||
}),
|
||||
required: false
|
||||
},
|
||||
overlayVersion: optional(number)
|
||||
@@ -161779,6 +161843,7 @@ function isPAT(value) {
|
||||
GITHUB_PAT_FINE_GRAINED_PATTERN
|
||||
]);
|
||||
}
|
||||
var ALWAYS_ENABLED_REGISTRY_TYPE = ["git_source"];
|
||||
var LANGUAGE_TO_REGISTRY_TYPE = {
|
||||
actions: [],
|
||||
cpp: [],
|
||||
@@ -161843,7 +161908,7 @@ function getCredentials(logger2, registrySecrets, registriesCredentials, languag
|
||||
}
|
||||
const authConfig = getAuthConfig(e);
|
||||
const address = getRegistryAddress(e);
|
||||
if (registryTypeForLanguage && !registryTypeForLanguage.some((t) => t === e.type)) {
|
||||
if (!ALWAYS_ENABLED_REGISTRY_TYPE.some((t) => t === e.type) && registryTypeForLanguage && !registryTypeForLanguage.some((t) => t === e.type)) {
|
||||
continue;
|
||||
}
|
||||
const isPrintable2 = (str) => {
|
||||
@@ -162776,7 +162841,7 @@ tmp/lib/tmp.js:
|
||||
*)
|
||||
|
||||
js-yaml/dist/js-yaml.mjs:
|
||||
(*! js-yaml 5.1.0 https://github.com/nodeca/js-yaml @license MIT *)
|
||||
(*! js-yaml 5.2.0 https://github.com/nodeca/js-yaml @license MIT *)
|
||||
|
||||
long/index.js:
|
||||
(**
|
||||
|
||||
+10
-3
@@ -33,15 +33,22 @@ export interface VersionInfo {
|
||||
|
||||
/** Returns true if `x` is a {@link VersionInfo}. */
|
||||
export function isVersionInfo(x: unknown): x is VersionInfo {
|
||||
const isBooleanRecord = (obj: unknown): obj is Record<string, boolean> =>
|
||||
json.isObject(obj) &&
|
||||
Object.values(obj).every((val) => typeof val === "boolean");
|
||||
|
||||
return (
|
||||
json.isObject(x) &&
|
||||
json.validateSchema(
|
||||
{
|
||||
version: json.string,
|
||||
features: {
|
||||
validate: (obj): obj is Record<string, boolean> =>
|
||||
json.isObject(obj) &&
|
||||
Object.values(obj).every((val) => typeof val === "boolean"),
|
||||
validate: isBooleanRecord,
|
||||
check: (obj) => ({
|
||||
unknownKeys: [],
|
||||
invalidKeys: [],
|
||||
valid: isBooleanRecord(obj),
|
||||
}),
|
||||
required: false,
|
||||
},
|
||||
overlayVersion: json.optional(json.number),
|
||||
|
||||
Reference in New Issue
Block a user