@appland/scanner 1.83.0 → 1.83.1

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 +7 -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,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 { Metadata } from '../lib/metadata';
2
+ declare const _default: Metadata;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import MatchPatternConfig from '../../configuration/types/matchPatternConfig';
2
+ import { TooManyJoins } from '../types';
3
+ export default class Options implements TooManyJoins.Options {
4
+ warningLimit: number;
5
+ excludeTables: MatchPatternConfig[];
6
+ }
@@ -0,0 +1,7 @@
1
+ import { SQLCount } from '../../database';
2
+ import { RuleLogic } from '../../types';
3
+ import Options from './options';
4
+ export interface JoinCount extends SQLCount {
5
+ joins: number;
6
+ }
7
+ export default function rule(options: Options): 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 { 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,5 @@
1
+ import { ScanResults } from './index';
2
+ /**
3
+ * Perform all configured checks on a single AppMap file.
4
+ */
5
+ export default function scan(appmapFile: string, configurationFile: string): Promise<ScanResults>;
@@ -0,0 +1,6 @@
1
+ import { Event } from '@appland/models';
2
+ import { Scope } from '../types';
3
+ import ScopeIterator from './scopeIterator';
4
+ export default class CommandScope extends ScopeIterator {
5
+ scopes(events: IterableIterator<Event>): Generator<Scope>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Event } from '@appland/models';
2
+ import { Scope } from '../types';
3
+ import ScopeIterator from './scopeIterator';
4
+ export default class HTTPClientRequestScope extends ScopeIterator {
5
+ scopes(events: Generator<Event>): Generator<Scope>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Event } from '@appland/models';
2
+ import { Scope } from '../types';
3
+ import ScopeIterator from './scopeIterator';
4
+ export default class HTTPServerRequestScope extends ScopeIterator {
5
+ scopes(events: Generator<Event>): Generator<Scope>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Event } from '@appland/models';
2
+ import { Scope } from '../types';
3
+ import ScopeIterator from './scopeIterator';
4
+ export default class RootScope extends ScopeIterator {
5
+ scopes(events: IterableIterator<Event>): Generator<Scope>;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { Event, EventNavigator } from '@appland/models';
2
+ import { Scope } from '../types';
3
+ export default class ScopeImpl implements Scope {
4
+ scope: Event;
5
+ descendants: EventNavigator;
6
+ constructor(event: Event);
7
+ events(): Generator<Event>;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { Event } from '@appland/models';
2
+ import { Scope } from '../types';
3
+ export default abstract class ScopeIterator {
4
+ abstract scopes(events: Iterable<Event>): Generator<Scope>;
5
+ protected advanceToReturnEvent(scopeEvent: Event, events: Iterator<Event>): void;
6
+ }
@@ -0,0 +1,13 @@
1
+ import type { Event } from '@appland/models';
2
+ import ScopeIterator from './scopeIterator';
3
+ import type { Scope } from '../types';
4
+ export interface TransactionDetails {
5
+ transaction: {
6
+ status: 'commit' | 'rollback';
7
+ events: Event[];
8
+ };
9
+ }
10
+ export declare function hasTransactionDetails(event: Event & Partial<TransactionDetails>): event is Event & TransactionDetails;
11
+ export default class SQLTransactionScope extends ScopeIterator {
12
+ scopes(events: IterableIterator<Event>): Generator<Scope, void, void>;
13
+ }
@@ -0,0 +1,2 @@
1
+ import { ParseError } from '@appland/models';
2
+ export default function sqlWarning(parseError: ParseError): void;
@@ -0,0 +1,50 @@
1
+ /// <reference types="node" />
2
+ import { TelemetryClient } from 'applicationinsights';
3
+ import { PathLike } from 'fs';
4
+ declare class Session {
5
+ id: string;
6
+ expiration: number;
7
+ constructor();
8
+ static beyondExpiration(expiration: number): boolean;
9
+ static expirationFromNow(): number;
10
+ static newSessionId(): string;
11
+ touch(): void;
12
+ get valid(): boolean;
13
+ }
14
+ export interface TelemetryData {
15
+ name: string;
16
+ properties?: Record<string, string | undefined>;
17
+ metrics?: Record<string, number | undefined>;
18
+ }
19
+ export interface TelemetryOptions {
20
+ includeEnvironment: boolean;
21
+ }
22
+ export default class Telemetry {
23
+ private static _session?;
24
+ private static _client?;
25
+ private static debug;
26
+ static readonly machineId: string;
27
+ static get enabled(): boolean;
28
+ static get session(): Session;
29
+ static get client(): TelemetryClient;
30
+ static sendEvent(data: TelemetryData, options?: TelemetryOptions): void;
31
+ static flush(exitCB: () => unknown): void;
32
+ }
33
+ export declare enum GitState {
34
+ NotInstalled = 0,
35
+ NoRepository = 1,
36
+ Ok = 2
37
+ }
38
+ export declare const GitRepositoryEnvKeys: readonly ["GITHUB_REPOSITORY", "CIRCLE_REPOSITORY_URL", "GIT_URL", "CI_REPOSITORY_URL"];
39
+ export declare const GitBranchEnvKeys: readonly ["GITHUB_REF_NAME", "CIRCLE_BRANCH", "GIT_BRANCH", "TRAVIS_BRANCH", "CI_COMMIT_REF_NAME"];
40
+ export declare const GitCommitEnvKeys: readonly ["GITHUB_SHA", "CIRCLE_SHA1", "GIT_COMMIT", "TRAVIS_COMMIT", "CI_COMMIT_SHA"];
41
+ declare class GitProperties {
42
+ static contributors(sinceDaysAgo: number, cwd?: PathLike): Promise<Array<string>>;
43
+ static repository(cwd?: PathLike): Promise<string | undefined>;
44
+ static branch(cwd?: PathLike): Promise<string | undefined>;
45
+ static commit(cwd?: PathLike): Promise<string | undefined>;
46
+ static state(cwd?: PathLike): Promise<GitState>;
47
+ static clearCache(): void;
48
+ }
49
+ export declare const Git: typeof GitProperties;
50
+ export {};
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ export declare type PendingEvent<E> = {
4
+ emitter: EventEmitter;
5
+ event: string;
6
+ arg: E;
7
+ };
8
+ export declare const MaxMSBetween: number;
9
+ export declare type CancelFn = () => void;
10
+ export default class EventAggregator<E> {
11
+ private callback;
12
+ private maxMsBetween;
13
+ private pending;
14
+ private timeout?;
15
+ constructor(callback: (events: PendingEvent<E>[]) => void, maxMsBetween?: number);
16
+ private push;
17
+ private refresh;
18
+ private emitPending;
19
+ attach(emitter: EventEmitter, event: string): CancelFn;
20
+ }
@@ -0,0 +1 @@
1
+ export default function isAncestorPath(ancestor: string, descendant: string): boolean;
@@ -0,0 +1,5 @@
1
+ declare enum WellKnownLabels {
2
+ JobCreate = "job.create",
3
+ JobCancel = "job.cancel"
4
+ }
5
+ export default WellKnownLabels;
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@appland/scanner",
3
- "version": "1.83.0",
3
+ "version": "1.83.1",
4
4
  "description": "Analyze AppMaps for code flaws",
5
5
  "bin": "built/cli.js",
6
6
  "main": "built/index.js",
7
7
  "files": [
8
8
  "built",
9
- "doc",
10
- "src/types.d.ts"
9
+ "doc"
11
10
  ],
12
- "types": "src/index.ts",
11
+ "types": "built/index.d.ts",
13
12
  "scripts": {
14
13
  "build": "node bin/preBuild.js && tsc -p tsconfig.build.json && yarn schema && yarn doc",
15
14
  "build-native": "yarn build && ./bin/build-native",
@@ -20,8 +19,8 @@
20
19
  "doc-up-to-date": "git diff --exit-code doc/",
21
20
  "lint": "eslint src --ext .ts",
22
21
  "ci": "yarn lint && yarn build && yarn schema-up-to-date && yarn doc-up-to-date && yarn test",
23
- "test": "jest --filter=./test/testFilter.js",
24
- "jest": "jest --filter=./test/testFilter.js",
22
+ "test": "jest --filter=./test/testFilter.js --detectOpenHandles",
23
+ "jest": "jest --filter=./test/testFilter.js --detectOpenHandles",
25
24
  "semantic-release": "semantic-release",
26
25
  "watch": "node bin/preBuild.js && tsc -p tsconfig.build.json --watch"
27
26
  },
@@ -65,7 +64,7 @@
65
64
  "dependencies": {
66
65
  "@appland/client": "^1.5.0",
67
66
  "@appland/models": "^2.6.3",
68
- "@appland/openapi": "1.6.0",
67
+ "@appland/openapi": "1.6.1",
69
68
  "@appland/sql-parser": "^1.5.0",
70
69
  "@types/cli-progress": "^3.9.2",
71
70
  "ajv": "^8.8.2",
@@ -83,7 +82,7 @@
83
82
  "lru-cache": "^6.0.0",
84
83
  "minimatch": "^5.1.2",
85
84
  "octokit": "^2.0.19",
86
- "openapi-diff": "^0.23.5",
85
+ "openapi-diff": "^0.23.6",
87
86
  "ora": "~5",
88
87
  "pretty-format": "^27.4.6",
89
88
  "read-pkg-up": "^7.0.1",
package/src/types.d.ts DELETED
@@ -1,72 +0,0 @@
1
- import { AppMap, Event } from '@appland/models';
2
- import { SqliteParser } from '@appland/models/types/sqlite-parser';
3
-
4
- /**
5
- * Scope provides an Event at the root of the scope, and a Generator to iterate over its descendants.
6
- */
7
- interface Scope {
8
- scope: Event;
9
- events: () => Generator<Event>;
10
- }
11
-
12
- /**
13
- * Level indicates the priority of a finding.
14
- */
15
- export type Level = 'warning' | 'error';
16
-
17
- type StringFilter = (value: string) => boolean;
18
-
19
- /**
20
- * EventFilter is used by Rule to select Events that will be analyzed for findings.
21
- * The event filter is always applied to the Scope.scope event. If enumerateScope is true,
22
- * the filter is applied to all Scope.events as well.
23
- */
24
- type EventFilter = (e: Event, appMapIndex: AppMapIndex) => boolean;
25
-
26
- /**
27
- * MatchResult is created by a rule when it matches an Event.
28
- */
29
- export interface MatchResult {
30
- level?: Level;
31
- event: Event;
32
- message: string;
33
- participatingEvents?: Record<string, Event>;
34
- groupMessage?: string;
35
- occurranceCount?: number;
36
- relatedEvents?: Event[];
37
- }
38
-
39
- type MatcherResult =
40
- | Promise<boolean | string | MatchResult[]>
41
- | boolean
42
- | string
43
- | MatchResult[]
44
- | undefined;
45
-
46
- type EventType = 'http_server_request' | 'http_client_request' | 'sql_query' | 'function';
47
-
48
- export type QueryAST = SqliteParser.ListStatement | null;
49
-
50
- interface AppMapIndex {
51
- appMap: AppMap;
52
-
53
- sqlAST(event: Event): QueryAST | undefined;
54
-
55
- sqlNormalized(event: Event): string;
56
- }
57
-
58
- /**
59
- * Matcher function is part of a rule. It's applied to an Event to determine whether there is a finding
60
- * on this event. If the Matcher returns true, a string, or a MatchResult[], then finding(s) are created.
61
- */
62
- type Matcher = (e: Event, appMapIndex: AppMapIndex, eventFilter: EventFilter) => MatcherResult;
63
-
64
- export interface RuleLogic {
65
- // Tests an event in the scope see if it matches the rule conditions.
66
- matcher: Matcher;
67
- // When specified by the rule, only events which pass the where filter
68
- // will be passed to the matcher.
69
- where?: EventFilter;
70
- // When specified by the rule, provides a detailed message for a finding on a specific event.
71
- message?: (scope: Event, event: Event) => string;
72
- }