@appland/scanner 1.64.0 → 1.65.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [@appland/scanner-v1.65.0](https://github.com/applandinc/appmap-js/compare/@appland/scanner-v1.64.0...@appland/scanner-v1.65.0) (2022-08-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Remove an inadvenant console log ([5c11fc7](https://github.com/applandinc/appmap-js/commit/5c11fc77650e105f169ca0bcc4045312578e8881))
7
+
8
+
9
+ ### Features
10
+
11
+ * Add unauthenticated-encryption to default rule set ([2e3cf92](https://github.com/applandinc/appmap-js/commit/2e3cf9298b3cfe99b489ab8b2894e913a305fdd0))
12
+ * Check for unauthenticated encryption ([d393951](https://github.com/applandinc/appmap-js/commit/d393951c73c4492f1e95b52a2580fde10b256ee4))
13
+
1
14
  # [@appland/scanner-v1.64.0](https://github.com/applandinc/appmap-js/compare/@appland/scanner-v1.63.0...@appland/scanner-v1.64.0) (2022-08-04)
2
15
 
3
16
 
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ title: 'Unauthenticated encryption',
5
+ enumerateScope: true,
6
+ impactDomain: 'Security',
7
+ references: {
8
+ 'A02:2021': 'https://owasp.org/Top10/A02_2021-Cryptographic_Failures/',
9
+ },
10
+ labels: ['crypto.encrypt', 'crypto.set_auth_data'],
11
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function matcher(event, appMapIndex) {
4
+ if (!event.receiver)
5
+ return;
6
+ const objectId = event.receiver.object_id;
7
+ const setAuthData = appMapIndex.appMap.events
8
+ .filter((evt) => { var _a; return ((_a = evt.receiver) === null || _a === void 0 ? void 0 : _a.object_id) === objectId; })
9
+ .find((evt) => evt.labels.has('crypto.set_auth_data'));
10
+ if (!setAuthData) {
11
+ return [
12
+ {
13
+ event,
14
+ message: 'Encryption is not authenticated',
15
+ },
16
+ ];
17
+ }
18
+ }
19
+ function rule() {
20
+ return {
21
+ matcher,
22
+ where: (e) => e.labels.has('crypto.encrypt'),
23
+ };
24
+ }
25
+ exports.default = rule;
@@ -1,26 +1,27 @@
1
1
  checks:
2
- - rule: authzBeforeAuthn
3
- # - rule: circularDependency
4
- - rule: deserializationOfUntrustedData
5
- - rule: execOfUntrustedCommand
6
- - rule: http500
7
- # - rule: illegalPackageDependency
8
- # - rule: incompatibleHttpClientRequest
9
- # - rule: insecureCompare
10
- # - rule: jobNotCancelled
11
- - rule: logoutWithoutSessionReset
12
- # - rule: missingAuthentication
13
- - rule: missingContentType
14
- - rule: nPlusOneQuery
15
- # - rule: queryFromInvalidPackage
16
- # - rule: queryFromView
17
- # - rule: rpcWithoutCircuitBreaker
18
- # - rule: saveWithoutValidation
19
- - rule: secretInLog
20
- # - rule: slowFunctionCall
21
- # - rule: slowHttpServerRequest
22
- # - rule: slowQuery
23
- - rule: tooManyJoins
24
- - rule: tooManyUpdates
25
- # - rule: unbatchedMaterializedQuery
26
- - rule: updateInGetRequest
2
+ - rule: authz-before-authn
3
+ # - rule: circular-dependency
4
+ - rule: deserialization-of-untrusted-data
5
+ - rule: exec-of-untrusted-command
6
+ - rule: http-500
7
+ # - rule: illegal-package-dependency
8
+ # - rule: incompatible-http-client-request
9
+ # - rule: insecure-compare
10
+ # - rule: job-not-cancelled
11
+ - rule: logout-without-session-reset
12
+ # - rule: missing-authentication
13
+ - rule: missing-content-type
14
+ - rule: n-plus-one-query
15
+ # - rule: query-from-invalid-package
16
+ # - rule: query-from-view
17
+ # - rule: rpc-without-circuit-breaker
18
+ # - rule: save-without-validation
19
+ - rule: secret-in-log
20
+ # - rule: slow-function-call
21
+ # - rule: slow-httpServer-request
22
+ # - rule: slow-query
23
+ - rule: too-many-joins
24
+ - rule: too-many-updates
25
+ # - rule: unbatched-materialized-query
26
+ - rule: unauthenticated-encryption
27
+ - rule: update-in-get-request
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: crypto.encrypt
3
+ rules:
4
+ - unauthenticated-encryption
5
+ ---
6
+
7
+ A function that performs encryption.
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: crypto.set_auth_data
3
+ rules:
4
+ - unauthenticated-encryption
5
+ ---
6
+
7
+ A function that sets authenticated data for an encryption operation.
@@ -0,0 +1,42 @@
1
+ ---
2
+ rule: unauthenticated-encryption
3
+ name: Unauthenticated encryption
4
+ title: Unauthenticated encryption
5
+ references:
6
+ A02:2021: https://owasp.org/Top10/A02_2021-Cryptographic_Failures/
7
+ impactDomain: Security
8
+ labels:
9
+ - crypto.encrypt
10
+ - crypto.set_auth_data
11
+ ---
12
+
13
+ Ensures that encryption operations use authenticated encryption.
14
+
15
+ ### Rule logic
16
+
17
+ Finds all events labeled `crypto.encrypt`. For each of these events, there should be another event
18
+ in the same AppMap that has the same `receiver.object_id` and also has the label
19
+ `crypto.set_auth_data`.
20
+
21
+ ### Notes
22
+
23
+ [OWASP recommends against the use of unauthenticated encryption](https://owasp.org/Top10/A02_2021-Cryptographic_Failures/).
24
+
25
+ ### Resolution
26
+
27
+ Change the encryption code to use a current authenticated encryption algorithm. At the time of this
28
+ writing, an example is `aes-256-gcm`.
29
+
30
+ Examples:
31
+
32
+ - [`OpenSSL::Cipher#auth_data=` (Ruby)](https://ruby-doc.org/stdlib-3.1.1/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-auth_data-3D)
33
+
34
+ ### Options
35
+
36
+ None
37
+
38
+ ### Examples
39
+
40
+ ```yaml
41
+ - rule: unauthenticated-encryption
42
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appland/scanner",
3
- "version": "1.64.0",
3
+ "version": "1.65.0",
4
4
  "description": "",
5
5
  "bin": "built/cli.js",
6
6
  "files": [