@appland/scanner 1.83.0 → 1.84.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.
Files changed (146) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/built/algorithms/dataStructures/graph/Graph.d.ts +29 -0
  3. package/built/algorithms/dataStructures/graph/GraphEdge.d.ts +10 -0
  4. package/built/algorithms/dataStructures/graph/GraphVertex.d.ts +21 -0
  5. package/built/algorithms/dataStructures/linked-list/LinkedList.d.ts +16 -0
  6. package/built/algorithms/dataStructures/linked-list/LinkedListNode.d.ts +6 -0
  7. package/built/algorithms/graph/depth-first-search/index.d.ts +8 -0
  8. package/built/algorithms/graph/detect-cycle/index.d.ts +8 -0
  9. package/built/algorithms/hash/hashV1.d.ts +6 -0
  10. package/built/algorithms/hash/hashV2.d.ts +53 -0
  11. package/built/algorithms/utils/Comparator.d.ts +11 -0
  12. package/built/analyzer/recordSecrets.d.ts +6 -0
  13. package/built/analyzer/secretsRegexes.d.ts +5 -0
  14. package/built/appMapIndex.d.ts +8 -0
  15. package/built/check.d.ts +18 -0
  16. package/built/checkInstance.d.ts +16 -0
  17. package/built/cli/appmapDirFromConfig.d.ts +1 -0
  18. package/built/cli/ci/command.d.ts +8 -0
  19. package/built/cli/ci/options.d.ts +10 -0
  20. package/built/cli/codeVersionArgs.d.ts +2 -0
  21. package/built/cli/exitCode.d.ts +6 -0
  22. package/built/cli/fail.d.ts +1 -0
  23. package/built/cli/handleWorkingDirectory.d.ts +1 -0
  24. package/built/cli/merge/command.d.ts +8 -0
  25. package/built/cli/merge/options.d.ts +7 -0
  26. package/built/cli/reportUploadURL.d.ts +3 -0
  27. package/built/cli/resolveAppId.d.ts +1 -0
  28. package/built/cli/scan/breakpoint.d.ts +41 -0
  29. package/built/cli/scan/command.d.ts +8 -0
  30. package/built/cli/scan/formatReport.d.ts +2 -0
  31. package/built/cli/scan/interactiveScan.d.ts +8 -0
  32. package/built/cli/scan/options.d.ts +8 -0
  33. package/built/cli/scan/scanner.d.ts +9 -0
  34. package/built/cli/scan/singleScan.d.ts +12 -0
  35. package/built/cli/scan/ui/interactiveProgess.d.ts +42 -0
  36. package/built/cli/scan/ui/scanContext.d.ts +17 -0
  37. package/built/cli/scan/ui/state/addBreakpoint.d.ts +3 -0
  38. package/built/cli/scan/ui/state/eval.d.ts +3 -0
  39. package/built/cli/scan/ui/state/hint.d.ts +3 -0
  40. package/built/cli/scan/ui/state/hitBreakpoint.d.ts +3 -0
  41. package/built/cli/scan/ui/state/initial.d.ts +3 -0
  42. package/built/cli/scan/ui/state/scan.d.ts +3 -0
  43. package/built/cli/scan/ui/state.d.ts +2 -0
  44. package/built/cli/scan/ui/userInteraction.d.ts +18 -0
  45. package/built/cli/scan/watchScan.d.ts +33 -0
  46. package/built/cli/scan.d.ts +9 -0
  47. package/built/cli/scanArgs.d.ts +2 -0
  48. package/built/cli/scanOptions.d.ts +9 -0
  49. package/built/cli/updateCommitStatus.d.ts +1 -0
  50. package/built/cli/upload/command.d.ts +8 -0
  51. package/built/cli/upload/options.d.ts +11 -0
  52. package/built/cli/upload/pruneAppMap.d.ts +4 -0
  53. package/built/cli/upload.d.ts +5 -0
  54. package/built/cli/validateFile.d.ts +1 -0
  55. package/built/cli.d.ts +2 -0
  56. package/built/configuration/configurationProvider.d.ts +9 -0
  57. package/built/configuration/types/checkConfig.d.ts +18 -0
  58. package/built/configuration/types/configuration.d.ts +7 -0
  59. package/built/configuration/types/matchEventConfig.d.ts +7 -0
  60. package/built/configuration/types/matchPatternConfig.d.ts +6 -0
  61. package/built/database/index.d.ts +17 -0
  62. package/built/database/visit.d.ts +6 -0
  63. package/built/errors.d.ts +4 -0
  64. package/built/eventUtil.d.ts +3 -0
  65. package/built/findings.d.ts +3 -0
  66. package/built/index.d.ts +75 -0
  67. package/built/integration/appland/location.d.ts +5 -0
  68. package/built/integration/appland/retry.d.ts +5 -0
  69. package/built/integration/appland/retryOptions.d.ts +4 -0
  70. package/built/integration/appland/scannerJob/create.d.ts +11 -0
  71. package/built/integration/appland/scannerJob/merge.d.ts +5 -0
  72. package/built/integration/appland/scannerJob.d.ts +11 -0
  73. package/built/integration/github/commitStatus.d.ts +3 -0
  74. package/built/integration/vars.d.ts +12 -0
  75. package/built/lastGitOrFSModifiedDate.d.ts +6 -0
  76. package/built/openapi/index.d.ts +4 -0
  77. package/built/progressReporter.d.ts +16 -0
  78. package/built/report/appMapMetadata.d.ts +0 -0
  79. package/built/report/findingSummary.d.ts +11 -0
  80. package/built/report/findingsReport.d.ts +3 -0
  81. package/built/report/scanResults.d.ts +19 -0
  82. package/built/report/scanSummary.d.ts +20 -0
  83. package/built/report/summaryReport.d.ts +2 -0
  84. package/built/ruleChecker.d.ts +13 -0
  85. package/built/ruleInstance.d.ts +6 -0
  86. package/built/rules/authzBeforeAuthn.d.ts +3 -0
  87. package/built/rules/circularDependency.d.ts +3 -0
  88. package/built/rules/deprecated-crypto-algorithm/metadata.d.ts +4 -0
  89. package/built/rules/deprecated-crypto-algorithm/rule.d.ts +3 -0
  90. package/built/rules/deserializationOfUntrustedData.d.ts +3 -0
  91. package/built/rules/execOfUntrustedCommand.d.ts +3 -0
  92. package/built/rules/http-500/metadata.d.ts +3 -0
  93. package/built/rules/http-500/rule.d.ts +2 -0
  94. package/built/rules/illegalPackageDependency.d.ts +3 -0
  95. package/built/rules/incompatibleHttpClientRequest.d.ts +3 -0
  96. package/built/rules/insecureCompare.d.ts +3 -0
  97. package/built/rules/jobNotCancelled.d.ts +3 -0
  98. package/built/rules/jwtAlgorithmNone.d.ts +24 -0
  99. package/built/rules/jwtUnverifiedSignature.d.ts +23 -0
  100. package/built/rules/lib/analyzeDataFlow.d.ts +23 -0
  101. package/built/rules/lib/hasParameterOrReceiver.d.ts +3 -0
  102. package/built/rules/lib/isCommand.d.ts +2 -0
  103. package/built/rules/lib/matchEvent.d.ts +4 -0
  104. package/built/rules/lib/matchPattern.d.ts +4 -0
  105. package/built/rules/lib/metadata.d.ts +9 -0
  106. package/built/rules/lib/openapiProvider.d.ts +3 -0
  107. package/built/rules/lib/parseRuleDescription.d.ts +1 -0
  108. package/built/rules/lib/precedingEvents.d.ts +2 -0
  109. package/built/rules/lib/rpcWithoutProtection.d.ts +6 -0
  110. package/built/rules/lib/sanitizesData.d.ts +2 -0
  111. package/built/rules/lib/util.d.ts +20 -0
  112. package/built/rules/logoutWithoutSessionReset.d.ts +3 -0
  113. package/built/rules/missingAuthentication.d.ts +3 -0
  114. package/built/rules/missingContentType.d.ts +3 -0
  115. package/built/rules/nPlusOneQuery.d.ts +3 -0
  116. package/built/rules/queryFromInvalidPackage.d.ts +3 -0
  117. package/built/rules/queryFromView.d.ts +3 -0
  118. package/built/rules/rpcWithoutCircuitBreaker.d.ts +3 -0
  119. package/built/rules/saveWithoutValidation.d.ts +3 -0
  120. package/built/rules/secretInLog.d.ts +3 -0
  121. package/built/rules/slowFunctionCall.d.ts +3 -0
  122. package/built/rules/slowHttpServerRequest.d.ts +3 -0
  123. package/built/rules/slowQuery.d.ts +3 -0
  124. package/built/rules/too-many-joins/metadata.d.ts +3 -0
  125. package/built/rules/too-many-joins/options.d.ts +6 -0
  126. package/built/rules/too-many-joins/rule.d.ts +7 -0
  127. package/built/rules/tooManyUpdates.d.ts +3 -0
  128. package/built/rules/unauthenticated-encryption/metadata.d.ts +3 -0
  129. package/built/rules/unauthenticated-encryption/rule.d.ts +2 -0
  130. package/built/rules/unbatchedMaterializedQuery.d.ts +3 -0
  131. package/built/rules/updateInGetRequest.d.ts +3 -0
  132. package/built/scan.d.ts +5 -0
  133. package/built/scope/commandScope.d.ts +6 -0
  134. package/built/scope/httpClientRequestScope.d.ts +6 -0
  135. package/built/scope/httpServerRequestScope.d.ts +6 -0
  136. package/built/scope/rootScope.d.ts +6 -0
  137. package/built/scope/scopeImpl.d.ts +8 -0
  138. package/built/scope/scopeIterator.d.ts +6 -0
  139. package/built/scope/sqlTransactionScope.d.ts +13 -0
  140. package/built/sqlWarning.d.ts +2 -0
  141. package/built/telemetry.d.ts +50 -0
  142. package/built/util/eventAggregator.d.ts +20 -0
  143. package/built/util/isAncestorPath.d.ts +1 -0
  144. package/built/wellKnownLabels.d.ts +5 -0
  145. package/package.json +7 -8
  146. package/src/types.d.ts +0 -72
@@ -0,0 +1,5 @@
1
+ import { CreateMapsetOptions } from '@appland/client/dist/src';
2
+ import { ScanResults } from '../report/scanResults';
3
+ import { UploadResponse } from '../integration/appland/scannerJob/create';
4
+ import { RetryOptions } from '../integration/appland/retryOptions';
5
+ export default function create(scanResults: ScanResults, appId: string, appMapDir: string, mergeKey?: string, mapsetOptions?: CreateMapsetOptions, retryOptions?: RetryOptions): Promise<UploadResponse>;
@@ -0,0 +1 @@
1
+ export default function (kind: string, path: string): Promise<void>;
package/built/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,9 @@
1
+ import Check from '../check';
2
+ import Configuration from './types/configuration';
3
+ import RuleInstance from '../ruleInstance';
4
+ export declare function loadRule(ruleName: string): Promise<RuleInstance>;
5
+ export declare function loadConfig(config: Configuration): Promise<Check[]>;
6
+ export declare type TimestampedConfiguration = Configuration & {
7
+ timestampMs: number;
8
+ };
9
+ export declare function parseConfigFile(configPath: string): Promise<TimestampedConfiguration>;
@@ -0,0 +1,18 @@
1
+ import MatchEventConfig from './matchEventConfig';
2
+ interface MatchConfig {
3
+ scope?: MatchEventConfig;
4
+ event?: MatchEventConfig;
5
+ }
6
+ /**
7
+ * CheckConfig represents the user's configuration of an Check, which is an
8
+ * instantiation of a Rule. Each CheckConfing is read from the scanners configuration file.
9
+ */
10
+ export default interface CheckConfig {
11
+ rule: string;
12
+ id?: string;
13
+ scope?: string;
14
+ include?: MatchConfig[];
15
+ exclude?: MatchConfig[];
16
+ properties?: Record<string, unknown>;
17
+ }
18
+ export {};
@@ -0,0 +1,7 @@
1
+ import CheckConfig from './checkConfig';
2
+ /**
3
+ * Configuration is the code representation of the scanner configuration file.
4
+ */
5
+ export default interface Configuration {
6
+ checks: CheckConfig[];
7
+ }
@@ -0,0 +1,7 @@
1
+ import MatchPatternConfig from './matchPatternConfig';
2
+ declare type PropertyName = 'id' | 'type' | 'fqid' | 'query' | 'route';
3
+ export default interface MatchEventConfig {
4
+ property: PropertyName;
5
+ test: MatchPatternConfig;
6
+ }
7
+ export {};
@@ -0,0 +1,6 @@
1
+ export default interface MatchPatternConfig {
2
+ ignoreCase: boolean;
3
+ match?: RegExp;
4
+ include?: string;
5
+ equal?: string;
6
+ }
@@ -0,0 +1,17 @@
1
+ import { Event } from '@appland/models';
2
+ import { AppMapIndex, EventFilter, QueryAST } from '../types';
3
+ import { SqliteParser } from '@appland/models/types/sqlite-parser';
4
+ export interface SQLEvent {
5
+ sql: string;
6
+ event: Event;
7
+ }
8
+ export interface SQLCount {
9
+ count: number;
10
+ events: Event[];
11
+ }
12
+ export declare function capitalizeString(str: string): string;
13
+ export declare function getHttpLabel(event: Event): string | undefined;
14
+ export declare function getSqlLabelFromString(sqlString: string): string;
15
+ export declare function isSelect(sql: string): boolean;
16
+ export declare function sqlStrings(event: Event, appMapIndex: AppMapIndex, filter?: EventFilter): Generator<SQLEvent>;
17
+ export declare function countJoins(ast: QueryAST | undefined, filterTable?: (table: SqliteParser.Node) => boolean): number;
@@ -0,0 +1,6 @@
1
+ import { SqliteParser } from '@appland/models/types/sqlite-parser';
2
+ declare type Callbacks = {
3
+ [Node in SqliteParser.Node as `${Node['type']}.${Node['variant']}`]?: (node: Node) => void;
4
+ };
5
+ export declare function visit(node: SqliteParser.Node, callbacks: Callbacks): void;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare class ValidationError extends Error {
2
+ }
3
+ export declare class AbortError extends Error {
4
+ }
@@ -0,0 +1,3 @@
1
+ import { CodeObject, Event } from '@appland/models';
2
+ export declare function cloneCodeObject(sourceObject: CodeObject): CodeObject | undefined;
3
+ export declare function cloneEvent(sourceEvent: Event): Event;
@@ -0,0 +1,3 @@
1
+ import { FindingStatusListItem } from '@appland/client/dist/src';
2
+ import { Finding } from './index';
3
+ export declare function newFindings(findings: Finding[], findingStatuses: FindingStatusListItem[]): Finding[];
@@ -0,0 +1,75 @@
1
+ import { Event, Metadata } from '@appland/models';
2
+ import Configuration from './configuration/types/configuration';
3
+ /**
4
+ * Each Rule in the scanner library wants to consider some set of events as it decides whether the code should be flagged or not.
5
+ * A Scope is a way of declaring how these "sets" are defined. A common scope is `http_server_request`. The rule will look at each HTTP
6
+ * server request separately; what happens in one request is irrelevant to the next. For example, when looking for authz_before_authn, each HTTP
7
+ * server request is considered separately.
8
+ *
9
+ * `http_server_request` is one example of a "command". Other types of commands are: CLI commands and background jobs. Each of these has a
10
+ * defined beginning and end, and is logically completely separate from any other command.
11
+ *
12
+ * Some rules are relevant only to HTTP server requests - such as `http500`. Others are applicable to any kind of command - such as `nPlusOneQuery`.
13
+ *
14
+ * Finally, other rules simply want to look for a certain condition regardless of where it occurs. For example, Too many SQL joins will flag any
15
+ * query anywhere in the AppMap, even if it's not part of a command. This rule uses the root scope, which yields a new scope for every root-level Event
16
+ * (root-level = "has no parent").
17
+ *
18
+ * Ideally, AppMaps would not contain any events that are not part of a command - because without knowing the command, we don't really have any context
19
+ * of what the code is trying to do. But, anticipating that this may sometimes happen, "root" scope is a good choice for a rule that may flag code
20
+ * anywhere in the AppMap.
21
+ */
22
+ export declare type ScopeName = 'root' | 'command' | 'http_client_request' | 'http_server_request' | 'transaction';
23
+ /**
24
+ * Indicates the aspect of software quality that is most relevant to a rule.
25
+ */
26
+ export declare type ImpactDomain = 'Security' | 'Performance' | 'Maintainability' | 'Stability';
27
+ /**
28
+ * Finding is the full data structure that is created when a Rule matches an Event.
29
+ *
30
+ * The Rule only needs to return a boolean, string, or MatchResult. The scanner framework
31
+ * adds the rest of the information to build the complete finding.
32
+ */
33
+ export interface Finding {
34
+ appMapFile: string;
35
+ checkId: string;
36
+ ruleId: string;
37
+ ruleTitle: string;
38
+ event: Event;
39
+ hash: string;
40
+ hash_v2: string;
41
+ scope: Event;
42
+ message: string;
43
+ stack: string[];
44
+ groupMessage?: string;
45
+ occurranceCount?: number;
46
+ relatedEvents?: Event[];
47
+ impactDomain?: ImpactDomain;
48
+ participatingEvents?: Record<string, Event>;
49
+ scopeModifiedDate?: Date;
50
+ eventsModifiedDate?: Date;
51
+ }
52
+ export interface Rule {
53
+ id: string;
54
+ title: string;
55
+ description: string;
56
+ url?: string;
57
+ labels?: string[];
58
+ scope?: ScopeName;
59
+ enumerateScope: boolean;
60
+ impactDomain?: ImpactDomain;
61
+ references?: Record<string, URL>;
62
+ }
63
+ export interface Check {
64
+ id: string;
65
+ scope: ScopeName;
66
+ impactDomain: ImpactDomain;
67
+ rule: Rule;
68
+ }
69
+ export interface ScanResults {
70
+ configuration: Configuration;
71
+ appMapMetadata: Record<string, Metadata>;
72
+ findings: Finding[];
73
+ checks: Check[];
74
+ }
75
+ export { default as scan } from './scan';
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { URL } from 'url';
3
+ export default interface Location {
4
+ url: URL;
5
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { IncomingMessage } from 'http';
3
+ import { RetryOptions } from './retryOptions';
4
+ import { RetryHandler } from '@appland/client/dist/src/retryHandler';
5
+ export default function retry(description: string, retryOptions: RetryOptions, retryFn: () => Promise<IncomingMessage>): RetryHandler;
@@ -0,0 +1,4 @@
1
+ export declare type RetryOptions = {
2
+ maxRetries?: number;
3
+ retryDelay?: number;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { ScanResults } from '../../../report/scanResults';
2
+ import Location from '../location';
3
+ import ScannerJob from '../scannerJob';
4
+ import { RetryOptions } from '../retryOptions';
5
+ declare type CreateOptions = {
6
+ mergeKey?: string;
7
+ };
8
+ export interface UploadResponse extends ScannerJob, Location {
9
+ }
10
+ export declare function create(scanResults: ScanResults, mapsetId: number, appMapUUIDByFileName: Record<string, string>, createOptions?: CreateOptions, retryOptions?: RetryOptions): Promise<UploadResponse>;
11
+ export {};
@@ -0,0 +1,5 @@
1
+ import Location from '../location';
2
+ import ScannerJob from '../scannerJob';
3
+ export interface MergeResponse extends ScannerJob, Location {
4
+ }
5
+ export declare function merge(appId: string, mergeKey: string): Promise<MergeResponse>;
@@ -0,0 +1,11 @@
1
+ import { Configuration } from '@appland/client';
2
+ import { ScanSummary } from '../../report/scanSummary';
3
+ export default interface ScannerJob {
4
+ id: number;
5
+ created_at: string;
6
+ updated_at: string;
7
+ mapset_id: number;
8
+ merge_key?: string;
9
+ summary: ScanSummary;
10
+ configuration: Configuration;
11
+ }
@@ -0,0 +1,3 @@
1
+ declare type CommitStatusState = 'pending' | 'success' | 'error' | 'failure';
2
+ export default function postCommitStatus(state: CommitStatusState, description: string): Promise<unknown>;
3
+ export {};
@@ -0,0 +1,12 @@
1
+ declare function token(): string | undefined;
2
+ declare function sha(): string | undefined;
3
+ declare function pullRequestNumber(): string | undefined;
4
+ declare function owner(): string | undefined;
5
+ declare function repo(): string | undefined;
6
+ declare function branch(): string | undefined;
7
+ declare function validateToken(): void;
8
+ declare function validateSha(): void;
9
+ declare function validatePullRequestNumber(): void;
10
+ declare function validateOwner(): void;
11
+ declare function validateRepo(): void;
12
+ export { branch, token, owner, sha, repo, pullRequestNumber, validateToken, validateOwner, validateRepo, validateSha, validatePullRequestNumber, };
@@ -0,0 +1,6 @@
1
+ export declare function resetCache(): void;
2
+ export declare function isCached(file: string): boolean;
3
+ export declare function gitExists(): Promise<boolean>;
4
+ export declare function gitModifiedDate(file: string): Promise<Date | undefined>;
5
+ export declare function fileModifiedDate(file: string): Promise<Date | undefined>;
6
+ export default function lastGitOrFSModifiedDate(file: string): Promise<Date | undefined>;
@@ -0,0 +1,4 @@
1
+ import OpenApiDiff from 'openapi-diff';
2
+ import { OpenAPIV3 } from 'openapi-types';
3
+ export * from '@appland/openapi';
4
+ export declare const breakingChanges: (schemaHead: OpenAPIV3.Document, schemaBase: OpenAPIV3.Document) => Promise<Array<OpenApiDiff.DiffResult<'breaking'>>>;
@@ -0,0 +1,16 @@
1
+ import { AppMap, Event } from '@appland/models';
2
+ import Check from './check';
3
+ import { AppMapIndex, MatchResult } from './types';
4
+ import { ScopeName } from './index';
5
+ export default interface ProgressReporter {
6
+ beginAppMap(appMapFileName: string, appMap: AppMap): Promise<void>;
7
+ beginCheck(check: Check): Promise<void>;
8
+ filterScope(scopeName: ScopeName, scope: Event): Promise<void>;
9
+ enterScope(scope: Event): Promise<void>;
10
+ filterEvent(event: Event): Promise<void>;
11
+ matchResult(event: Event, matchResult: string | boolean | MatchResult[] | undefined): Promise<void>;
12
+ matchEvent(event: Event, appMapIndex: AppMapIndex): Promise<void>;
13
+ leaveScope(): Promise<void>;
14
+ endCheck(): Promise<void>;
15
+ endAppMap(): Promise<void>;
16
+ }
File without changes
@@ -0,0 +1,11 @@
1
+ /**
2
+ * FindingSummary summarizes the results from a single scanner across the entire scan.
3
+ * It's used for printing a user-friendly summary report, it's not used for machine-readable program output.
4
+ */
5
+ export interface FindingSummary {
6
+ ruleId: string;
7
+ ruleTitle: string;
8
+ findingTotal: number;
9
+ findingHashes: Set<string>;
10
+ messages: string[];
11
+ }
@@ -0,0 +1,3 @@
1
+ import { Metadata } from '@appland/models';
2
+ import { Finding } from '../index';
3
+ export default function (findings: Finding[], appMapMetadata: Record<string, Metadata>, ide?: string): void;
@@ -0,0 +1,19 @@
1
+ import { Metadata } from '@appland/models';
2
+ import Check from '../check';
3
+ import Configuration from '../configuration/types/configuration';
4
+ import { Finding } from '../index';
5
+ import { ScanSummary } from './scanSummary';
6
+ /**
7
+ * ScannerSummary summarizes the results of the entire scan.
8
+ * It's used for printing a user-friendly summary report, it's not used for machine-readable program output.
9
+ */
10
+ export declare class ScanResults {
11
+ configuration: Configuration;
12
+ appMapMetadata: Record<string, Metadata>;
13
+ findings: Finding[];
14
+ checks: Check[];
15
+ summary: ScanSummary;
16
+ constructor(configuration?: Configuration, appMapMetadata?: Record<string, Metadata>, findings?: Finding[], checks?: Check[]);
17
+ withFindings(findings: Finding[]): ScanResults;
18
+ aggregate(sourceScanResults: ScanResults): void;
19
+ }
@@ -0,0 +1,20 @@
1
+ import { Metadata } from '@appland/models';
2
+ export interface AppMapMetadata {
3
+ labels: string[];
4
+ apps: string[];
5
+ clients: Metadata.Client[];
6
+ frameworks: Metadata.Framework[];
7
+ git: Metadata.Git[];
8
+ languages: Metadata.Language[];
9
+ recorders: Metadata.Recorder[];
10
+ testStatuses: ('succeeded' | 'failed')[];
11
+ exceptions: Metadata.Exception[];
12
+ }
13
+ export interface ScanSummary {
14
+ numAppMaps: number;
15
+ rules: string[];
16
+ ruleLabels: string[];
17
+ numChecks: number;
18
+ numFindings: number;
19
+ appMapMetadata: AppMapMetadata;
20
+ }
@@ -0,0 +1,2 @@
1
+ import { ScanResults } from './scanResults';
2
+ export default function (summary: ScanResults, colorize: boolean): void;
@@ -0,0 +1,13 @@
1
+ import { Event } from '@appland/models';
2
+ import Check from './check';
3
+ import { AppMapIndex } from './types';
4
+ import { Finding } from './index';
5
+ import CheckInstance from './checkInstance';
6
+ import ProgressReporter from './progressReporter';
7
+ export default class RuleChecker {
8
+ private progress?;
9
+ private scopes;
10
+ constructor(progress?: ProgressReporter | undefined);
11
+ check(appMapFileName: string, appMapIndex: AppMapIndex, check: Check, findings: Finding[]): Promise<void>;
12
+ checkEvent(event: Event, scope: Event, appMapFileName: string, appMapIndex: AppMapIndex, checkInstance: CheckInstance, findings: Finding[]): Promise<void>;
13
+ }
@@ -0,0 +1,6 @@
1
+ import { Rule } from './index';
2
+ import { RuleLogic } from './types';
3
+ export default interface RuleInstance extends Rule {
4
+ Options?: any;
5
+ build: (options: this['Options']) => RuleLogic;
6
+ }
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,4 @@
1
+ import { Metadata } from '../lib/metadata';
2
+ export declare const labels: string[];
3
+ declare const _default: Metadata;
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { RuleLogic } from '../../types';
2
+ export declare const deprecatedAlgorithms: RegExp[];
3
+ export default function rule(): RuleLogic;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import { Metadata } from '../lib/metadata';
2
+ declare const _default: Metadata;
3
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { RuleLogic } from '../../types';
2
+ export default function rule(): RuleLogic;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
2
+ import { RuleLogic } from '../types';
3
+ import { URL } from 'url';
4
+ import RuleInstance from '../ruleInstance';
5
+ export declare enum Labels {
6
+ JwtEncode = "jwt.encode"
7
+ }
8
+ declare class JwtAlgoritmNone implements RuleInstance {
9
+ readonly id = "jwt-algorithm-none";
10
+ readonly title = "JWT 'none' algorithm";
11
+ readonly impactDomain = "Security";
12
+ readonly enumerateScope = true;
13
+ readonly description: string;
14
+ readonly url = "https://appland.com/docs/analysis/rules-reference.html#jwt-algorithm-none";
15
+ readonly labels: Labels[];
16
+ readonly references: {
17
+ 'CWE-345': URL;
18
+ 'A02:2021': URL;
19
+ 'RFC 7519': URL;
20
+ };
21
+ build(): RuleLogic;
22
+ }
23
+ declare const _default: JwtAlgoritmNone;
24
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import { RuleLogic } from '../types';
2
+ import RuleInstance from '../ruleInstance';
3
+ export declare enum Labels {
4
+ SignatureVerify = "jwt.signature.verify",
5
+ JwtDecode = "jwt.decode"
6
+ }
7
+ declare class JwtUnverifiedSignature implements RuleInstance {
8
+ readonly id = "jwt-unverified-signature";
9
+ readonly title = "Unverified signature";
10
+ readonly impactDomain = "Security";
11
+ readonly enumerateScope = true;
12
+ readonly description: string;
13
+ readonly url = "https://appland.com/docs/analysis/rules-reference.html#jwt-unverified-signature";
14
+ readonly labels: Labels[];
15
+ readonly references: {
16
+ 'CWE-345': URL;
17
+ 'A02:2021': URL;
18
+ 'RFC 7519': URL;
19
+ };
20
+ build(): RuleLogic;
21
+ }
22
+ declare const _default: JwtUnverifiedSignature;
23
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import { Event, ValueBase } from '@appland/models';
2
+ /**
3
+ * Value tracked with data flow analysis, along with the information about
4
+ * its originating event and a list of any other such values that might have
5
+ * been used in its generation.
6
+ */
7
+ export declare type TrackedValue = {
8
+ value: ValueBase;
9
+ origin: Event;
10
+ parents: ReadonlyArray<TrackedValue>;
11
+ };
12
+ /**
13
+ * Tracks flow of data across the execution trace, identifying all function
14
+ * calls which have a tracked object as its receiver or one of the parameters.
15
+ * Any value such a function returns will also then become tracked.
16
+ * The origin chain of all values is recorded, so full provenience up to
17
+ * the starting set can be reconstructed.
18
+ * @param trackedData Initial data to track.
19
+ * @param startEvent The root event of the analysis.
20
+ * @returns Events which have a tracked piece of data as an input, each
21
+ * associated with the list of such inputs.
22
+ */
23
+ export default function analyzeDataFlow(trackedData: ReadonlyArray<ValueBase>, startEvent: Event): Map<Event, ReadonlyArray<TrackedValue>>;
@@ -0,0 +1,3 @@
1
+ import { Event } from '@appland/models';
2
+ declare const _default: (objectId: number) => (event: Event) => boolean;
3
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { Event } from '@appland/models';
2
+ export default function isCommand(event: Event): string | undefined;
@@ -0,0 +1,4 @@
1
+ import MatchEventConfig from '../../configuration/types/matchEventConfig';
2
+ import { EventFilter } from '../../types';
3
+ export declare function buildFilter(pattern: MatchEventConfig): EventFilter;
4
+ export declare function buildFilters(patterns: MatchEventConfig[]): EventFilter[];
@@ -0,0 +1,4 @@
1
+ import MatchPatternConfig from '../../configuration/types/matchPatternConfig';
2
+ import { StringFilter } from '../../types';
3
+ export declare function buildFilter(pattern: MatchPatternConfig): StringFilter;
4
+ export declare function buildFilters(patterns: MatchPatternConfig[]): StringFilter[];
@@ -0,0 +1,9 @@
1
+ import { ImpactDomain, ScopeName } from '../../index';
2
+ export declare type Metadata = {
3
+ title: string;
4
+ impactDomain: ImpactDomain;
5
+ references: Record<string, string>;
6
+ labels?: string[];
7
+ scope?: ScopeName;
8
+ enumerateScope?: boolean;
9
+ };
@@ -0,0 +1,3 @@
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ declare const lookup: (host: string, openapiSchemata: Record<string, string>) => Promise<OpenAPIV3.Document>;
3
+ export default lookup;
@@ -0,0 +1 @@
1
+ export default function parseRuleDescription(id: string): string;
@@ -0,0 +1,2 @@
1
+ import { Event, EventNavigator } from '@appland/models';
2
+ export default function precedingEvents(rootEvent: Event, target: Event): Generator<EventNavigator>;
@@ -0,0 +1,6 @@
1
+ import { Event, Label } from '@appland/models';
2
+ import { RuleLogic } from '../../types';
3
+ export interface RPCWithoutProtectionOptions {
4
+ get expectedLabel(): Label;
5
+ }
6
+ export declare function rpcWithoutProtection(candidateGenerator: (httpClientRequest: Event) => Generator<Event>, options: RPCWithoutProtectionOptions): RuleLogic;
@@ -0,0 +1,2 @@
1
+ import { Event } from '@appland/models';
2
+ export default function sanitizesData(event: Event, objectId: number, label: string): boolean;
@@ -0,0 +1,20 @@
1
+ import { Event, ReturnValueObject } from '@appland/models';
2
+ export declare function collectAppMapFiles(appmapFile?: string | string[], appmapDir?: string): Promise<string[]>;
3
+ declare function verbose(v?: boolean): boolean;
4
+ declare function capitalize(str: string): string;
5
+ declare function emptyValue(value: string): boolean;
6
+ declare function responseContentType(event: Event): string | undefined;
7
+ declare function appMapDir(appMapFileName: string): string;
8
+ declare function isFalsey(valueObj?: ReturnValueObject): boolean;
9
+ declare function parseValue(valueObj: ReturnValueObject): string[];
10
+ declare const isTruthy: (valueObj?: ReturnValueObject | undefined) => boolean;
11
+ declare function providesAuthentication(event: Event, label: string): boolean;
12
+ declare function ideLink(filePath: string, ide: string, eventId: number): string;
13
+ declare const toRegExp: (value: string | RegExp) => RegExp;
14
+ declare const toRegExpArray: (value: string[] | RegExp[]) => RegExp[];
15
+ declare const isRoot: (event: Event | undefined) => boolean;
16
+ declare function dasherize(str: string): string;
17
+ declare function camelize(text: string): string;
18
+ declare function pluralize(word: string, count: number): string;
19
+ declare function fileExists(file: string): Promise<boolean>;
20
+ export { appMapDir, capitalize, emptyValue, fileExists, isFalsey, isTruthy, ideLink, isRoot, parseValue, camelize, dasherize, pluralize, providesAuthentication, toRegExp, responseContentType, toRegExpArray, verbose, };
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;
@@ -0,0 +1,3 @@
1
+ import RuleInstance from '../ruleInstance';
2
+ declare const RULE: RuleInstance;
3
+ export default RULE;