@ti-engine/core 1.10.0 → 1.11.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.
- package/CHANGELOG.md +69 -0
- package/LICENSE.md +204 -322
- package/README.md +2 -2
- package/bin/start-instance.js +12 -3
- package/components/auditing.js +12 -3
- package/components/connection-observer.js +12 -3
- package/components/definitions.types.js +12 -3
- package/components/exchange/default/default-message-exchange.js +12 -3
- package/components/exchange/default/default-message-receiver.js +12 -3
- package/components/exchange/default/default-message-sender.js +12 -3
- package/components/exchange/message-dispatcher.js +12 -3
- package/components/exchange/message-exchange.js +12 -3
- package/components/exchange/message-handler.js +12 -3
- package/components/exchange/message-memory-cache.js +12 -3
- package/components/exchange/message-observer.js +12 -3
- package/components/exchange/message-receiver.js +12 -3
- package/components/exchange/message-sender.js +12 -3
- package/components/exchange/message-tracer.js +12 -3
- package/components/service-caller.js +12 -3
- package/components/service-consumer.js +12 -3
- package/components/service-executor.js +12 -3
- package/components/service-instance.js +12 -3
- package/components/service-provider.js +12 -3
- package/integrations/redis-integration.js +12 -3
- package/package.json +3 -3
- package/types/utils/cache.d.ts +36 -0
- package/utils/cache.js +69 -11
- package/utils/config.js +12 -3
- package/utils/exceptions.js +12 -3
- package/utils/localization.js +12 -3
- package/utils/logger.js +12 -3
- package/utils/tools.js +30 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,75 @@
|
|
|
2
2
|
|
|
3
3
|
This document contains the list of changes made to the framework. The format is based on the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
|
|
4
4
|
|
|
5
|
+
## Version 1.11.1
|
|
6
|
+
|
|
7
|
+
License change only — no functional code changed.
|
|
8
|
+
|
|
9
|
+
* chore(license): relicense package from `GPL-3.0-or-later` to `Apache-2.0`. See `LICENSE` and `NOTICE`
|
|
10
|
+
* docs(license): update every source file's license header to the Apache-2.0 notice
|
|
11
|
+
|
|
12
|
+
## Version 1.11.0
|
|
13
|
+
|
|
14
|
+
`decycle` silently lost a key named `__proto__` and corrupted the surrounding document. It built its replica as `{}`
|
|
15
|
+
and copied keys in by bracket assignment, so that one name hit the inherited prototype setter instead of becoming an
|
|
16
|
+
own property: the key vanished and its value became the replica's prototype, which `stringifyJSON` then flattened
|
|
17
|
+
back in as unrelated top-level keys. An object with an own `__proto__` key holding `{ hello: 1 }` alongside an `ada`
|
|
18
|
+
key serialized to `{"ada":{…},"hello":1}` — the key gone and `hello` promoted to a sibling. (Note the input cannot be
|
|
19
|
+
written as an object literal: in `{ __proto__: x }` that name is a prototype setter, not a key, even quoted. Only a
|
|
20
|
+
computed key or an assignment onto `Object.create( null )` produces the property this bug needed.)
|
|
21
|
+
|
|
22
|
+
This reached Redis: `cache.setJSON` serializes with `stringifyJSON`, so any caller storing such a key lost it against
|
|
23
|
+
a real cache. `decycle` also runs on the message-exchange integrity-hash path, and over an exception's `data` whenever
|
|
24
|
+
`raise` is given one. No test caught it because web-framework's in-memory cache double clones with
|
|
25
|
+
`JSON.parse( JSON.stringify( … ) )` and never reaches `stringifyJSON`.
|
|
26
|
+
|
|
27
|
+
**This is a minor rather than a patch release because it requires a consumer code change** — see the note below. The
|
|
28
|
+
fix is a bug fix, but the replica's prototype is part of the observable contract.
|
|
29
|
+
|
|
30
|
+
* fix(tools): build `decycle`'s object replica with `Object.create( null )`, so a key named `__proto__` is an ordinary
|
|
31
|
+
own key with no setter to hit. Verified against both consumers of the output — `_.isPlainObject` accepts a
|
|
32
|
+
null-prototype object, so `decomposeJSON` (message hashing) and `_.toPlainObject` (serialization) are unaffected
|
|
33
|
+
* fix(tools): the same guard in `errorToJSON`, which copied an error's own property names with the identical pattern
|
|
34
|
+
* fix(cache)!: `Cache.getValues( keys, prefix )` resolved **every key to `null`**, whatever Redis returned. Its ternary
|
|
35
|
+
inspected `results`, the accumulator being built, instead of `result`, the per-key `[ error, value ]` entry — and
|
|
36
|
+
`{}.length` is `undefined`, so the comparison was always false. The single-key `getValue()` had the correct form; the
|
|
37
|
+
two expressions were near-identical and one drifted. No first-party caller existed, which is why nothing caught it.
|
|
38
|
+
The per-entry decode and the key mapping are now two shared module-level functions (`decodeCommandValue`,
|
|
39
|
+
`mapCommandValues`, exported for testing) rather than duplicated inline expressions, so the drift cannot recur. The
|
|
40
|
+
mapping iterates the requested keys rather than the raw results, so a short response yields an entry per requested
|
|
41
|
+
key instead of silently omitting some, and its accumulator is a null-prototype object for the same reason as above —
|
|
42
|
+
cache keys come from the caller, and one named `__proto__` would otherwise repoint the map's prototype. Marked
|
|
43
|
+
breaking only because the returned map now has a null prototype (see the note below); the value behaviour is a
|
|
44
|
+
straight bug fix
|
|
45
|
+
* test(tools): pin the regression, the cycle handling it must not break, the `decomposeJSON` and `retrocycle` paths,
|
|
46
|
+
and the fact that a key named `constructor` was **never** affected — it is an ordinary writable data property, so
|
|
47
|
+
bracket assignment always shadowed it correctly, and the fix's shape should not imply otherwise
|
|
48
|
+
* build(release): bump package version from `1.10.0` to `1.11.0`
|
|
49
|
+
|
|
50
|
+
`retrocycle` was checked and is not affected: it mutates objects that already came through `JSON.parse`, which creates
|
|
51
|
+
`__proto__` as an own data property, and assignment to an existing own property shadows the inherited setter.
|
|
52
|
+
|
|
53
|
+
**Breaking for consumers who touch the returned object directly.** The objects returned by `decycle`, by `errorToJSON`
|
|
54
|
+
for an `Error`, and by `Cache.getValues` now have a **null prototype**, so they inherit nothing from `Object.prototype`. Passing
|
|
55
|
+
them to `JSON.stringify`, lodash, or `decomposeJSON` is unaffected; the following are not, and the first two throw
|
|
56
|
+
rather than merely behaving differently:
|
|
57
|
+
|
|
58
|
+
| Expression on the returned object | Before | Now |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| `` `${ result }` ``, `String( result )`, `result + ""` | `"[object Object]"` | **`TypeError: Cannot convert object to primitive value`** |
|
|
61
|
+
| `result.toString()`, `result.valueOf()` | works | **`TypeError`** |
|
|
62
|
+
| `result.hasOwnProperty( key )` | works | **`TypeError`** — use `Object.prototype.hasOwnProperty.call( result, key )` |
|
|
63
|
+
| `result instanceof Object` | `true` | `false` |
|
|
64
|
+
| `result.constructor` | `Object` | `undefined` |
|
|
65
|
+
|
|
66
|
+
The likeliest way to hit this is interpolating an `errorToJSON` result straight into a log line. Wrap such a value in
|
|
67
|
+
`_.cloneDeep( … )` — which normalizes the prototype back — or serialize it explicitly. No call site in this monorepo
|
|
68
|
+
does any of the above; every first-party `hasOwnProperty` use is already the `Object.prototype.…call` form.
|
|
69
|
+
|
|
70
|
+
**Mixed-version note:** for the rare message carrying a literal `__proto__` key, an old sender and an upgraded receiver
|
|
71
|
+
compute different `createMessageHash` values, so the receiver raises `E_SEC_MESSAGE_TAMPERING_DETECTED`. Such messages
|
|
72
|
+
were already being corrupted in transit, so this surfaces a pre-existing problem rather than creating one.
|
|
73
|
+
|
|
5
74
|
## Version 1.10.0
|
|
6
75
|
|
|
7
76
|
* feat(localization): `getLabel( label, language, fallback )` takes an optional third argument returned when the key
|