snyk 1.1278.0 → 1.1279.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/245.index.js +429 -2
- package/dist/cli/245.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +11 -2
- package/help/cli-commands/iac-test.md +4 -2
- package/help/cli-commands/monitor.md +2 -0
- package/help/cli-commands/test.md +2 -0
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +8 -8
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +8 -8
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/245.index.js
CHANGED
|
@@ -35940,6 +35940,343 @@ exports.execute = execute;
|
|
|
35940
35940
|
|
|
35941
35941
|
/***/ }),
|
|
35942
35942
|
|
|
35943
|
+
/***/ 13173:
|
|
35944
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
35945
|
+
|
|
35946
|
+
"use strict";
|
|
35947
|
+
|
|
35948
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
35949
|
+
exports.isDigest = exports.validateDigest = void 0;
|
|
35950
|
+
const regexp_1 = __webpack_require__(69292);
|
|
35951
|
+
class InvalidDigestFormatError extends Error {
|
|
35952
|
+
constructor() {
|
|
35953
|
+
super('invalid digest format');
|
|
35954
|
+
this.name = 'InvalidDigestFormatError';
|
|
35955
|
+
}
|
|
35956
|
+
}
|
|
35957
|
+
class UnsupportedAlgorithmError extends Error {
|
|
35958
|
+
constructor() {
|
|
35959
|
+
super('unsupported digest algorithm');
|
|
35960
|
+
this.name = 'UnsupportedAlgorithmError';
|
|
35961
|
+
}
|
|
35962
|
+
}
|
|
35963
|
+
class InvalidDigestLengthError extends Error {
|
|
35964
|
+
constructor() {
|
|
35965
|
+
super('invalid checksum digest length');
|
|
35966
|
+
this.name = 'InvalidDigestLengthError';
|
|
35967
|
+
}
|
|
35968
|
+
}
|
|
35969
|
+
const algorithmsSizes = {
|
|
35970
|
+
sha256: 32,
|
|
35971
|
+
sha384: 48,
|
|
35972
|
+
sha512: 64,
|
|
35973
|
+
};
|
|
35974
|
+
function checkDigest(digest, handleError) {
|
|
35975
|
+
const indexOfColon = digest.indexOf(':');
|
|
35976
|
+
if (indexOfColon < 0 ||
|
|
35977
|
+
indexOfColon + 1 === digest.length ||
|
|
35978
|
+
!regexp_1.anchoredDigestRegexp.test(digest)) {
|
|
35979
|
+
return handleError(InvalidDigestFormatError);
|
|
35980
|
+
}
|
|
35981
|
+
const algorithm = digest.substring(0, indexOfColon);
|
|
35982
|
+
if (!Object.hasOwnProperty.call(algorithmsSizes, algorithm)) {
|
|
35983
|
+
return handleError(UnsupportedAlgorithmError);
|
|
35984
|
+
}
|
|
35985
|
+
if (algorithmsSizes[algorithm] * 2 !== (digest.length - indexOfColon - 1)) {
|
|
35986
|
+
return handleError(InvalidDigestLengthError);
|
|
35987
|
+
}
|
|
35988
|
+
return true;
|
|
35989
|
+
}
|
|
35990
|
+
const validateDigest = (digest) => {
|
|
35991
|
+
checkDigest(digest, (ErrorType) => {
|
|
35992
|
+
throw new ErrorType();
|
|
35993
|
+
});
|
|
35994
|
+
};
|
|
35995
|
+
exports.validateDigest = validateDigest;
|
|
35996
|
+
const isDigest = (digest) => {
|
|
35997
|
+
return checkDigest(digest, () => false);
|
|
35998
|
+
};
|
|
35999
|
+
exports.isDigest = isDigest;
|
|
36000
|
+
//# sourceMappingURL=digest.js.map
|
|
36001
|
+
|
|
36002
|
+
/***/ }),
|
|
36003
|
+
|
|
36004
|
+
/***/ 3687:
|
|
36005
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
36006
|
+
|
|
36007
|
+
"use strict";
|
|
36008
|
+
|
|
36009
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
36010
|
+
exports.parseAll = exports.parseFamiliarName = exports.parseQualifiedNameOptimized = exports.parseQualifiedName = exports.Reference = void 0;
|
|
36011
|
+
const reference_1 = __webpack_require__(12792);
|
|
36012
|
+
Object.defineProperty(exports, "Reference", ({ enumerable: true, get: function () { return reference_1.Reference; } }));
|
|
36013
|
+
const parsers_1 = __webpack_require__(57094);
|
|
36014
|
+
Object.defineProperty(exports, "parseAll", ({ enumerable: true, get: function () { return parsers_1.parseAll; } }));
|
|
36015
|
+
Object.defineProperty(exports, "parseFamiliarName", ({ enumerable: true, get: function () { return parsers_1.parseFamiliarName; } }));
|
|
36016
|
+
Object.defineProperty(exports, "parseQualifiedName", ({ enumerable: true, get: function () { return parsers_1.parseQualifiedName; } }));
|
|
36017
|
+
Object.defineProperty(exports, "parseQualifiedNameOptimized", ({ enumerable: true, get: function () { return parsers_1.parseQualifiedNameOptimized; } }));
|
|
36018
|
+
//# sourceMappingURL=index.js.map
|
|
36019
|
+
|
|
36020
|
+
/***/ }),
|
|
36021
|
+
|
|
36022
|
+
/***/ 57094:
|
|
36023
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
36024
|
+
|
|
36025
|
+
"use strict";
|
|
36026
|
+
|
|
36027
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
36028
|
+
exports.parseAll = exports.parseFamiliarName = exports.parseQualifiedName = exports.parseQualifiedNameOptimized = void 0;
|
|
36029
|
+
const regexp_1 = __webpack_require__(69292);
|
|
36030
|
+
const digest_1 = __webpack_require__(13173);
|
|
36031
|
+
const reference_1 = __webpack_require__(12792);
|
|
36032
|
+
const NAME_MAX_LENGTH = 255;
|
|
36033
|
+
class InvalidReferenceFormatError extends Error {
|
|
36034
|
+
constructor() {
|
|
36035
|
+
super("invalid reference format");
|
|
36036
|
+
this.name = "InvalidReferenceFormatError";
|
|
36037
|
+
}
|
|
36038
|
+
}
|
|
36039
|
+
class NameContainsUppercaseError extends Error {
|
|
36040
|
+
constructor() {
|
|
36041
|
+
super("repository name must be lowercase");
|
|
36042
|
+
this.name = "NameContainsUppercaseError";
|
|
36043
|
+
}
|
|
36044
|
+
}
|
|
36045
|
+
class EmptyNameError extends Error {
|
|
36046
|
+
constructor() {
|
|
36047
|
+
super("repository name must have at least one component");
|
|
36048
|
+
this.name = "EmptyNameError";
|
|
36049
|
+
}
|
|
36050
|
+
}
|
|
36051
|
+
class NameTooLongError extends Error {
|
|
36052
|
+
constructor() {
|
|
36053
|
+
super(`repository name must not be more than ${NAME_MAX_LENGTH} characters`);
|
|
36054
|
+
this.name = "NameTooLongError";
|
|
36055
|
+
}
|
|
36056
|
+
}
|
|
36057
|
+
const DEFAULT_DOMAIN = "docker.io";
|
|
36058
|
+
const LEGACY_DEFAULT_DOMAIN = "index.docker.io";
|
|
36059
|
+
const OFFICIAL_REPOSITORY_NAME = "library";
|
|
36060
|
+
function _parseQualifiedName(regexp, name) {
|
|
36061
|
+
const matches = regexp.exec(name);
|
|
36062
|
+
if (!matches) {
|
|
36063
|
+
if (name === "") {
|
|
36064
|
+
throw new EmptyNameError();
|
|
36065
|
+
}
|
|
36066
|
+
if (regexp.test(name.toLowerCase())) {
|
|
36067
|
+
throw new NameContainsUppercaseError();
|
|
36068
|
+
}
|
|
36069
|
+
throw new InvalidReferenceFormatError();
|
|
36070
|
+
}
|
|
36071
|
+
if (matches[1].length > NAME_MAX_LENGTH) {
|
|
36072
|
+
throw new NameTooLongError();
|
|
36073
|
+
}
|
|
36074
|
+
let reference;
|
|
36075
|
+
const nameMatch = regexp_1.anchoredNameRegexp.exec(matches[1]);
|
|
36076
|
+
if (nameMatch && nameMatch.length === 3) {
|
|
36077
|
+
reference = {
|
|
36078
|
+
domain: nameMatch[1],
|
|
36079
|
+
repository: nameMatch[2],
|
|
36080
|
+
};
|
|
36081
|
+
}
|
|
36082
|
+
else {
|
|
36083
|
+
reference = {
|
|
36084
|
+
domain: "",
|
|
36085
|
+
repository: matches[1],
|
|
36086
|
+
};
|
|
36087
|
+
}
|
|
36088
|
+
reference.tag = matches[2];
|
|
36089
|
+
if (matches[3]) {
|
|
36090
|
+
(0, digest_1.validateDigest)(matches[3]);
|
|
36091
|
+
reference.digest = matches[3];
|
|
36092
|
+
}
|
|
36093
|
+
return new reference_1.Reference(reference);
|
|
36094
|
+
}
|
|
36095
|
+
const parseQualifiedNameOptimized = (name) => {
|
|
36096
|
+
return _parseQualifiedName(new RegExp(regexp_1.referenceRegexp), name);
|
|
36097
|
+
};
|
|
36098
|
+
exports.parseQualifiedNameOptimized = parseQualifiedNameOptimized;
|
|
36099
|
+
const parseQualifiedName = (name) => {
|
|
36100
|
+
return _parseQualifiedName(regexp_1.referenceRegexp, name);
|
|
36101
|
+
};
|
|
36102
|
+
exports.parseQualifiedName = parseQualifiedName;
|
|
36103
|
+
function splitDockerDomain(name) {
|
|
36104
|
+
let domain;
|
|
36105
|
+
let reminder;
|
|
36106
|
+
const indexOfSlash = name.indexOf("/");
|
|
36107
|
+
if (indexOfSlash === -1 ||
|
|
36108
|
+
!(name.lastIndexOf(".", indexOfSlash) !== -1 ||
|
|
36109
|
+
name.lastIndexOf(":", indexOfSlash) !== -1 ||
|
|
36110
|
+
name.startsWith("localhost/"))) {
|
|
36111
|
+
domain = DEFAULT_DOMAIN;
|
|
36112
|
+
reminder = name;
|
|
36113
|
+
}
|
|
36114
|
+
else {
|
|
36115
|
+
domain = name.substring(0, indexOfSlash);
|
|
36116
|
+
reminder = name.substring(indexOfSlash + 1);
|
|
36117
|
+
}
|
|
36118
|
+
if (domain === LEGACY_DEFAULT_DOMAIN) {
|
|
36119
|
+
domain = DEFAULT_DOMAIN;
|
|
36120
|
+
}
|
|
36121
|
+
if (domain === DEFAULT_DOMAIN && !reminder.includes("/")) {
|
|
36122
|
+
reminder = `${OFFICIAL_REPOSITORY_NAME}/${reminder}`;
|
|
36123
|
+
}
|
|
36124
|
+
return [domain, reminder];
|
|
36125
|
+
}
|
|
36126
|
+
const parseFamiliarName = (name, parseQualifiedNameFunc) => {
|
|
36127
|
+
if (regexp_1.anchoredIdentifierRegexp.test(name)) {
|
|
36128
|
+
throw new TypeError(`invalid repository name (${name}),` +
|
|
36129
|
+
`cannot specify 64-byte hexadecimal strings`);
|
|
36130
|
+
}
|
|
36131
|
+
const [domain, remainder] = splitDockerDomain(name);
|
|
36132
|
+
let remoteName;
|
|
36133
|
+
const tagSeparatorIndex = remainder.indexOf(":");
|
|
36134
|
+
if (tagSeparatorIndex > -1) {
|
|
36135
|
+
remoteName = remainder.substring(0, tagSeparatorIndex);
|
|
36136
|
+
}
|
|
36137
|
+
else {
|
|
36138
|
+
remoteName = remainder;
|
|
36139
|
+
}
|
|
36140
|
+
if (remoteName.toLowerCase() !== remoteName) {
|
|
36141
|
+
throw new TypeError(`invalid reference format: repository name must be lowercase`);
|
|
36142
|
+
}
|
|
36143
|
+
if (parseQualifiedNameFunc) {
|
|
36144
|
+
return parseQualifiedNameFunc(`${domain}/${remainder}`);
|
|
36145
|
+
}
|
|
36146
|
+
return parseQualifiedName(`${domain}/${remainder}`);
|
|
36147
|
+
};
|
|
36148
|
+
exports.parseFamiliarName = parseFamiliarName;
|
|
36149
|
+
const parseAll = (name) => {
|
|
36150
|
+
if (regexp_1.anchoredIdentifierRegexp.test(name)) {
|
|
36151
|
+
return new reference_1.Reference({ digest: `sha256:${name}` });
|
|
36152
|
+
}
|
|
36153
|
+
if ((0, digest_1.isDigest)(name)) {
|
|
36154
|
+
return new reference_1.Reference({ digest: name });
|
|
36155
|
+
}
|
|
36156
|
+
return parseFamiliarName(name);
|
|
36157
|
+
};
|
|
36158
|
+
exports.parseAll = parseAll;
|
|
36159
|
+
//# sourceMappingURL=parsers.js.map
|
|
36160
|
+
|
|
36161
|
+
/***/ }),
|
|
36162
|
+
|
|
36163
|
+
/***/ 12792:
|
|
36164
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
36165
|
+
|
|
36166
|
+
"use strict";
|
|
36167
|
+
|
|
36168
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
36169
|
+
exports.Reference = void 0;
|
|
36170
|
+
const typesTemplates = {
|
|
36171
|
+
'digest': (ref) => `${ref.digest}`,
|
|
36172
|
+
'canonical': (ref) => `${ref.repositoryUrl}@${ref.digest}`,
|
|
36173
|
+
'repository': (ref) => `${ref.repositoryUrl}`,
|
|
36174
|
+
'tagged': (ref) => `${ref.repositoryUrl}:${ref.tag}`,
|
|
36175
|
+
'dual': (ref) => `${ref.repositoryUrl}:${ref.tag}@${ref.digest}`
|
|
36176
|
+
};
|
|
36177
|
+
class Reference {
|
|
36178
|
+
get tag() {
|
|
36179
|
+
return this._tag;
|
|
36180
|
+
}
|
|
36181
|
+
get digest() {
|
|
36182
|
+
return this._digest;
|
|
36183
|
+
}
|
|
36184
|
+
get repository() {
|
|
36185
|
+
return this._repository;
|
|
36186
|
+
}
|
|
36187
|
+
get domain() {
|
|
36188
|
+
return this._domain;
|
|
36189
|
+
}
|
|
36190
|
+
get type() {
|
|
36191
|
+
return this._type;
|
|
36192
|
+
}
|
|
36193
|
+
constructor(options) {
|
|
36194
|
+
var _a, _b, _c, _d, _e, _f;
|
|
36195
|
+
if (!options.repository && !options.domain) {
|
|
36196
|
+
if (options.digest) {
|
|
36197
|
+
this._digest = options.digest;
|
|
36198
|
+
this._type = 'digest';
|
|
36199
|
+
}
|
|
36200
|
+
else {
|
|
36201
|
+
throw new TypeError('Empty Reference');
|
|
36202
|
+
}
|
|
36203
|
+
}
|
|
36204
|
+
else if (!options.tag) {
|
|
36205
|
+
this._domain = (_a = options.domain) !== null && _a !== void 0 ? _a : '';
|
|
36206
|
+
this._repository = (_b = options.repository) !== null && _b !== void 0 ? _b : '';
|
|
36207
|
+
if (options.digest) {
|
|
36208
|
+
this._digest = options.digest;
|
|
36209
|
+
this._type = 'canonical';
|
|
36210
|
+
}
|
|
36211
|
+
else {
|
|
36212
|
+
this._type = 'repository';
|
|
36213
|
+
}
|
|
36214
|
+
}
|
|
36215
|
+
else if (!options.digest) {
|
|
36216
|
+
this._domain = (_c = options.domain) !== null && _c !== void 0 ? _c : '';
|
|
36217
|
+
this._repository = (_d = options.repository) !== null && _d !== void 0 ? _d : '';
|
|
36218
|
+
this._tag = options.tag;
|
|
36219
|
+
this._type = 'tagged';
|
|
36220
|
+
}
|
|
36221
|
+
else {
|
|
36222
|
+
this._domain = (_e = options.domain) !== null && _e !== void 0 ? _e : '';
|
|
36223
|
+
this._repository = (_f = options.repository) !== null && _f !== void 0 ? _f : '';
|
|
36224
|
+
this._tag = options.tag;
|
|
36225
|
+
this._digest = options.digest;
|
|
36226
|
+
this._type = 'dual';
|
|
36227
|
+
}
|
|
36228
|
+
}
|
|
36229
|
+
toString() {
|
|
36230
|
+
return typesTemplates[this._type](this);
|
|
36231
|
+
}
|
|
36232
|
+
get repositoryUrl() {
|
|
36233
|
+
if (this._domain && this._repository) {
|
|
36234
|
+
return `${this._domain}/${this._repository}`;
|
|
36235
|
+
}
|
|
36236
|
+
return '';
|
|
36237
|
+
}
|
|
36238
|
+
}
|
|
36239
|
+
exports.Reference = Reference;
|
|
36240
|
+
//# sourceMappingURL=reference.js.map
|
|
36241
|
+
|
|
36242
|
+
/***/ }),
|
|
36243
|
+
|
|
36244
|
+
/***/ 69292:
|
|
36245
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
36246
|
+
|
|
36247
|
+
"use strict";
|
|
36248
|
+
|
|
36249
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
36250
|
+
exports.anchoredIdentifierRegexp = exports.anchoredDigestRegexp = exports.anchoredNameRegexp = exports.referenceRegexp = void 0;
|
|
36251
|
+
const expression = (...regexps) => new RegExp(regexps
|
|
36252
|
+
.map(re => re.source)
|
|
36253
|
+
.join(''));
|
|
36254
|
+
const group = (...regexps) => new RegExp(`(?:${expression(...regexps).source})`);
|
|
36255
|
+
const optional = (...regexps) => new RegExp(`${group(...regexps).source}?`);
|
|
36256
|
+
const repeated = (...regexps) => new RegExp(`${group(...regexps).source}+`);
|
|
36257
|
+
const anchored = (...regexps) => new RegExp(`^${expression(...regexps).source}$`);
|
|
36258
|
+
const capture = (...regexps) => new RegExp(`(${expression(...regexps).source})`);
|
|
36259
|
+
const alphaNumericRegexp = /[a-z0-9]+/;
|
|
36260
|
+
const separatorRegexp = /(?:[._]|__|[-]*)/;
|
|
36261
|
+
const nameComponentRegexp = expression(alphaNumericRegexp, optional(repeated(separatorRegexp, alphaNumericRegexp)));
|
|
36262
|
+
const domainComponentRegexp = /(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/;
|
|
36263
|
+
const domainRegexp = expression(domainComponentRegexp, optional(repeated(/\./, domainComponentRegexp)), optional(/:/, /[0-9]+/));
|
|
36264
|
+
const tagRegexp = /[\w][\w.-]{0,127}/;
|
|
36265
|
+
const digestRegexp = /[a-zA-Z][a-zA-Z0-9]*(?:[-_+.][a-zA-Z][a-zA-Z0-9]*)*[:][a-fA-F0-9]{32,}/;
|
|
36266
|
+
const anchoredDigestRegexp = anchored(digestRegexp);
|
|
36267
|
+
exports.anchoredDigestRegexp = anchoredDigestRegexp;
|
|
36268
|
+
const nameRegexp = expression(optional(domainRegexp, /\//), nameComponentRegexp, optional(repeated(/\//, nameComponentRegexp)));
|
|
36269
|
+
const anchoredNameRegexp = anchored(optional(capture(domainRegexp), /\//), capture(nameComponentRegexp, optional(repeated(/\//, nameComponentRegexp))));
|
|
36270
|
+
exports.anchoredNameRegexp = anchoredNameRegexp;
|
|
36271
|
+
const referenceRegexp = anchored(capture(nameRegexp), optional(/:/, capture(tagRegexp)), optional(/@/, capture(digestRegexp)));
|
|
36272
|
+
exports.referenceRegexp = referenceRegexp;
|
|
36273
|
+
const identifierRegexp = /[a-f0-9]{64}/;
|
|
36274
|
+
const anchoredIdentifierRegexp = anchored(identifierRegexp);
|
|
36275
|
+
exports.anchoredIdentifierRegexp = anchoredIdentifierRegexp;
|
|
36276
|
+
//# sourceMappingURL=regexp.js.map
|
|
36277
|
+
|
|
36278
|
+
/***/ }),
|
|
36279
|
+
|
|
35943
36280
|
/***/ 60081:
|
|
35944
36281
|
/***/ ((module, exports, __webpack_require__) => {
|
|
35945
36282
|
|
|
@@ -189443,6 +189780,13 @@ function extractHostnameFromTargetImage(targetImage) {
|
|
|
189443
189780
|
if (!isImagePartOfURL(targetImage)) {
|
|
189444
189781
|
return { hostname: defaultHostname, remainder: targetImage };
|
|
189445
189782
|
}
|
|
189783
|
+
const dockerFriendlyRegistryHostname = "docker.io/";
|
|
189784
|
+
if (targetImage.startsWith(dockerFriendlyRegistryHostname)) {
|
|
189785
|
+
return {
|
|
189786
|
+
hostname: defaultHostname,
|
|
189787
|
+
remainder: targetImage.substring(dockerFriendlyRegistryHostname.length),
|
|
189788
|
+
};
|
|
189789
|
+
}
|
|
189446
189790
|
const i = targetImage.indexOf("/");
|
|
189447
189791
|
return {
|
|
189448
189792
|
hostname: targetImage.substring(0, i),
|
|
@@ -191806,6 +192150,72 @@ function isMainIndexFile(name) {
|
|
|
191806
192150
|
|
|
191807
192151
|
/***/ }),
|
|
191808
192152
|
|
|
192153
|
+
/***/ 19103:
|
|
192154
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
192155
|
+
|
|
192156
|
+
"use strict";
|
|
192157
|
+
|
|
192158
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
192159
|
+
exports.constructOCIDisributionMetadata = void 0;
|
|
192160
|
+
const docker_reference_1 = __webpack_require__(3687);
|
|
192161
|
+
function constructOCIDisributionMetadata({ imageName, manifestDigest, indexDigest, }) {
|
|
192162
|
+
try {
|
|
192163
|
+
const ref = (0, docker_reference_1.parseAll)(imageName);
|
|
192164
|
+
if (!ref.domain || !ref.repository) {
|
|
192165
|
+
return;
|
|
192166
|
+
}
|
|
192167
|
+
const metadata = {
|
|
192168
|
+
registryHost: ref.domain,
|
|
192169
|
+
repository: ref.repository,
|
|
192170
|
+
manifestDigest,
|
|
192171
|
+
indexDigest,
|
|
192172
|
+
imageTag: ref.tag,
|
|
192173
|
+
};
|
|
192174
|
+
if (!ociDistributionMetadataIsValid(metadata)) {
|
|
192175
|
+
return;
|
|
192176
|
+
}
|
|
192177
|
+
return metadata;
|
|
192178
|
+
}
|
|
192179
|
+
catch (_a) {
|
|
192180
|
+
return;
|
|
192181
|
+
}
|
|
192182
|
+
}
|
|
192183
|
+
exports.constructOCIDisributionMetadata = constructOCIDisributionMetadata;
|
|
192184
|
+
function ociDistributionMetadataIsValid(data) {
|
|
192185
|
+
// 255 byte limit is enforced by RFC 1035.
|
|
192186
|
+
if (Buffer.byteLength(data.registryHost) > 255) {
|
|
192187
|
+
return false;
|
|
192188
|
+
}
|
|
192189
|
+
// 2048 byte limit is enforced by Snyk for platform stability.
|
|
192190
|
+
// Longer strings may be valid, but nothing close to this limit has been observed by Snyk at time of writing.
|
|
192191
|
+
if (Buffer.byteLength(data.repository) > 2048 ||
|
|
192192
|
+
!repositoryNameIsValid(data.repository)) {
|
|
192193
|
+
return false;
|
|
192194
|
+
}
|
|
192195
|
+
if (!digestIsValid(data.manifestDigest)) {
|
|
192196
|
+
return false;
|
|
192197
|
+
}
|
|
192198
|
+
if (data.indexDigest && !digestIsValid(data.indexDigest)) {
|
|
192199
|
+
return false;
|
|
192200
|
+
}
|
|
192201
|
+
if (data.imageTag && !tagIsValid(data.imageTag)) {
|
|
192202
|
+
return false;
|
|
192203
|
+
}
|
|
192204
|
+
return true;
|
|
192205
|
+
}
|
|
192206
|
+
// Regular Expression Source: OCI Distribution Spec V1
|
|
192207
|
+
// https://github.com/opencontainers/distribution-spec/blob/570d0262abe8ec5e59d8e3fbbd7be4bd784b200e/spec.md?plain=1#L141
|
|
192208
|
+
const repositoryNameIsValid = (name) => /^[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(\/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*$/.test(name);
|
|
192209
|
+
// Regular Expression Source: OCI Image Spec V1
|
|
192210
|
+
// https://github.com/opencontainers/image-spec/blob/d60099175f88c47cd379c4738d158884749ed235/descriptor.md?plain=1#L143
|
|
192211
|
+
const digestIsValid = (digest) => /^sha256:[a-f0-9]{64}$/.test(digest);
|
|
192212
|
+
// Regular Expression Source: OCI Image Spec V1
|
|
192213
|
+
// https://github.com/opencontainers/distribution-spec/blob/3940529fe6c0a068290b27fb3cd797cf0528bed6/spec.md?plain=1#L160
|
|
192214
|
+
const tagIsValid = (tag) => /^[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}$/.test(tag);
|
|
192215
|
+
//# sourceMappingURL=oci-distribution-metadata.js.map
|
|
192216
|
+
|
|
192217
|
+
/***/ }),
|
|
192218
|
+
|
|
191809
192219
|
/***/ 86666:
|
|
191810
192220
|
/***/ ((__unused_webpack_module, exports) => {
|
|
191811
192221
|
|
|
@@ -193456,7 +193866,7 @@ const dep_graph_1 = __webpack_require__(71479);
|
|
|
193456
193866
|
// Module that provides functions to collect and build response after all
|
|
193457
193867
|
// analyses' are done.
|
|
193458
193868
|
const dockerfile_1 = __webpack_require__(79652);
|
|
193459
|
-
async function buildResponse(depsAnalysis, dockerfileAnalysis, excludeBaseImageVulns, names) {
|
|
193869
|
+
async function buildResponse(depsAnalysis, dockerfileAnalysis, excludeBaseImageVulns, names, ociDistributionMetadata) {
|
|
193460
193870
|
var _a, _b;
|
|
193461
193871
|
const deps = depsAnalysis.depTree.dependencies;
|
|
193462
193872
|
const dockerfilePkgs = collectDockerfilePkgs(dockerfileAnalysis, deps);
|
|
@@ -193580,6 +193990,13 @@ async function buildResponse(depsAnalysis, dockerfileAnalysis, excludeBaseImageV
|
|
|
193580
193990
|
additionalFacts.push(imageNamesFact);
|
|
193581
193991
|
}
|
|
193582
193992
|
}
|
|
193993
|
+
if (ociDistributionMetadata) {
|
|
193994
|
+
const metadataFact = {
|
|
193995
|
+
type: "ociDistributionMetadata",
|
|
193996
|
+
data: ociDistributionMetadata,
|
|
193997
|
+
};
|
|
193998
|
+
additionalFacts.push(metadataFact);
|
|
193999
|
+
}
|
|
193583
194000
|
const scanResults = [
|
|
193584
194001
|
{
|
|
193585
194002
|
facts: [depGraphFact, ...additionalFacts],
|
|
@@ -193794,10 +194211,12 @@ exports.analyzeStatically = void 0;
|
|
|
193794
194211
|
const analyzer = __webpack_require__(55269);
|
|
193795
194212
|
const dependency_tree_1 = __webpack_require__(95997);
|
|
193796
194213
|
const image_1 = __webpack_require__(92748);
|
|
194214
|
+
const oci_distribution_metadata_1 = __webpack_require__(19103);
|
|
193797
194215
|
const option_utils_1 = __webpack_require__(48587);
|
|
193798
194216
|
const parser_1 = __webpack_require__(45062);
|
|
193799
194217
|
const response_builder_1 = __webpack_require__(75319);
|
|
193800
194218
|
async function analyzeStatically(targetImage, dockerfileAnalysis, imageType, imagePath, globsToFind, options, imageName) {
|
|
194219
|
+
var _a;
|
|
193801
194220
|
const staticAnalysis = await analyzer.analyzeStatically(targetImage, dockerfileAnalysis, imageType, imagePath, globsToFind, options);
|
|
193802
194221
|
const parsedAnalysisResult = (0, parser_1.parseAnalysisResults)(targetImage, staticAnalysis);
|
|
193803
194222
|
/** @deprecated Should try to build a dependency graph instead. */
|
|
@@ -193805,7 +194224,15 @@ async function analyzeStatically(targetImage, dockerfileAnalysis, imageType, ima
|
|
|
193805
194224
|
const analysis = Object.assign(Object.assign({}, staticAnalysis), { depTree: dependenciesTree, imageId: parsedAnalysisResult.imageId, imageLayers: parsedAnalysisResult.imageLayers, packageFormat: parsedAnalysisResult.packageFormat });
|
|
193806
194225
|
const excludeBaseImageVulns = (0, option_utils_1.isTrue)(options["exclude-base-image-vulns"]);
|
|
193807
194226
|
const names = (0, image_1.getImageNames)(options, imageName);
|
|
193808
|
-
|
|
194227
|
+
let ociDistributionMetadata;
|
|
194228
|
+
if (options.imageNameAndTag && ((_a = options.digests) === null || _a === void 0 ? void 0 : _a.manifest)) {
|
|
194229
|
+
ociDistributionMetadata = (0, oci_distribution_metadata_1.constructOCIDisributionMetadata)({
|
|
194230
|
+
imageName: options.imageNameAndTag,
|
|
194231
|
+
manifestDigest: options.digests.manifest,
|
|
194232
|
+
indexDigest: options.digests.index,
|
|
194233
|
+
});
|
|
194234
|
+
}
|
|
194235
|
+
return (0, response_builder_1.buildResponse)(analysis, dockerfileAnalysis, excludeBaseImageVulns, names, ociDistributionMetadata);
|
|
193809
194236
|
}
|
|
193810
194237
|
exports.analyzeStatically = analyzeStatically;
|
|
193811
194238
|
//# sourceMappingURL=static.js.map
|