"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/lib/types.ts" (20 Feb 2024, 7432 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "types.ts": 1.1280.0_vs_1.1280.1.

    1 import { SupportedPackageManagers } from './package-managers';
    2 import { IacProjectTypes, IacFileTypes } from './iac/constants';
    3 import { legacyCommon as legacyApi } from '@snyk/cli-interface';
    4 import { SEVERITY } from './snyk-test/legacy';
    5 import { FailOn } from './snyk-test/common';
    6 
    7 export interface DepDict {
    8   [name: string]: DepTree;
    9 }
   10 
   11 export type DepTree = legacyApi.DepTree;
   12 
   13 export type ShowVulnPaths = 'none' | 'some' | 'all';
   14 
   15 export interface TestOptions {
   16   traverseNodeModules?: boolean;
   17   pruneRepeatedSubdependencies?: boolean;
   18   showVulnPaths: ShowVulnPaths;
   19   failOn?: FailOn;
   20   initScript?: string;
   21   yarnWorkspaces?: boolean;
   22   gradleSubProject?: boolean;
   23   command?: string; // python interpreter to use for python tests
   24   testDepGraphDockerEndpoint?: string | null;
   25   isDockerUser?: boolean;
   26 }
   27 
   28 export interface Contributor {
   29   email: string;
   30   lastCommitDate: string;
   31 }
   32 
   33 export interface PolicyOptions {
   34   'ignore-policy'?: boolean; // used in snyk/policy lib
   35   'trust-policies'?: boolean; // used in snyk/policy lib
   36   'policy-path'?: string;
   37   loose?: boolean;
   38 }
   39 
   40 export interface Options {
   41   org?: string | null;
   42   path: string;
   43   docker?: boolean;
   44   iac?: boolean;
   45   code?: boolean;
   46   unmanaged?: boolean; // C/C++ Ecosystem Support
   47   file?: string;
   48   policy?: string;
   49   json?: boolean;
   50   vulnEndpoint?: string;
   51   projectName?: string;
   52   insecure?: boolean;
   53   'dry-run'?: boolean;
   54   allSubProjects?: boolean;
   55   mavenAggregateProject?: boolean;
   56   'project-name'?: string;
   57   'show-vulnerable-paths'?: string;
   58   packageManager?: SupportedPackageManagers;
   59   advertiseSubprojectsCount?: number;
   60   projectNames?: string[];
   61   severityThreshold?: SEVERITY;
   62   dev?: boolean;
   63   'print-deps'?: boolean;
   64   'print-dep-paths'?: boolean;
   65   'remote-repo-url'?: string;
   66   criticality?: string;
   67   scanAllUnmanaged?: boolean;
   68   allProjects?: boolean;
   69   detectionDepth?: number;
   70   exclude?: string;
   71   strictOutOfSync?: boolean;
   72   // Used only with the IaC mode & Docker plugin. Allows requesting some experimental/unofficial features.
   73   experimental?: boolean;
   74   // Used with the Docker plugin only. Allows application scanning.
   75   'app-vulns'?: boolean;
   76   'exclude-app-vulns'?: boolean;
   77   debug?: boolean;
   78   sarif?: boolean;
   79   'group-issues'?: boolean;
   80   quiet?: boolean;
   81   'fail-fast'?: boolean;
   82   tags?: string;
   83   'target-reference'?: string;
   84   'exclude-base-image-vulns'?: boolean;
   85   'no-markdown'?: boolean;
   86   'max-depth'?: number;
   87   report?: boolean;
   88   'var-file'?: string;
   89   'target-name'?: string;
   90   // Used only with the Code (SAST) plugin. Allows running tests with reporting for existing projects.
   91   'project-id'?: string;
   92   'commit-id'?: string;
   93 
   94   // Policy
   95   'ignore-policy'?: boolean; // used in snyk/policy lib
   96   'trust-policies'?: boolean; // used in snyk/policy lib
   97   'policy-path'?: string;
   98   loose?: boolean;
   99 
  100   // DescribeOptions
  101   kind?: string;
  102   filter?: string;
  103   to?: string;
  104   'fetch-tfstate-headers'?: string;
  105   'tfc-token'?: string;
  106   'tfc-endpoint'?: string;
  107   'tf-provider-version'?: string;
  108   strict?: true;
  109   driftignore?: string;
  110   'tf-lockfile'?: string;
  111   'config-dir'?: string;
  112   html?: boolean;
  113   'html-file-output'?: string;
  114   service?: string;
  115   from?: string; // snyk cli args parsing does not support variadic args so this will be coma separated values
  116   ignore?: string[];
  117 
  118   id?: string;
  119 
  120   // GenDriftIgnoreOptions
  121   'exclude-missing'?: boolean;
  122   'exclude-unmanaged'?: boolean;
  123 }
  124 
  125 // TODO(kyegupov): catch accessing ['undefined-properties'] via noImplicitAny
  126 export interface MonitorOptions {
  127   id?: string;
  128   docker?: boolean;
  129   file?: string;
  130   policy?: string;
  131   json?: boolean;
  132   allSubProjects?: boolean;
  133   'project-name'?: string;
  134   'print-deps'?: boolean;
  135   'print-dep-paths'?: boolean;
  136   scanAllUnmanaged?: boolean;
  137   allProjects?: boolean;
  138   // An experimental flag to allow monitoring of bigtrees (with degraded deps info and remediation advice).
  139   pruneRepeatedSubdependencies?: boolean;
  140   // Used with the Docker plugin only. Allows requesting some experimental/unofficial features.
  141   experimental?: boolean;
  142   // Used with the Docker plugin only. Allows application scanning.
  143   'app-vulns'?: boolean;
  144   'exclude-app-vulns'?: boolean;
  145   initScript?: string;
  146   yarnWorkspaces?: boolean;
  147   'max-depth'?: number;
  148 }
  149 
  150 export interface MonitorMeta {
  151   method: 'cli';
  152   packageManager: SupportedPackageManagers;
  153   'policy-path': string;
  154   'project-name': string;
  155   isDocker: boolean;
  156   prune: boolean;
  157   'remote-repo-url'?: string;
  158   targetReference?: string;
  159 }
  160 
  161 export interface Tag {
  162   key: string;
  163   value: string;
  164 }
  165 
  166 export interface ProjectAttributes {
  167   criticality?: PROJECT_CRITICALITY[];
  168   environment?: PROJECT_ENVIRONMENT[];
  169   lifecycle?: PROJECT_LIFECYCLE[];
  170 }
  171 
  172 export enum PROJECT_CRITICALITY {
  173   CRITICAL = 'critical',
  174   HIGH = 'high',
  175   MEDIUM = 'medium',
  176   LOW = 'low',
  177 }
  178 
  179 export enum PROJECT_ENVIRONMENT {
  180   FRONTEND = 'frontend',
  181   BACKEND = 'backend',
  182   INTERNAL = 'internal',
  183   EXTERNAL = 'external',
  184   MOBILE = 'mobile',
  185   SAAS = 'saas',
  186   ONPREM = 'onprem',
  187   HOSTED = 'hosted',
  188   DISTRIBUTED = 'distributed',
  189 }
  190 
  191 export enum PROJECT_LIFECYCLE {
  192   PRODUCTION = 'production',
  193   DEVELOPMENT = 'development',
  194   SANDBOX = 'sandbox',
  195 }
  196 
  197 export interface PackageJson {
  198   scripts: any;
  199   snyk: boolean;
  200   dependencies: any;
  201   devDependencies: any;
  202 }
  203 export interface MonitorResult {
  204   org?: string;
  205   id: string;
  206   path: string;
  207   licensesPolicy: any;
  208   uri: string;
  209   isMonitored: boolean;
  210   trialStarted: boolean;
  211 }
  212 
  213 export interface SpinnerOptions {
  214   stream?: NodeJS.WriteStream;
  215   tty?: any;
  216   string?: string;
  217   interval?: any;
  218   delay?: any;
  219   label?: string;
  220   unref?: any;
  221   cleanup?: any;
  222 }
  223 
  224 export interface OutputDataTypes {
  225   stdout: any;
  226   stringifiedData: string;
  227   stringifiedJsonData: string;
  228   stringifiedSarifData: string;
  229 }
  230 
  231 export type SupportedProjectTypes = IacProjectTypes | SupportedPackageManagers;
  232 
  233 // TODO: finish typing this there are many more!
  234 export type SupportedUserReachableFacingCliArgs =
  235   | 'all-projects'
  236   | 'all-sub-projects'
  237   | 'detection-depth'
  238   | 'docker'
  239   | 'dry-run'
  240   | 'sequential'
  241   | 'fail-on'
  242   | 'file'
  243   | 'gradle-sub-project'
  244   | 'ignore-policy'
  245   | 'init-script'
  246   | 'integration-name'
  247   | 'integration-version'
  248   | 'json'
  249   | 'package-manager'
  250   | 'packages-folder'
  251   | 'policy'
  252   | 'project-name'
  253   | 'prune-repeated-subdependencies'
  254   | 'rules'
  255   | 'scan-all-unmanaged'
  256   | 'severity-threshold'
  257   | 'show-vulnerable-paths'
  258   | 'skip-unresolved'
  259   | 'strict-out-of-sync'
  260   | 'sub-project'
  261   | 'trust-policies'
  262   | 'yarn-workspaces'
  263   | 'maven-aggregate-project'
  264   | 'gradle-normalize-deps';
  265 
  266 export enum SupportedCliCommands {
  267   version = 'version',
  268   about = 'about',
  269   help = 'help',
  270   // config = 'config', // TODO: cleanup `$ snyk config` parsing logic before adding it here
  271   // auth = 'auth', // TODO: auth does not support argv._ at the moment
  272   test = 'test',
  273   monitor = 'monitor',
  274   fix = 'fix',
  275   protect = 'protect',
  276   policy = 'policy',
  277   ignore = 'ignore',
  278   wizard = 'wizard',
  279   woof = 'woof',
  280   log4shell = 'log4shell',
  281   apps = 'apps',
  282   drift = 'drift',
  283   describe = 'describe',
  284   'update-exclude-policy' = 'update-exclude-policy',
  285 }
  286 
  287 export interface IacFileInDirectory {
  288   filePath: string;
  289   fileType: IacFileTypes;
  290   projectType?: IacProjectTypes;
  291   failureReason?: string;
  292 }
  293 
  294 export interface IacOutputMeta {
  295   projectName: string;
  296   orgName: string;
  297   gitRemoteUrl?: string;
  298 }