@theokit/gateway 0.15.0 → 0.16.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 +28 -0
- package/dist/index.cjs +33 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -3
- package/dist/index.d.ts +45 -3
- package/dist/index.js +33 -87
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f8ba934: Fix `defaultStrategy` giving two different senders the same session key. Ids that differed only by `-` versus `_` (sender, channel or topic) collided. Ids are now escaped (`_` to `__`, `-` to `_d`), so distinct ids always give distinct keys. Note: the session key of any existing session whose id contains `_` or `-` changes, so consumers with stored sessions may need a one-time migration.
|
|
8
|
+
|
|
9
|
+
## 0.16.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 6178f72: Make `qq` a first-party platform.
|
|
14
|
+
|
|
15
|
+
`@theokit/gateway` gains the `qq` key in `PlatformEventRegistry`, the `QQMessageEvent` type and a
|
|
16
|
+
`channelRendering` row (`plain`, markers removed). `PlatformName` grows by one member. Code that
|
|
17
|
+
lists every platform in a `Record<PlatformName, …>` or in a switch with a `never` default must add
|
|
18
|
+
it.
|
|
19
|
+
|
|
20
|
+
- 971efb1: Make `x` a first-party platform.
|
|
21
|
+
|
|
22
|
+
`@theokit/gateway` gains the `x` key in `PlatformEventRegistry`, the `XMessageEvent` and
|
|
23
|
+
`XThreadTweet` types and a `channelRendering` row (`plain`, markers removed). `PlatformName` grows
|
|
24
|
+
by one member. Code that lists every platform in a `Record<PlatformName, …>` or in a switch with a
|
|
25
|
+
`never` default must add it.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- c6ee490: Restructure the QQ adapter and write the credential-shape and platform tables as rows, so they no longer repeat the same structure entry after entry. Behaviour and exports are unchanged.
|
|
30
|
+
|
|
3
31
|
## 0.15.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -201,6 +201,8 @@ var RENDERINGS = {
|
|
|
201
201
|
wechat: { format: "plain", translate: translateWith(STRIP) },
|
|
202
202
|
wecom: { format: "plain", translate: translateWith(STRIP) },
|
|
203
203
|
yuanbao: { format: "plain", translate: translateWith(STRIP) },
|
|
204
|
+
qq: { format: "plain", translate: translateWith(STRIP) },
|
|
205
|
+
x: { format: "plain", translate: translateWith(STRIP) },
|
|
204
206
|
raft: { format: "plain", translate: translateWith(STRIP) }
|
|
205
207
|
};
|
|
206
208
|
function channelRendering(platform) {
|
|
@@ -670,6 +672,35 @@ var GatewayLifecycleError = class extends Error {
|
|
|
670
672
|
this.code = opts.code;
|
|
671
673
|
}
|
|
672
674
|
};
|
|
675
|
+
var UNCOVERED_TABLE = `gateway-qq \`appSecret\` :: a QQ Bot AppSecret, an opaque 32-character string with no prefix or fixed shape. It travels only to the access-token endpoint and into the webhook signature derivation; the adapter never logs it.
|
|
676
|
+
gateway-x \`clientSecret\`, \`refreshToken\`, \`bearerToken\` :: an X OAuth 2.0 client secret, a rotating refresh token and an app bearer token, opaque strings with no fixed prefix. They travel only to the X API in Authorization headers and the token request body, which the adapter never logs.
|
|
677
|
+
gateway-buzz \`token\` :: a Buzz bot token with no fixed shape this package could confirm. It travels only in Authorization headers, which the adapter never logs.
|
|
678
|
+
gateway-clickclack \`token\` :: a ClickClack bot token (\`ccb_\` prefix) or session token with no fixed shape for the latter. It travels only in Authorization headers, which the adapter never logs.
|
|
679
|
+
gateway-zalo \`accessToken\`, \`oaSecretKey\` :: a Zalo Official Account access token and OA secret key: opaque strings with no prefix or fixed shape to recognise. The token travels only in an \`access_token\` header and the key only into the signature check, and the adapter never logs either.
|
|
680
|
+
gateway-wechat \`appSecret\`, \`token\` :: a WeChat Official Account AppSecret (32 hex characters, indistinguishable from any other hex string) and the server-URL verification token (a string the operator chooses). The secret travels only to the access-token endpoint and the token only into the signature check; the adapter never logs either.
|
|
681
|
+
gateway-wecom \`corpSecret\`, \`token\`, \`encodingAesKey\` :: a WeCom application Secret (43 URL-safe base64 characters, indistinguishable from other opaque strings), the callback Token (a string the operator chooses) and the EncodingAESKey (43 base64 characters). The secret travels only to the access-token endpoint, the token into the signature check and the key into the decryption; the adapter never logs any of them.
|
|
682
|
+
gateway-yuanbao \`appSecret\`, \`callbackSecret\` :: a Yuanbao bot AppSecret and the callback signing secret, both opaque strings with no prefix or fixed shape. The app secret travels only to the access-token endpoint and the callback secret only into the signature check; the adapter never logs either.
|
|
683
|
+
gateway-zalo-personal \`credentials\` :: a Zalo web session: a cookie jar, an IMEI-like device id and a user agent. The cookie has no prefix or fixed shape to recognise. It travels only to the Zalo library, which the adapter never logs.
|
|
684
|
+
gateway-twitch \`accessToken\` :: 30 lowercase alphanumerics with no prefix, the shape of many ids and hashes in a log. It travels only in Authorization headers, which the adapter never logs.
|
|
685
|
+
gateway-tlon-urbit \`code\` :: a +code is four dash-joined phonemic syllable words, the same shape as an Urbit ship name such as ~sampel-palnet-sampel-palnet, which the logs exist to show. It travels only in the /~/login body, which the adapter never logs.
|
|
686
|
+
gateway-synology-chat \`botToken\` and \`incomingUrl\` :: a bot token is a random string the NAS generates with no prefix, and the Incoming URL carries its own token as a query parameter of an ordinary entry.cgi URL. Neither has a shape to claim without eating ordinary ids and URLs; the adapter never logs the URL, and refuses a callback token before reading it.
|
|
687
|
+
gateway-feishu-lark \`appSecret\` :: 32 alphanumerics with no prefix, the shape of many tokens and hashes; it travels only in the body of the tenant-token request, which the adapter never logs.
|
|
688
|
+
gateway-nostr \`secretKey\` (64-hex form) :: 64 hex characters is also every Nostr public key and event id, which the logs exist to show, and a sha256 digest. The nsec1 spelling of the same key is masked above.
|
|
689
|
+
gateway-sms \`authToken\` (Twilio), gateway-line \`channelSecret\` :: 32 lowercase hex characters, which is also an md5 digest, a dashless UUID and half a git tree hash. Masking it would eat the correlation id a developer reads the log to find.
|
|
690
|
+
gateway-mattermost \`accessToken\` :: 26 lowercase alphanumerics, which is exactly a lowercase ULID \u2014 the shape of most trace ids.
|
|
691
|
+
gateway-email \`password\`, gateway-sms \`apiSecret\` and \`signatureSecret\` (Vonage) :: no format of their own; a passphrase is indistinguishable from prose. The SDK's own \`key=value\` rule already masks these fully wherever they appear as \`field=value\`, and adding a pattern here made that WORSE by claiming the value first \u2014 it was masked as first6\u2026last4 instead of removed.
|
|
692
|
+
gateway-slack \`botToken\` :: already masked by one of the SDK's own twelve built-in patterns \u2014 \`xoxb-\` is Slack's and the SDK knows it. A pattern here would be a second one doing the first's work, and the field-level gate flagged its absence, which is the gate working.
|
|
693
|
+
gateway-whatsapp \`appSecret\` :: 32 lowercase hex, the same shape as the Twilio auth token above and as every md5 and dashless UUID. Masking it would eat the correlation ids in a log.
|
|
694
|
+
gateway-nextcloud-talk \`secret\` :: a Talk bot secret is a string of 40 to 128 characters the administrator chose for \`occ talk:bot:install\`, with no prefix or format to recognise. It never travels: both sides send only an HMAC made with it, and the adapter never logs it.
|
|
695
|
+
gateway-irc \`password\` and \`saslPassword\` :: a server password and a NickServ password are passphrases the operator chose, with no format to recognise. The SDK's \`key=value\` rule masks them as fields wherever they appear as \`password=...\`; the SASL payload on the wire is their base64, which the adapter never logs.
|
|
696
|
+
gateway-google-chat \`privateKey\` :: a PEM block spans lines, and in a log it usually arrives inside a JSON string with its line breaks escaped as \\n, which no single-line shape can claim whole. The SDK's \`key=value\` rule masks it as a field wherever it appears as \`private_key=...\` or \`privateKey=...\`.
|
|
697
|
+
gateway-line \`channelAccessToken\`, gateway-sms \`authToken\` (Plivo) :: long base64 runs with no prefix, indistinguishable from any encoded blob a platform library puts in an error message.`;
|
|
698
|
+
function parseUncovered(table) {
|
|
699
|
+
return table.split("\n").map((row) => {
|
|
700
|
+
const [field = "", why = ""] = row.split(" :: ");
|
|
701
|
+
return { field, why };
|
|
702
|
+
});
|
|
703
|
+
}
|
|
673
704
|
var CREDENTIAL_SHAPES = {
|
|
674
705
|
covered: [
|
|
675
706
|
{
|
|
@@ -708,92 +739,7 @@ var CREDENTIAL_SHAPES = {
|
|
|
708
739
|
alsoMatches: "nothing plausible \u2014 `nsec1` is NIP-19's prefix for a secret key"
|
|
709
740
|
}
|
|
710
741
|
],
|
|
711
|
-
uncovered:
|
|
712
|
-
{
|
|
713
|
-
field: "gateway-buzz `token`",
|
|
714
|
-
why: "a Buzz bot token with no fixed shape this package could confirm. It travels only in Authorization headers, which the adapter never logs."
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
field: "gateway-clickclack `token`",
|
|
718
|
-
why: "a ClickClack bot token (`ccb_` prefix) or session token with no fixed shape for the latter. It travels only in Authorization headers, which the adapter never logs."
|
|
719
|
-
},
|
|
720
|
-
{
|
|
721
|
-
field: "gateway-zalo `accessToken`, `oaSecretKey`",
|
|
722
|
-
why: "a Zalo Official Account access token and OA secret key: opaque strings with no prefix or fixed shape to recognise. The token travels only in an `access_token` header and the key only into the signature check, and the adapter never logs either."
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
field: "gateway-wechat `appSecret`, `token`",
|
|
726
|
-
why: "a WeChat Official Account AppSecret (32 hex characters, indistinguishable from any other hex string) and the server-URL verification token (a string the operator chooses). The secret travels only to the access-token endpoint and the token only into the signature check; the adapter never logs either."
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
field: "gateway-wecom `corpSecret`, `token`, `encodingAesKey`",
|
|
730
|
-
why: "a WeCom application Secret (43 URL-safe base64 characters, indistinguishable from other opaque strings), the callback Token (a string the operator chooses) and the EncodingAESKey (43 base64 characters). The secret travels only to the access-token endpoint, the token into the signature check and the key into the decryption; the adapter never logs any of them."
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
field: "gateway-yuanbao `appSecret`, `callbackSecret`",
|
|
734
|
-
why: "a Yuanbao bot AppSecret and the callback signing secret, both opaque strings with no prefix or fixed shape. The app secret travels only to the access-token endpoint and the callback secret only into the signature check; the adapter never logs either."
|
|
735
|
-
},
|
|
736
|
-
{
|
|
737
|
-
field: "gateway-zalo-personal `credentials`",
|
|
738
|
-
why: "a Zalo web session: a cookie jar, an IMEI-like device id and a user agent. The cookie has no prefix or fixed shape to recognise. It travels only to the Zalo library, which the adapter never logs."
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
field: "gateway-twitch `accessToken`",
|
|
742
|
-
why: "30 lowercase alphanumerics with no prefix, the shape of many ids and hashes in a log. It travels only in Authorization headers, which the adapter never logs."
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
field: "gateway-tlon-urbit `code`",
|
|
746
|
-
why: "a +code is four dash-joined phonemic syllable words, the same shape as an Urbit ship name such as ~sampel-palnet-sampel-palnet, which the logs exist to show. It travels only in the /~/login body, which the adapter never logs."
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
field: "gateway-synology-chat `botToken` and `incomingUrl`",
|
|
750
|
-
why: "a bot token is a random string the NAS generates with no prefix, and the Incoming URL carries its own token as a query parameter of an ordinary entry.cgi URL. Neither has a shape to claim without eating ordinary ids and URLs; the adapter never logs the URL, and refuses a callback token before reading it."
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
field: "gateway-feishu-lark `appSecret`",
|
|
754
|
-
why: "32 alphanumerics with no prefix, the shape of many tokens and hashes; it travels only in the body of the tenant-token request, which the adapter never logs."
|
|
755
|
-
},
|
|
756
|
-
{
|
|
757
|
-
field: "gateway-nostr `secretKey` (64-hex form)",
|
|
758
|
-
why: "64 hex characters is also every Nostr public key and event id, which the logs exist to show, and a sha256 digest. The nsec1 spelling of the same key is masked above."
|
|
759
|
-
},
|
|
760
|
-
{
|
|
761
|
-
field: "gateway-sms `authToken` (Twilio), gateway-line `channelSecret`",
|
|
762
|
-
why: "32 lowercase hex characters, which is also an md5 digest, a dashless UUID and half a git tree hash. Masking it would eat the correlation id a developer reads the log to find."
|
|
763
|
-
},
|
|
764
|
-
{
|
|
765
|
-
field: "gateway-mattermost `accessToken`",
|
|
766
|
-
why: "26 lowercase alphanumerics, which is exactly a lowercase ULID \u2014 the shape of most trace ids."
|
|
767
|
-
},
|
|
768
|
-
{
|
|
769
|
-
field: "gateway-email `password`, gateway-sms `apiSecret` and `signatureSecret` (Vonage)",
|
|
770
|
-
why: "no format of their own; a passphrase is indistinguishable from prose. The SDK's own `key=value` rule already masks these fully wherever they appear as `field=value`, and adding a pattern here made that WORSE by claiming the value first \u2014 it was masked as first6\u2026last4 instead of removed."
|
|
771
|
-
},
|
|
772
|
-
{
|
|
773
|
-
field: "gateway-slack `botToken`",
|
|
774
|
-
why: "already masked by one of the SDK's own twelve built-in patterns \u2014 `xoxb-` is Slack's and the SDK knows it. A pattern here would be a second one doing the first's work, and the field-level gate flagged its absence, which is the gate working."
|
|
775
|
-
},
|
|
776
|
-
{
|
|
777
|
-
field: "gateway-whatsapp `appSecret`",
|
|
778
|
-
why: "32 lowercase hex, the same shape as the Twilio auth token above and as every md5 and dashless UUID. Masking it would eat the correlation ids in a log."
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
field: "gateway-nextcloud-talk `secret`",
|
|
782
|
-
why: "a Talk bot secret is a string of 40 to 128 characters the administrator chose for `occ talk:bot:install`, with no prefix or format to recognise. It never travels: both sides send only an HMAC made with it, and the adapter never logs it."
|
|
783
|
-
},
|
|
784
|
-
{
|
|
785
|
-
field: "gateway-irc `password` and `saslPassword`",
|
|
786
|
-
why: "a server password and a NickServ password are passphrases the operator chose, with no format to recognise. The SDK's `key=value` rule masks them as fields wherever they appear as `password=...`; the SASL payload on the wire is their base64, which the adapter never logs."
|
|
787
|
-
},
|
|
788
|
-
{
|
|
789
|
-
field: "gateway-google-chat `privateKey`",
|
|
790
|
-
why: "a PEM block spans lines, and in a log it usually arrives inside a JSON string with its line breaks escaped as \\n, which no single-line shape can claim whole. The SDK's `key=value` rule masks it as a field wherever it appears as `private_key=...` or `privateKey=...`."
|
|
791
|
-
},
|
|
792
|
-
{
|
|
793
|
-
field: "gateway-line `channelAccessToken`, gateway-sms `authToken` (Plivo)",
|
|
794
|
-
why: "long base64 runs with no prefix, indistinguishable from any encoded blob a platform library puts in an error message."
|
|
795
|
-
}
|
|
796
|
-
]
|
|
742
|
+
uncovered: parseUncovered(UNCOVERED_TABLE)
|
|
797
743
|
};
|
|
798
744
|
function maskShapes(text) {
|
|
799
745
|
let out = text;
|
|
@@ -1322,7 +1268,7 @@ function defaultStrategy(event) {
|
|
|
1322
1268
|
}
|
|
1323
1269
|
}
|
|
1324
1270
|
function sanitize(s) {
|
|
1325
|
-
return s.replace(/-/g, "
|
|
1271
|
+
return s.replace(/_/g, "__").replace(/-/g, "_d");
|
|
1326
1272
|
}
|
|
1327
1273
|
var SessionRouter = class {
|
|
1328
1274
|
constructor(strategy = defaultStrategy) {
|