This commit is contained in:
2026-04-07 14:50:23 +09:00
commit b4e485502b
4778 changed files with 2017091 additions and 0 deletions

10
safekiso-server/node_modules/snyk/dist/lib/alerts.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
export type AlertType = 'info' | 'warning' | 'error';
export interface Alert {
type: AlertType;
name: string;
msg: string;
}
declare function registerAlerts(alerts: Alert[]): void;
declare function hasAlert(name: string): boolean;
declare function displayAlerts(): string;
export { registerAlerts, hasAlert, displayAlerts };

View File

@@ -0,0 +1,3 @@
import { StandardAnalyticsData } from './types';
import { ArgsOptions } from '../../cli/args';
export declare function getStandardData(args: ArgsOptions[]): Promise<StandardAnalyticsData>;

View File

@@ -0,0 +1,18 @@
import * as needle from 'needle';
/**
*
* @param data the data to merge into that data which has been staged thus far (with the {@link add} function)
* and then sent to the backend.
*/
export declare function addDataAndSend(data: any): Promise<void | {
res: needle.NeedleResponse;
body: any;
}>;
export declare function allowAnalytics(): boolean;
/**
* Adds a key-value pair to the analytics data `metadata` field. This doesn't send the analytics, just stages it for
* sending later (via the {@link addDataAndSend} function).
* @param key
* @param value
*/
export declare function add(key: string, value: unknown): void;

View File

@@ -0,0 +1,14 @@
import { ArgsOptions } from '../../cli/args';
export declare const INTEGRATION_NAME_ENVVAR = "SNYK_INTEGRATION_NAME";
export declare const INTEGRATION_VERSION_ENVVAR = "SNYK_INTEGRATION_VERSION";
export declare const INTEGRATION_ENVIRONMENT_ENVVAR = "SNYK_INTEGRATION_ENVIRONMENT";
export declare const INTEGRATION_ENVIRONMENT_VERSION_ENVVAR = "SNYK_INTEGRATION_ENVIRONMENT_VERSION";
export declare const getIntegrationName: (args: ArgsOptions[]) => string;
export declare const getIntegrationVersion: (args: ArgsOptions[]) => string;
export declare const getIntegrationEnvironment: (args: ArgsOptions[]) => string;
export declare const getIntegrationEnvironmentVersion: (args: ArgsOptions[]) => string;
export declare function isScoop(): boolean;
export declare function validateScoopManifestFile(snykExecutablePath: string): boolean;
export declare function isHomebrew(): boolean;
export declare function validateHomebrew(snykExecutablePath: string): boolean;
export declare function isInstalled(commandToCheck: string): Promise<boolean>;

View File

@@ -0,0 +1,14 @@
export type StandardAnalyticsData = {
version: string;
os: string;
nodeVersion: string;
standalone: boolean;
integrationName: string;
integrationVersion: string;
integrationEnvironment: string;
integrationEnvironmentVersion: string;
id: string;
ci: boolean;
durationMs: number;
metrics: any[] | undefined;
};

View File

@@ -0,0 +1,7 @@
export declare function api(): string | undefined;
export declare function getOAuthToken(): string | undefined;
export declare function getDockerToken(): string | undefined;
export declare function apiTokenExists(): string;
export declare function apiOrOAuthTokenExists(): string;
export declare function getAuthHeader(): string;
export declare function someTokenExists(): boolean;

View File

@@ -0,0 +1,44 @@
export declare const SNYK_APP_NAME = "snykAppName";
export declare const SNYK_APP_REDIRECT_URIS = "snykAppRedirectUris";
export declare const SNYK_APP_SCOPES = "snykAppScopes";
export declare const SNYK_APP_CLIENT_ID = "snykAppClientId";
export declare const SNYK_APP_ORG_ID = "snykAppOrgId";
export declare const SNYK_APP_CONTEXT = "context";
export declare const SNYK_APP_DEBUG = "snyk:apps";
export declare enum EValidSubCommands {
CREATE = "create"
}
export declare enum EAppsURL {
CREATE_APP = 0
}
export declare const validAppsSubCommands: string[];
export declare const AppsErrorMessages: {
orgRequired: string;
nameRequired: string;
redirectUrisRequired: string;
scopesRequired: string;
invalidContext: string;
useExperimental: string;
};
export declare const CreateAppPromptData: {
SNYK_APP_NAME: {
name: string;
message: string;
};
SNYK_APP_REDIRECT_URIS: {
name: string;
message: string;
};
SNYK_APP_SCOPES: {
name: string;
message: string;
};
SNYK_APP_ORG_ID: {
name: string;
message: string;
};
SNYK_APP_CONTEXT: {
name: string;
message: string;
};
};

View File

@@ -0,0 +1,9 @@
import { ICreateAppRequest, ICreateAppOptions } from '..';
/**
* Validates and parsed the data required to create app.
* Throws error if option is not provided or is invalid
* @param {ICreateAppOptions} options required to create an app
* @returns {ICreateAppRequest} data that is used to make the request
*/
export declare function createAppDataScriptable(options: ICreateAppOptions): ICreateAppRequest;
export declare function createAppDataInteractive(): Promise<ICreateAppRequest>;

View File

@@ -0,0 +1,6 @@
export * from './constants';
export * from './prompts';
export * from './types';
export * from './rest-utils';
export * from './utils';
export * from './input-validator';

View File

@@ -0,0 +1,33 @@
/**
*
* @param {String} input of space separated URL/URI passed by
* user for redirect URIs
* @returns { String | Boolean } complying with enquirer return values, the function
* separates the string on space and validates each to see
* if a valid URL/URI. Return a string if invalid and
* boolean true if valid
*/
export declare function validateAllURL(input: string): string | boolean;
/**
* Custom validation logic which takes in consideration
* creation of Snyk Apps and thus allows localhost.com
* as a valid URL.
* @param {String} input of URI/URL value to validate using
* regex
* @returns {String | Boolean } string message is not valid
* and boolean true if valid
*/
export declare function validURL(input: string): boolean | string;
/**
* Function validates if a valid UUID (version of UUID not tacken into account)
* @param {String} input UUID to be validated
* @returns {String | Boolean } string message is not valid
* and boolean true if valid
*/
export declare function validateUUID(input: string): boolean | string;
/**
* @param {String} input
* @returns {String | Boolean } string message is not valid
* and boolean true if valid
*/
export declare function validInput(input: string): string | boolean;

View File

@@ -0,0 +1,19 @@
import { validInput } from './input-validator';
/**
* Prompts for $snyk apps create command
*/
export declare const createAppPrompts: ({
name: string;
type: string;
message: string;
validate: typeof validInput;
choices?: undefined;
initial?: undefined;
} | {
name: string;
type: string;
message: string;
choices: string[];
initial: string;
validate?: undefined;
})[];

View File

@@ -0,0 +1,8 @@
/**
* Collection of utility function for the
* $snyk apps commands
*/
import { EAppsURL, ICreateAppResponse, IGetAppsURLOpts } from '.';
export declare function getAppsURL(selection: EAppsURL, opts?: IGetAppsURLOpts): string;
export declare function handleRestError(error: any): void;
export declare function handleCreateAppRes(res: ICreateAppResponse): string;

View File

@@ -0,0 +1,56 @@
export type AppContext = 'tenant' | 'user';
export interface IGetAppsURLOpts {
orgId?: string;
clientId?: string;
}
interface IJSONApi {
version: string;
}
export interface ICreateAppResponse {
jsonapi: IJSONApi;
data: {
type: string;
id: string;
attributes: {
name: string;
client_id: string;
redirect_uris: string[];
scopes: string[];
is_public: boolean;
client_secret: string;
access_token_ttl_seconds: number;
};
links: {
self: string;
};
};
}
export interface IRestErrorResponse {
jsonapi: IJSONApi;
errors: [
{
status: string;
detail: string;
source?: any;
meta?: any;
}
];
}
export interface IGenerateAppsOptions {
interactive?: boolean;
}
export interface ICreateAppOptions extends IGenerateAppsOptions {
org?: string;
name?: string;
redirectUris?: string;
scopes?: string;
context?: AppContext;
}
export interface ICreateAppRequest {
orgId: string;
snykAppName: string;
snykAppRedirectUris: string[];
snykAppScopes: string[];
context?: AppContext;
}
export {};

View File

@@ -0,0 +1 @@
export declare function readAppsHelpMarkdown(filename: string): string;

View File

@@ -0,0 +1,6 @@
export declare function actionAllowed(action: string, options: {
org?: string;
}): Promise<{
allowed: boolean;
reason: string;
}>;

View File

@@ -0,0 +1,2 @@
import { Options } from './types';
export declare function checkOSSPaths(paths: string[], options: Options): void;

View File

@@ -0,0 +1 @@
export declare function getCodeClientProxyUrl(): string;

View File

@@ -0,0 +1,4 @@
export declare function sleep(ms: number): Promise<void>;
export declare const reTryMessage = "Tip: Re-run in debug mode to see more information: DEBUG=*snyk* <COMMAND>";
export declare const contactSupportMessage = "If the issue persists contact support@snyk.io";
export declare function testPlatformSupport(): void;

View File

@@ -0,0 +1,21 @@
/**
* @description Get a Base URL for Snyk APIs
* @export
* @param {string} defaultUrl URL to default to, should be the one defined in the config.default.json file
* @param {(string | undefined)} envvarDefinedApiUrl if there is an URL defined in the SNYK_API envvar
* @param {(string | undefined)} configDefinedApiUrl if there is an URL defined in the 'endpoint' key of the config
* @returns {string} Returns a Base URL - without the /v1. Use this to construct derived URLs
*/
export declare function getBaseApiUrl(defaultUrl: string, envvarDefinedApiUrl?: string, configDefinedApiUrl?: string): string;
export declare function getV1ApiUrl(baseApiUrl: string): string;
/**
* @description Return Snyk REST API URL
* @export
* @param {string} baseApiUrl
* @param {string} envvarDefinedRestApiUrl
* @param {string} envvarDefinedRestV3Url
* @returns {string}
*/
export declare function getRestApiUrl(baseApiUrl: string, envvarDefinedRestApiUrl?: string, envvarDefinedRestV3Url?: string): string;
export declare function getHiddenApiUrl(restUrl: string): string;
export declare function getRootUrl(apiUrlString: string): string;

View File

@@ -0,0 +1,28 @@
interface Config {
PRUNE_DEPS_THRESHOLD: number;
MAX_PATH_COUNT: number;
API: string;
api: string;
API_REST_URL: string;
API_HIDDEN_URL: string;
API_V3_URL?: string;
disableSuggestions: string;
org: string;
orgId?: string;
ROOT: string;
timeout: number;
PROJECT_NAME: string;
TOKEN: string;
CODE_CLIENT_PROXY_URL: string;
DISABLE_ANALYTICS: unknown;
CACHE_PATH?: string;
DRIFTCTL_PATH?: string;
DRIFTCTL_URL?: string;
IAC_BUNDLE_PATH?: string;
IAC_POLICY_ENGINE_PATH?: string;
IAC_RULES_CLIENT_URL?: string;
PUBLIC_VULN_DB_URL: string;
PUBLIC_LICENSE_URL: string;
}
declare const config: Config;
export default config;

View File

@@ -0,0 +1,5 @@
export declare const PATH_SEPARATOR = " > ";
export declare const PATH_HIDDEN_ELEMENTS = "...";
export declare const CALL_PATH_LEADING_ELEMENTS = 2;
export declare const CALL_PATH_TRAILING_ELEMENTS = 2;
export declare const MAX_STRING_LENGTH = 50000;

View File

@@ -0,0 +1,9 @@
import { ScannedProject } from '@snyk/cli-interface/legacy/common';
import { MonitorMeta } from '../types';
export declare const IMAGE_SAVE_PATH_OPT = "imageSavePath";
export declare const IMAGE_SAVE_PATH_ENV_VAR = "SNYK_IMAGE_SAVE_PATH";
export declare function isContainer(scannedProject: ScannedProject): boolean;
export declare function getContainerTargetFile(scannedProject: ScannedProject): string | undefined;
export declare function getContainerName(scannedProject: ScannedProject, meta: MonitorMeta): string | undefined;
export declare function getContainerProjectName(scannedProject: ScannedProject, meta: MonitorMeta): string | undefined;
export declare function getContainerImageSavePath(): string | undefined;

View File

@@ -0,0 +1,2 @@
import { DepGraph } from '@snyk/dep-graph';
export declare function hasUnknownVersions(depGraph?: DepGraph): boolean;

View File

@@ -0,0 +1,8 @@
import { SupportedPackageManagers } from './package-managers';
export declare const AUTO_DETECTABLE_FILES: string[];
export declare function isPathToPackageFile(path: string, featureFlags?: Set<string>): boolean;
export declare function detectPackageManager(root: string, options: any, featureFlags?: Set<string>): any;
export declare function localFileSuppliedButNotFound(root: any, file: any): any;
export declare function isLocalFolder(root: string): boolean;
export declare function detectPackageFile(root: string, featureFlags?: Set<string>): string | undefined;
export declare function detectPackageManagerFromFile(file: string, featureFlags?: Set<string>): SupportedPackageManagers;

View File

@@ -0,0 +1,2 @@
import { Policy } from 'snyk-policy';
export declare function display(policy: Policy): Promise<string>;

View File

@@ -0,0 +1,2 @@
import { Ecosystem } from './types';
export declare function isUnmanagedEcosystem(ecosystem: Ecosystem): boolean;

View File

@@ -0,0 +1,15 @@
import { Options } from '../types';
import { Ecosystem } from './types';
export { testEcosystem } from './test';
export { monitorEcosystem } from './monitor';
export { getPlugin } from './plugins';
/**
* Ecosystems are listed here if you opt in to the new plugin test flow.
* This is a breaking change to the old plugin formats, so only a select few
* plugins currently work with it.
*
* Currently container scanning is not yet ready to work with this flow,
* hence this is in a separate function from getEcosystem().
*/
export declare function getEcosystemForTest(options: Options): Ecosystem | null;
export declare function getEcosystem(options: Options): Ecosystem | null;

View File

@@ -0,0 +1,6 @@
import { Contributor, Options, PolicyOptions } from '../types';
import { BadResult, GoodResult } from '../../cli/commands/monitor/types';
import { Ecosystem, ScanResult, EcosystemMonitorResult, EcosystemMonitorError, MonitorDependenciesRequest } from './types';
export declare function monitorEcosystem(ecosystem: Ecosystem, paths: string[], options: Options & PolicyOptions, contributors?: Contributor[]): Promise<[EcosystemMonitorResult[], EcosystemMonitorError[]]>;
export declare function generateMonitorDependenciesRequest(scanResult: ScanResult, options: Options): Promise<MonitorDependenciesRequest>;
export declare function getFormattedMonitorOutput(results: Array<GoodResult | BadResult>, monitorResults: EcosystemMonitorResult[], errors: EcosystemMonitorError[], options: Options): Promise<string>;

View File

@@ -0,0 +1,2 @@
import { Analytics } from './types';
export declare function extractAndApplyPluginAnalytics(pluginAnalytics: Analytics[], asyncRequestToken?: string): void;

View File

@@ -0,0 +1,2 @@
import { Ecosystem, EcosystemPlugin } from './types';
export declare function getPlugin(ecosystem: Ecosystem): EcosystemPlugin;

View File

@@ -0,0 +1,5 @@
import { Options, PolicyOptions } from '../types';
import { Issue, IssuesData, ScanResult } from './types';
import { Policy } from 'snyk-policy';
export declare function findAndLoadPolicyForScanResult(scanResult: ScanResult, options: Options & PolicyOptions): Promise<object | undefined>;
export declare function filterIgnoredIssues(issues: Issue[], issuesData: IssuesData, policy?: Policy): [Issue[], IssuesData];

View File

@@ -0,0 +1,5 @@
import { Contributor, Options } from '../types';
import { ScanResult, EcosystemMonitorError, EcosystemMonitorResult } from './types';
export declare function resolveAndMonitorFacts(scans: {
[dir: string]: ScanResult[];
}, options: Options, contributors?: Contributor[]): Promise<[EcosystemMonitorResult[], EcosystemMonitorError[]]>;

View File

@@ -0,0 +1,14 @@
import { Options, PolicyOptions } from '../types';
import { Ecosystem, ScanResult, TestResult } from './types';
import { FileHashes, Attributes } from './unmanaged/types';
export declare function resolveAndTestFacts(ecosystem: Ecosystem, scans: {
[dir: string]: ScanResult[];
}, options: Options & PolicyOptions): Promise<[TestResult[], string[]]>;
export declare function submitHashes(hashes: FileHashes, orgId: string): Promise<string>;
export declare function pollDepGraphAttributes(id: string, orgId: string): Promise<Attributes>;
export declare function resolveAndTestFactsUnmanagedDeps(scans: {
[dir: string]: ScanResult[];
}, options: Options & PolicyOptions): Promise<[TestResult[], string[]]>;
export declare function resolveAndTestFactsRegistry(ecosystem: Ecosystem, scans: {
[dir: string]: ScanResult[];
}, options: Options & PolicyOptions): Promise<[TestResult[], string[]]>;

View File

@@ -0,0 +1,14 @@
/// <reference types="node" />
import { Writable } from 'stream';
import { Options, PolicyOptions } from '../types';
import { TestCommandResult } from '../../cli/commands/types';
import { Ecosystem, ScanResult, TestResult } from './types';
type ScanResultsByPath = {
[dir: string]: ScanResult[];
};
export declare function testEcosystem(ecosystem: Ecosystem, paths: string[], options: Options & PolicyOptions): Promise<TestCommandResult>;
export declare function selectAndExecuteTestStrategy(ecosystem: Ecosystem, scanResultsByPath: {
[dir: string]: ScanResult[];
}, options: Options & PolicyOptions): Promise<[TestResult[], string[]]>;
export declare function printUnmanagedDepGraph(results: ScanResultsByPath, target: string, destination: Writable): Promise<TestCommandResult>;
export {};

View File

@@ -0,0 +1,132 @@
import { DepGraphData } from '@snyk/dep-graph';
import { SEVERITY } from '../snyk-test/common';
import { RemediationChanges } from '../snyk-test/legacy';
import { Options, ProjectAttributes, Tag } from '../types';
export type Ecosystem = 'cpp' | 'docker' | 'code';
export type FindingType = 'iacIssue';
export interface PluginResponse {
scanResults: ScanResult[];
}
export interface GitTarget {
remoteUrl?: string;
branch?: string;
}
export interface ContainerTarget {
image: string;
}
export interface NamedTarget extends GitTarget {
name: string;
}
export interface ScanResult {
identity: Identity;
facts: Facts[];
findings?: Finding[];
name?: string;
policy?: string;
target?: GitTarget | ContainerTarget | NamedTarget;
analytics?: Analytics[];
targetReference?: string;
}
export interface Analytics {
name: string;
data: unknown;
}
export interface Identity {
type: string;
targetFile?: string;
args?: {
[key: string]: string;
};
}
export interface Facts {
type: string;
data: any;
}
export interface Finding {
type: FindingType;
data: any;
}
interface UpgradePathItem {
name: string;
version: string;
newVersion?: string;
isDropped?: boolean;
}
export interface UpgradePath {
path: UpgradePathItem[];
}
export interface FixInfo {
upgradePaths: UpgradePath[];
isPatchable: boolean;
nearestFixedInVersion?: string;
}
export interface Issue {
pkgName: string;
pkgVersion?: string;
issueId: string;
fixInfo: FixInfo;
}
export interface IssuesData {
[issueId: string]: {
id: string;
severity: SEVERITY;
title: string;
};
}
export interface DepsFilePaths {
[pkgKey: string]: string[];
}
export interface FileSignaturesDetails {
[pkgKey: string]: {
confidence: number;
filePaths: string[];
};
}
export interface TestResult {
issues: Issue[];
issuesData: IssuesData;
depGraphData: DepGraphData;
depsFilePaths?: DepsFilePaths;
fileSignaturesDetails?: FileSignaturesDetails;
remediation?: RemediationChanges;
}
export interface EcosystemPlugin {
scan: (options: Options) => Promise<PluginResponse>;
display: (scanResults: ScanResult[], testResults: TestResult[], errors: string[], options: Options) => Promise<string>;
test?: (paths: string[], options: Options) => Promise<{
readableResult: string;
sarifResult?: string;
}>;
}
export interface EcosystemMonitorError {
error: string;
path: string;
scanResult: ScanResult;
}
export interface MonitorDependenciesResponse {
ok: boolean;
org: string;
id: string;
isMonitored: boolean;
licensesPolicy: any;
uri: string;
trialStarted: boolean;
path: string;
projectName: string;
}
export interface EcosystemMonitorResult extends MonitorDependenciesResponse {
scanResult: ScanResult;
}
export interface MonitorDependenciesRequest {
scanResult: ScanResult;
/**
* If provided, overrides the default project name (usually equivalent to the root package).
* @deprecated Must not be set by new code! Prefer to set the "scanResult.name" within your plugin!
*/
projectName?: string;
policy?: string;
method?: 'cli';
tags?: Tag[];
attributes?: ProjectAttributes;
}
export {};

View File

@@ -0,0 +1,223 @@
import { SEVERITY } from '../../snyk-test/common';
import { PkgInfo } from '@snyk/dep-graph';
import { UpgradePath, DepsFilePaths } from '../types';
import { SupportedProjectTypes } from '../../types';
export interface HashFormat {
format: number;
data: string;
}
export interface FileHash {
size: number;
path: string;
hashes_ffm: HashFormat[];
}
export interface FileHashes {
hashes: FileHash[];
}
export interface LocationResponse {
id: string;
location: string;
type: string;
}
export interface JsonApi {
version: string;
}
export interface Links {
self: string;
}
export interface CreateDepGraphResponse {
data: LocationResponse;
jsonapi: JsonApi;
links: Links;
}
export interface DepOpenApi {
node_id: string;
}
interface NodeOpenApi {
node_id: string;
pkg_id: string;
deps: DepOpenApi[];
}
export interface Details {
artifact: string;
version: string;
author: string;
path: string;
id: string;
url: string;
score: string;
filePaths: string[];
}
export interface DetailsOpenApi {
artifact: string;
version: string;
author: string;
path: string;
id: string;
url: string;
score: number;
file_paths: string[];
}
export interface ComponentDetails {
[key: string]: Details;
}
export interface ComponentDetailsOpenApi {
[key: string]: DetailsOpenApi;
}
export interface GraphOpenApi {
root_node_id: string;
nodes: NodeOpenApi[];
}
export interface Pkg {
id: string;
info: PkgInfo;
}
export interface PkgManager {
name: string;
}
export interface DepGraphDataOpenAPI {
schema_version: string;
pkg_manager: PkgManager;
pkgs: Pkg[];
graph: GraphOpenApi;
}
export interface Attributes {
start_time: number;
in_progress: boolean;
dep_graph_data?: DepGraphDataOpenAPI;
component_details?: ComponentDetailsOpenApi;
}
export interface IssuesRequestDetails {
artifact: string;
version: string;
author: string;
path: string;
id: string;
url: string;
score: number;
file_paths: string[];
}
export interface IssuesRequestComponentDetails {
[key: string]: IssuesRequestDetails;
}
export interface IssuesRequestDep {
nodeId: string;
}
export interface IssuesRequestDepOpenApi {
node_id: string;
}
export interface IssuesRequestNode {
nodeId: string;
pkgId: string;
deps: IssuesRequestDep[];
}
export interface IssuesRequestNodeOpenApi {
node_id: string;
pkg_id: string;
deps: IssuesRequestDepOpenApi[];
}
export interface IssuesRequestGraph {
rootNodeId: string;
nodes: IssuesRequestNodeOpenApi[];
component_details: ComponentDetails;
}
export interface IssuesRequestGraphOpenApi {
root_node_id: string;
nodes: IssuesRequestNodeOpenApi[];
component_details: ComponentDetailsOpenApi;
}
export interface IssuesRequestDepGraphDataOpenAPI {
schema_version: string;
pkg_manager: PkgManager;
pkgs: Pkg[];
graph: IssuesRequestGraphOpenApi;
}
export interface IssuesRequestAttributes {
start_time: number;
dep_graph: IssuesRequestDepGraphDataOpenAPI;
component_details: IssuesRequestComponentDetails;
target_severity: SEVERITY;
}
export interface Data {
id: string;
type: string;
attributes: Attributes;
}
export interface FileSignaturesDetailsOpenApi {
[pkgKey: string]: {
confidence: number;
file_paths: string[];
};
}
export interface FixInfoOpenApi {
upgrade_paths: UpgradePath[];
is_patchable: boolean;
nearest_fixed_in_version?: string;
}
export interface IssueOpenApi {
pkg_name: string;
pkg_version?: string;
issue_id: string;
fix_info: FixInfoOpenApi;
}
export interface IssuesDataOpenApi {
[issueId: string]: IssueDataOpenApi;
}
export interface GetDepGraphResponse {
data: Data;
jsonapi: JsonApi;
links: Links;
}
export interface IssuesResponseDataResult {
start_time: string;
issues: IssueOpenApi[];
issues_data: IssuesDataOpenApi;
dep_graph: DepGraphDataOpenAPI;
deps_file_paths: DepsFilePaths;
file_signatures_details: FileSignaturesDetailsOpenApi;
type: string;
}
export interface IssuesResponseData {
id: string;
result: IssuesResponseDataResult;
}
export interface GetIssuesResponse {
jsonapi: JsonApi;
links: Links;
data: IssuesResponseData;
}
interface PatchOpenApi {
version: string;
id: string;
urls: string[];
modification_time: string;
}
export interface IssueDataOpenApi {
id: string;
package_name: string;
version: string;
module_name?: string;
below: string;
semver: {
vulnerable: string | string[];
vulnerable_hashes?: string[];
vulnerable_by_distro?: {
[distro_name_and_version: string]: string[];
};
};
patches: PatchOpenApi[];
is_new: boolean;
description: string;
title: string;
severity: SEVERITY;
fixed_in: string[];
legal_instructions?: string;
package_manager?: SupportedProjectTypes;
from?: string[];
name?: string;
publication_time?: string;
creation_time?: string;
cvsSv3?: string;
credit?: string[];
}
export {};

View File

@@ -0,0 +1,35 @@
import { DepGraphData } from '@snyk/dep-graph';
import { ScanResult } from '../types';
import { DepGraphDataOpenAPI } from './types';
export declare function convertToCamelCase<T>(obj: any): T;
export declare function convertMapCasing<T>(obj: any): T;
export declare function convertObjectArrayCasing<T>(arr: any[]): T[];
export declare function convertDepGraph<T>(depGraphOpenApi: T): DepGraphData;
interface SelfResponse {
jsonapi: {
version: string;
};
data: {
type: string;
id: string;
attributes: {
name: string;
username: string;
email: string;
avatar_url: string;
default_org_context: string;
};
links: {
self: string;
};
};
}
export declare function getOrgIdFromSlug(slug: string): Promise<string>;
export declare function getSelf(): Promise<SelfResponse>;
export declare function getOrgDefaultContext(): Promise<string>;
export declare function isUUID(str: any): boolean;
export declare function getOrg(org?: string | null): Promise<string>;
export declare function getUnmanagedDepGraph(scans: {
[dir: string]: ScanResult[];
}): Promise<DepGraphDataOpenAPI[]>;
export {};

View File

@@ -0,0 +1 @@
export declare function abridgeErrorMessage(msg: string, maxLen: number, ellipsis?: string): string;

View File

@@ -0,0 +1,2 @@
import { CustomError } from './custom-error';
export declare function AuthFailedError(errorMessage?: string, errorCode?: number): CustomError;

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class BadGatewayError extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
constructor(userMessage: any);
}

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class ConnectionTimeoutError extends CustomError {
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,11 @@
import { ProblemError } from '@snyk/error-catalog-nodejs-public';
export declare class CustomError extends Error {
innerError: any;
code: number | undefined;
userMessage: string | undefined;
strCode: string | undefined;
protected _errorCatalog: ProblemError | undefined;
constructor(message: string);
set errorCatalog(ec: ProblemError | undefined);
get errorCatalog(): ProblemError | undefined;
}

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class DockerImageNotFoundError extends CustomError {
private static ERROR_CODE;
constructor(image: string);
}

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
export declare class SarifFileOutputEmptyError extends CustomError {
private static ERROR_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1 @@
export declare function errorMessageWithRetry(message: string): string;

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
export declare class ExcludeFlagBadInputError extends CustomError {
private static ERROR_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
export declare class ExcludeFlagInvalidInputError extends CustomError {
private static ERROR_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class FailOnError extends CustomError {
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class FailedToGetVulnerabilitiesError extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
constructor(userMessage: any, statusCode: any);
}

View File

@@ -0,0 +1,2 @@
import { CustomError } from './custom-error';
export declare function FailedToGetVulnsFromUnavailableResource(root: string, statusCode: number): CustomError;

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class FailedToLoadPolicyError extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,7 @@
import { ProblemError } from '@snyk/error-catalog-nodejs-public';
import { CustomError } from './custom-error';
export declare class FailedToRunTestError extends CustomError {
private static ERROR_MESSAGE;
innerError: any | undefined;
constructor(userMessage: any, errorCode?: any, innerError?: any, errorCatalog?: ProblemError);
}

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
import { SupportedPackageManagers } from '../package-managers';
export declare class FeatureNotSupportedByPackageManagerError extends CustomError {
readonly feature: string;
constructor(feature: string, packageManager: SupportedPackageManagers, additionalUserHelp?: string);
}

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
export declare class FileFlagBadInputError extends CustomError {
private static ERROR_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,8 @@
import { CustomError } from '.';
import { ProblemError } from '@snyk/error-catalog-nodejs-public';
export declare class FormattedCustomError extends CustomError {
formattedUserMessage: string;
constructor(message: string, formattedUserMessage: string, userMessage?: string, errorCatalog?: ProblemError);
set errorCatalog(ec: ProblemError | undefined);
get errorCatalog(): ProblemError | undefined;
}

View File

@@ -0,0 +1,30 @@
export { MissingApiTokenError } from './missing-api-token';
export { FileFlagBadInputError } from './file-flag-bad-input';
export { MissingTargetFileError } from './missing-targetfile-error';
export { NoSupportedManifestsFoundError } from './no-supported-manifests-found';
export { NoSupportedSastFiles } from './no-supported-sast-files-found';
export { CustomError } from './custom-error';
export { MonitorError } from './monitor-error';
export { ValidationError } from './validation-error';
export { ConnectionTimeoutError } from './connection-timeout-error';
export { FailedToLoadPolicyError } from './failed-to-load-policy-error';
export { PolicyNotFoundError } from './policy-not-found-error';
export { InternalServerError } from './internal-server-error';
export { BadGatewayError } from './bad-gateway-error';
export { ServiceUnavailableError } from './service-unavailable-error';
export { FailedToGetVulnerabilitiesError } from './failed-to-get-vulnerabilities-error';
export { FailedToGetVulnsFromUnavailableResource } from './failed-to-get-vulns-from-unavailable-resource';
export { UnsupportedPackageManagerError } from './unsupported-package-manager-error';
export { FailedToRunTestError } from './failed-to-run-test-error';
export { TooManyVulnPaths } from './too-many-vuln-paths';
export { AuthFailedError } from './authentication-failed-error';
export { FeatureNotSupportedForOrgError } from './unsupported-feature-for-org-error';
export { MissingOptionError } from './missing-option-error';
export { MissingArgError } from './missing-arg-error';
export { ExcludeFlagBadInputError } from './exclude-flag-bad-input';
export { UnsupportedOptionCombinationError } from './unsupported-option-combination-error';
export { FeatureNotSupportedByPackageManagerError } from './feature-not-supported-by-package-manager-error';
export { DockerImageNotFoundError } from './docker-image-not-found-error';
export { NotFoundError } from './not-found-error';
export { errorMessageWithRetry } from './error-with-retry';
export { FormattedCustomError } from './formatted-custom-error';

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class InternalServerError extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
constructor(userMessage: any);
}

View File

@@ -0,0 +1,4 @@
import { CustomError } from './custom-error';
export declare class InvalidDetectionDepthValue extends CustomError {
constructor();
}

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class InvalidRemoteUrlError extends CustomError {
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
export declare class JsonFileOutputBadInputError extends CustomError {
private static ERROR_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,5 @@
declare function _exports(command: any): Promise<never>;
declare namespace _exports {
function message(error: any): any;
}
export = _exports;

View File

@@ -0,0 +1,2 @@
import { CustomError } from './custom-error';
export declare function MisconfiguredAuthInCI(): CustomError;

View File

@@ -0,0 +1,15 @@
import { CustomError } from './custom-error';
export declare class MissingApiTokenError extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
/**
* isMissingApiToken returns whether the error instance is a missing API token
* error.
*
* Defined as a property so that the same expression resolves as "falsy"
* (undefined) when other error types are tested.
*/
get isMissingApiToken(): boolean;
constructor();
}

View File

@@ -0,0 +1,4 @@
import { CustomError } from './custom-error';
export declare class MissingArgError extends CustomError {
constructor();
}

View File

@@ -0,0 +1,4 @@
import { CustomError } from './custom-error';
export declare class MissingOptionError extends CustomError {
constructor(option: string, required: string[]);
}

View File

@@ -0,0 +1,2 @@
import { CustomError } from './custom-error';
export declare function MissingTargetFileError(path: string): CustomError;

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class MonitorError extends CustomError {
private static ERROR_MESSAGE;
constructor(errorCode: any, message: any);
}

View File

@@ -0,0 +1,11 @@
import { CustomError } from './custom-error';
export declare class NestedCustomError extends CustomError {
constructor(message: string, innerError?: any);
get nestedName(): string;
get nestedStack(): string | undefined;
get nestedMessage(): string;
get nestedUserMessage(): string | undefined;
get nestedCode(): number | undefined;
get nestedStrCode(): string | undefined;
toString(): string;
}

View File

@@ -0,0 +1,2 @@
import { CustomError } from './custom-error';
export declare function NoSupportedManifestsFoundError(atLocations: string[]): CustomError;

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class NoSupportedSastFiles extends CustomError {
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
export declare class NotFoundError extends CustomError {
private static ERROR_CODE;
private static ERROR_MESSAGE;
constructor(userMessage: any);
}

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
import { SupportedPackageManagers } from '../package-managers';
import { Ecosystem } from '../ecosystems/types';
export declare class FeatureNotSupportedByEcosystemError extends CustomError {
readonly feature: string;
constructor(feature: string, ecosystem: SupportedPackageManagers | Ecosystem);
}

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class PolicyNotFoundError extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class ServiceUnavailableError extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
constructor(userMessage: any);
}

View File

@@ -0,0 +1,2 @@
import { CustomError } from './custom-error';
export declare function TokenExpiredError(): CustomError;

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class TooManyVulnPaths extends CustomError {
private static ERROR_CODE;
private static ERROR_STRING_CODE;
private static ERROR_MESSAGE;
constructor();
}

View File

@@ -0,0 +1,6 @@
import { CustomError } from './custom-error';
export declare class UnsupportedEntitlementError extends CustomError {
readonly entitlement: string;
private static ERROR_CODE;
constructor(entitlement: string, userMessage?: string);
}

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class FeatureNotSupportedForOrgError extends CustomError {
readonly org: string;
constructor(org: string, feature?: string, additionalUserHelp?: string);
}

View File

@@ -0,0 +1,7 @@
import { CustomError } from './custom-error';
export declare class UnsupportedOptionCombinationError extends CustomError {
private static ERROR_MESSAGE;
code: number;
userMessage: string;
constructor(options: string[]);
}

View File

@@ -0,0 +1,5 @@
import { CustomError } from './custom-error';
export declare class UnsupportedPackageManagerError extends CustomError {
private static ERROR_MESSAGE;
constructor(packageManager: any);
}

View File

@@ -0,0 +1,4 @@
import { CustomError } from './custom-error';
export declare class ValidationError extends CustomError {
constructor(message: string);
}

1
safekiso-server/node_modules/snyk/dist/lib/exec.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function executeCommand(cmd: any, root: any): Promise<unknown>;

View File

@@ -0,0 +1,2 @@
import { OrgFeatureFlagResponse } from './types';
export declare function fetchFeatureFlag(featureFlag: string, org: any): Promise<OrgFeatureFlagResponse>;

View File

@@ -0,0 +1,4 @@
import { OrgFeatureFlagResponse } from './types';
import { Options } from '../types';
export declare function isFeatureFlagSupportedForOrg(featureFlag: string, org: any): Promise<OrgFeatureFlagResponse>;
export declare function hasFeatureFlag(featureFlag: string, options: Options): Promise<boolean | undefined>;

View File

@@ -0,0 +1,6 @@
export type OrgFeatureFlagResponse = {
ok?: boolean;
userMessage?: string;
code?: number;
error?: string;
};

View File

@@ -0,0 +1,35 @@
/// <reference types="node" />
import * as fs from 'fs';
/**
* Returns files inside given file path.
*
* @param path file path.
*/
export declare function readDirectory(path: string): Promise<string[]>;
/**
* Returns file stats object for given file path.
*
* @param path path to file or directory.
*/
export declare function getStats(path: string): Promise<fs.Stats>;
interface FindFilesRes {
files: string[];
allFilesFound: string[];
}
interface FindFilesConfig {
path: string;
ignore?: string[];
filter?: string[];
levelsDeep?: number;
featureFlags?: Set<string>;
}
/**
* Find all files in given search path. Returns paths to files found.
*
* @param path file path to search.
* @param ignore (optional) files to ignore. Will always ignore node_modules.
* @param filter (optional) file names to find. If not provided all files are returned.
* @param levelsDeep (optional) how many levels deep to search, defaults to two, this path and one sub directory.
*/
export declare function find(findConfig: FindFilesConfig): Promise<FindFilesRes>;
export {};

View File

@@ -0,0 +1,2 @@
import { TestResult } from '../../../lib/snyk-test/legacy';
export declare function dockerRemediationForDisplay(res: TestResult): string;

View File

@@ -0,0 +1 @@
export declare function createDockerBinaryHeading(pkgInfo: any): string;

View File

@@ -0,0 +1,2 @@
import { Options, TestOptions } from '../../../lib/types';
export declare function formatDockerBinariesIssues(dockerBinariesSortedGroupedVulns: any, binariesVulns: any, options: Options & TestOptions): string[];

View File

@@ -0,0 +1,3 @@
export { dockerRemediationForDisplay } from './format-docker-advice';
export { formatDockerBinariesIssues } from './format-docker-binary-issues';
export { createDockerBinaryHeading } from './format-docker-binary-heading';

View File

@@ -0,0 +1 @@
export declare function summariseErrorResults(errorResultsLength: number): string;

View File

@@ -0,0 +1,3 @@
import { MonitorResult } from '../types';
export declare function formatErrorMonitorOutput(packageManager: any, res: MonitorResult, options: any, projectName?: string): string;
export declare function formatMonitorOutput(packageManager: any, res: MonitorResult, options: any, projectName?: string, foundProjectCount?: number): string;

View File

@@ -0,0 +1,4 @@
import { TestOptions, Options } from '../../lib/types';
import { TestResult } from '../../lib/snyk-test/legacy';
import { IacTestResponse } from '../../lib/snyk-test/iac-test-result';
export declare function formatTestMeta(res: TestResult | IacTestResponse, options: Options & TestOptions): string;

View File

@@ -0,0 +1,2 @@
import { Options, TestOptions } from '../../lib/types';
export declare function summariseVulnerableResults(vulnerableResults: any, options: Options & TestOptions): string;

View File

@@ -0,0 +1,4 @@
import * as sarif from 'sarif';
import { TestResult, AnnotatedIssue } from '../snyk-test/legacy';
export declare function getResults(testResult: TestResult): sarif.Result[];
export declare function getLevel(vuln: AnnotatedIssue): "error" | "warning" | "note";

View File

@@ -0,0 +1,2 @@
import { SEVERITY } from '../snyk-test/common';
export declare function getSeverityValue(severity: SEVERITY | 'none'): number;

View File

@@ -0,0 +1 @@
export declare function getVulnerabilityUrl(vulnerabilityId: string): string;

View File

@@ -0,0 +1,3 @@
import { IacTestResponse } from '../../snyk-test/iac-test-result';
import * as sarif from 'sarif';
export declare function createSarifOutputForIac(iacTestResponses: IacTestResponse[]): sarif.Log;

View File

@@ -0,0 +1,2 @@
export { formatIacTestFailures, formatFailuresList } from './list';
export { failuresTipOutput } from './tip';

View File

@@ -0,0 +1,4 @@
import { IaCTestFailure, IaCTestWarning } from '../types';
export declare function formatIacTestFailures(testFailures: IaCTestFailure[]): string;
export declare function formatFailuresList(testFailures: IaCTestFailure[]): string;
export declare function formatIacTestWarnings(testWarnings: IaCTestWarning[]): string;

Some files were not shown because too many files have changed in this diff Show More