@appland/scanner 1.70.1 → 1.70.2

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.
@@ -1,48 +1,63 @@
1
1
  ## Scanner architecture
2
2
 
3
- See [@appland/models source code](https://github.com/applandinc/appmap-js/tree/main/packages/models) for the JS API to AppMap data.
3
+ See [@appland/models source code](https://github.com/applandinc/appmap-js/tree/main/packages/models)
4
+ for the JS API to AppMap data.
4
5
 
5
6
  ## Assertions
6
7
 
7
- An Assertion tests each configured AppMap event to see if it matches some condition. The test is applied by a `matcher` fnuction.
8
+ An Assertion tests each configured AppMap event to see if it matches some condition. The test is
9
+ applied by a `matcher` fnuction.
8
10
 
9
- If there is a match, the assertion returns a Finding. A Finding contains the type of check, the event, and a descriptive message. Supporting (related) events may also be reported.
11
+ If there is a match, the assertion returns a Finding. A Finding contains the type of check, the
12
+ event, and a descriptive message. Supporting (related) events may also be reported.
10
13
 
11
14
  ## Scopes
12
15
 
13
- Each Assertion declares a Scope. The Scope is the set of events that will be checked by an instance of the Assertion object. An Assertion can use a narrower scope to help avoid giving false positives. For example, consider an Assertion that looks for "too many SQL queries". The Assertion only wants to count SQL queries within the Scope of a single command - not the entire AppMap.
14
-
16
+ Each Assertion declares a Scope. The Scope is the set of events that will be checked by an instance
17
+ of the Assertion object. An Assertion can use a narrower scope to help avoid giving false positives.
18
+ For example, consider an Assertion that looks for "too many SQL queries". The Assertion only wants
19
+ to count SQL queries within the Scope of a single command - not the entire AppMap.
15
20
 
16
21
  Scope examples (roughly ordered from broadest to narrowest):
17
22
 
18
- * `all` All events in the AppMap will be processed by the same Assertion instance.
19
- * `root` A new Assertion instance is created for each root event.
20
- * `command` A new Assertion instance is created for each HTTP server request, and for each event that is not a descendant of an HTTP server request AND has the label `command` or `job`.
21
- * `http_server_request` A new Assertion instance is created for each HTTP server request.
22
- * `transaction` A new Assertion instance is created for each database transaction in the AppMap.
23
+ - `all` All events in the AppMap will be processed by the same Assertion instance.
24
+ - `root` A new Assertion instance is created for each root event.
25
+ - `command` A new Assertion instance is created for each HTTP server request, and for each event
26
+ that is not a descendant of an HTTP server request AND has the label `command` or `job`.
27
+ - `http_server_request` A new Assertion instance is created for each HTTP server request.
28
+ - `transaction` A new Assertion instance is created for each database transaction in the AppMap.
23
29
 
24
30
  ## Event filters
25
31
 
26
32
  Assertions use Event filters to choose which events are processed by the `matcher` function.
27
33
 
28
- Event filters include the `where`, `include` and `exclude` conditions. Events must match the `where` and `include` conditions, and must not match the `exclude` condition. The `where` condition is built into the Assertion. The `include` and `exclude` conditions are blank, and exist to be customized by the user.
34
+ Event filters include the `where`, `include` and `exclude` conditions. Events must match the `where`
35
+ and `include` conditions, and must not match the `exclude` condition. The `where` condition is built
36
+ into the Assertion. The `include` and `exclude` conditions are blank, and exist to be customized by
37
+ the user.
29
38
 
30
39
  ## Examples
31
40
 
32
41
  ### HTTP 500
33
42
 
34
- `http-500` assertion is a simple example. It specifies the `http_server_request` scope - so that each HTTP server request is processed by a separate Assertion.
43
+ `http-500` assertion is a simple example. It specifies the `http_server_request` scope - so that
44
+ each HTTP server request is processed by a separate Assertion.
35
45
 
36
- The `where` condition filter out events that don't have an `http_server_response` - for example, if the server process was hard-killed in the middle of processing.
46
+ The `where` condition filter out events that don't have an `http_server_response` - for example, if
47
+ the server process was hard-killed in the middle of processing.
37
48
 
38
49
  The `matcher` function returns true if the HTTP status code is between 500 and 599.
39
50
 
40
51
  ### Insecure compare
41
52
 
42
- `insecure-compare` operates on the `all` scope - it looks for insecure compare across the entire AppMap.
53
+ `insecure-compare` operates on the `all` scope - it looks for insecure compare across the entire
54
+ AppMap.
43
55
 
44
- The `where` clause selects events that are labeled `string.equals` or `secret`. The `secret` label is used to build a Set of all the secrets that are generated/returned by function events in the AppMap. When a `string.equals` function is encountered, the assertion returns true if:
56
+ The `where` clause selects events that are labeled `string.equals` or `secret`. The `secret` label
57
+ is used to build a Set of all the secrets that are generated/returned by function events in the
58
+ AppMap. When a `string.equals` function is encountered, the assertion returns true if:
45
59
 
46
60
  1. The function has a receiver value and one parameter.
47
61
  2. Both the receiver value and the parameter value are not BCrypted-strings.
48
- 3. Both the receiver value and the parameter value are either (a) a known secret or (b) match a secret regexp
62
+ 3. Both the receiver value and the parameter value are either (a) a known secret or (b) match a
63
+ secret regexp
@@ -11,4 +11,4 @@ Indicates that a function does not guarantee safe deserialization.
11
11
  - Ruby [YAML.unsafe_load](https://docs.ruby-lang.org/en/3.0/Psych.html#method-c-unsafe_load)
12
12
  - Ruby [Marshal.load](https://docs.ruby-lang.org/en/3.0/Marshal.html#method-c-load)
13
13
  - Java
14
- [javax.jms.ObjectMessage#getObject](https://docs.oracle.com/javaee/6/api/javax/jms/ObjectMessage.html#getObject())
14
+ [javax.jms.ObjectMessage#getObject](<https://docs.oracle.com/javaee/6/api/javax/jms/ObjectMessage.html#getObject()>)
@@ -18,27 +18,27 @@ data comes from an untrusted source and hasn't passed through a sanitization mec
18
18
 
19
19
  ### Rule logic
20
20
 
21
- Finds all events labeled `deserialize.unsafe` that receive tainted data (as
22
- determined by object identity or string value) as an input.
21
+ Finds all events labeled `deserialize.unsafe` that receive tainted data (as determined by object
22
+ identity or string value) as an input.
23
23
 
24
24
  For each of these events; checks if all the inputs have been sanitized.
25
25
 
26
- Data that has been passed to a function labeled `deserialize.sanitize` is
27
- assumed to be sanitized from this point onwards. Such a function could either
28
- check the value is sanitized (note no verification is currently done to ensure
29
- this result is checked) or return the transformed value after any necessary sanitization.
26
+ Data that has been passed to a function labeled `deserialize.sanitize` is assumed to be sanitized
27
+ from this point onwards. Such a function could either check the value is sanitized (note no
28
+ verification is currently done to ensure this result is checked) or return the transformed value
29
+ after any necessary sanitization.
30
30
 
31
- Data passed to a function labeled `deserialized.safe` is considered in all
32
- functions called by it (down the callstack). Functions that first sanitize data
33
- and then use an unsafe deserialization function should carry this label.
31
+ Data passed to a function labeled `deserialized.safe` is considered in all functions called by it
32
+ (down the callstack). Functions that first sanitize data and then use an unsafe deserialization
33
+ function should carry this label.
34
34
 
35
- The set of tracked tainted data initially includes the HTTP message parameters
36
- and is expanded to include any non-primitive (ie. longer than 5 characters)
37
- observed outputs of functions that consume tainted data.
35
+ The set of tracked tainted data initially includes the HTTP message parameters and is expanded to
36
+ include any non-primitive (ie. longer than 5 characters) observed outputs of functions that consume
37
+ tainted data.
38
38
 
39
- The reliability of this rule now depends on completeness of the AppMap.
40
- If there is a data transformation that is not captured it's invisible to the
41
- rule and will result in failure to associate it with the tracked untrusted data.
39
+ The reliability of this rule now depends on completeness of the AppMap. If there is a data
40
+ transformation that is not captured it's invisible to the rule and will result in failure to
41
+ associate it with the tracked untrusted data.
42
42
 
43
43
  ### Notes
44
44
 
@@ -47,12 +47,13 @@ that executes code shortly after deserialization.
47
47
 
48
48
  ### Resolution
49
49
 
50
- Consider if the library you're using offers a safe deserialization function variant that you can
51
- use instead. Using unsafe functions is only rarely needed and typically requires a good reason.
50
+ Consider if the library you're using offers a safe deserialization function variant that you can use
51
+ instead. Using unsafe functions is only rarely needed and typically requires a good reason.
52
52
 
53
53
  If you need to use the unsafe function, make sure you're able to handle unexpected input safely.
54
- Sanitize the data thoroughly first; label the sanitization function with `deserialize.sanitize` label
55
- or wrap the whole sanitization and deserialization logic in a function labeled `deserialize.safe`.
54
+ Sanitize the data thoroughly first; label the sanitization function with `deserialize.sanitize`
55
+ label or wrap the whole sanitization and deserialization logic in a function labeled
56
+ `deserialize.safe`.
56
57
 
57
58
  If you need to deserialize untrusted data, JSON is often a good choice as it is only capable of
58
59
  returning ‘primitive’ types such as strings, arrays, hashes, numbers and nil. If you need to
@@ -8,7 +8,6 @@ impactDomain: Performance
8
8
  scope: command
9
9
  ---
10
10
 
11
-
12
11
  Finds occurrences of a query being repeated within a loop.
13
12
 
14
13
  ### Rule logic
@@ -29,8 +29,8 @@ the allowed packages.
29
29
 
30
30
  - `allowedPackages: `[MatchPatternConfig](/docs/analysis/match-pattern-config.html)`[]`. Packages
31
31
  which are allowed to make queries. Required.
32
- - `allowedQueries: `[MatchPatternConfig](/docs/analysis/match-pattern-config.html)`[]`. Queries which
33
- are allowed from anywhere. Default:
32
+ - `allowedQueries: `[MatchPatternConfig](/docs/analysis/match-pattern-config.html)`[]`. Queries
33
+ which are allowed from anywhere. Default:
34
34
  `[/\bBEGIN\b/i, /\bCOMMIT\b/i, /\bROLLBACK\b/i, /\bRELEASE\b/i, /\bSAVEPOINT\b/i]`.
35
35
 
36
36
  ### Examples
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appland/scanner",
3
- "version": "1.70.1",
3
+ "version": "1.70.2",
4
4
  "description": "",
5
5
  "bin": "built/cli.js",
6
6
  "files": [
@@ -46,7 +46,7 @@
46
46
  "nock": "^13.2.2",
47
47
  "openapi-types": "^9.3.0",
48
48
  "pkg": "^5.5.2",
49
- "prettier": "^2.3.2",
49
+ "prettier": "^2.7.1",
50
50
  "semantic-release": "^19.0.2",
51
51
  "sinon": "^13.0.1",
52
52
  "tmp-promise": "^3.0.3",
@@ -77,6 +77,7 @@
77
77
  "minimatch": "^3.0.4",
78
78
  "octokat": "^0.10.0",
79
79
  "openapi-diff": "^0.23.5",
80
+ "ora": "~5",
80
81
  "pretty-format": "^27.4.6",
81
82
  "read-pkg-up": "^7.0.1",
82
83
  "supports-hyperlinks": "^2.2.0",