@hakam-aldeen-kh/blix 0.6.1 → 0.7.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/README.md CHANGED
@@ -123,8 +123,8 @@ register last.
123
123
  > interceptors become FIFO and the request-side rule flips to "register
124
124
  > `attachHttpMonitor` **first**" — while the response-side rule still says
125
125
  > last, so the two orders no longer agree and you must pick which leg matters
126
- > more. Response-interceptor order is unaffected by the flag. Blix does not
127
- > read this flag and cannot detect the situation.
126
+ > more. Response-interceptor order is unaffected by the flag. Blix warns once,
127
+ > in development, when a request carries the flag set to `false`.
128
128
 
129
129
  ```ts
130
130
  // src/network/axios.ts
@@ -188,8 +188,8 @@ instance.interceptors.response.use(undefined, (error) =>
188
188
 
189
189
  The consequence is silent and total: **every non-2xx request stays `pending`
190
190
  in the panel for the rest of the session.** No error, no warning, no Failed
191
- filter. (The 30-second pending cap only bounds how far the row's duration bar
192
- grows; it does not resolve the entry.)
191
+ filter. Nothing times the row out either: its duration keeps counting for as
192
+ long as the page stays open.
193
193
 
194
194
  Two ways out, and you currently have to choose one:
195
195
 
@@ -211,6 +211,45 @@ Two ways out, and you currently have to choose one:
211
211
  From a single `attachHttpMonitor` call you cannot currently have both plaintext
212
212
  request bodies and correlated errors while also discarding the `AxiosError`.
213
213
 
214
+ #### Response interceptors that unwrap
215
+
216
+ The same thing happens on the success path. A response interceptor registered
217
+ before Blix that returns something other than the response —
218
+ `(response) => response.data` is the usual one — hands Blix a value with no
219
+ `config` on it, so there is nothing to correlate:
220
+
221
+ - your request is unaffected: your code receives exactly what your interceptor
222
+ returned. (Before 0.7.0 Blix threw at this point, and every request on the
223
+ instance failed.)
224
+ - the entry **stays `pending`** for the rest of the session. Blix does not
225
+ settle a request it cannot see settle.
226
+
227
+ Register the unwrapping interceptor **after** `attachHttpMonitor` — response
228
+ interceptors run in registration order, so Blix then sees the full response
229
+ first — or unwrap at the call site instead.
230
+
231
+ #### Which request headers the panel shows
232
+
233
+ Blix's request interceptor runs before yours, so when it runs, the headers your
234
+ interceptors add — auth, tracing, signing, locale — do not exist yet, and
235
+ neither does the `Content-Type` axios sets itself. So the panel shows the
236
+ headers the request **settled** with, re-read from the config axios hands back
237
+ with the response or the error, and masked the same way. Until then — and for
238
+ good, for a request that never settles or whose rejection carries no `config` —
239
+ it shows the snapshot taken when the request started. JWT claims follow the same
240
+ rule.
241
+
242
+ Some headers never appear, because axios's adapter adds them to its own copy of
243
+ the config, past the last point Blix can read:
244
+
245
+ - **`Authorization: Basic …` from the `auth` option.** When `auth` is set, the
246
+ panel keeps the `Authorization` it saw when the request started: the settled
247
+ config still shows whatever your interceptors set, which is not what was
248
+ sent. Every other header is still taken from the settled config.
249
+ - **The XSRF header** (`X-XSRF-TOKEN` by default).
250
+ - **Headers the browser manages itself** — `Cookie`, `Origin`, `User-Agent` and
251
+ the like. Chrome's Network tab shows them; JavaScript never sees them.
252
+
214
253
  #### Encrypted payloads — `captureEncrypted(config, payload)`
215
254
 
216
255
  *Since 0.3.0.*
@@ -821,6 +860,8 @@ says what it will contain before you pick a format.
821
860
 
822
861
  Captured `Authorization` headers are masked, so cURL and fetch output carries a
823
862
  placeholder rather than a working token — use **Replay** for a real re-run.
863
+ Every export and snippet stays masked even with Authorization shown in full in
864
+ the panel (see [What is redacted](#what-is-redacted)).
824
865
 
825
866
  ### Themes
826
867
 
@@ -1106,6 +1147,54 @@ Shorter values are replaced outright. The Headers tab tags every masked row
1106
1147
  `MASKED` rather than leaving you to infer it from an ellipsis, and the stored
1107
1148
  value keeps a `(masked)` suffix so every export path carries the fact too.
1108
1149
 
1150
+ #### Showing `Authorization` in full
1151
+
1152
+ Blix is development-only, and a developer reading their own token on their own
1153
+ screen is not the risk — the token leaving the machine is. So masking of
1154
+ `authorization`, and only `authorization`, can be switched off: command palette
1155
+ → **Show Authorization values in full**, or **⋯ More actions** → **Show
1156
+ Authorization in full**. It is a saved preference, off by default, and while it
1157
+ is on the status bar reads **UNMASKED Authorization** and every such row in the
1158
+ Headers tab is tagged `UNMASKED`.
1159
+
1160
+ - It applies to requests captured **after** it is switched on. Earlier entries
1161
+ were masked when they were captured — the full value was never kept — and
1162
+ the panel cannot reveal them; their row says so. An axios request re-reads
1163
+ its headers when it settles (see
1164
+ [Which request headers the panel shows](#which-request-headers-the-panel-shows)),
1165
+ so for one still in flight what counts is the setting at the moment it
1166
+ settles.
1167
+ - The full value is held in memory only. It is **never** written to IndexedDB,
1168
+ and **every** export and copy path — HAR, JSON, NDJSON, CSV, Markdown, the
1169
+ cURL script, **Copy as cURL** and **Copy as fetch** — still carries the
1170
+ masked value. The row's own **Copy** button is the one way to take the full
1171
+ value.
1172
+ - Masking again discards every full value held.
1173
+ - `cookie`, `set-cookie`, `x-api-key` and realtime connect tokens stay masked
1174
+ regardless.
1175
+
1176
+ #### JWT claims
1177
+
1178
+ When an `Authorization` value is a JWT, Blix decodes it — for axios when the
1179
+ request settles, for `fetch` when it is made — and keeps only `alg`, `sub`,
1180
+ `iss`, `iat` and `exp`, never the token or its signature.
1181
+ The **JWT** chip on that row opens them, with the time left until `exp`, in red
1182
+ once it has passed. This works with masking on. The signature is not verified,
1183
+ and a value that is not a well-formed JWT stores no claims at all. The claims
1184
+ say where they were read: when a `fetch` call was made, from the headers an
1185
+ axios request settled with, or — for an axios request that never settled, or
1186
+ used the `auth` option — when it started.
1187
+
1188
+ `alg` is shown but never acted on: a missing, empty or non-string `alg` still
1189
+ yields every other claim, and no value of it withholds anything. The XML-DSig
1190
+ URIs .NET writes into `alg` — `http://www.w3.org/2001/04/xmldsig-more#hmac-sha256`
1191
+ and its HMAC, RSA, RSA-PSS and ECDSA siblings — are shown by name, as
1192
+ `HMAC-SHA256 (HS256)`, with the raw value in the tooltip; the entry and the
1193
+ exports keep the raw value. An `alg` of `none`, in any letter case, is flagged
1194
+ as an unsigned token. The claims
1195
+ are part of the entry, so — unlike the token — they are saved with
1196
+ preserve-log on and included in the JSON and NDJSON exports.
1197
+
1109
1198
  **Nothing inside a body is redacted.** Request bodies, response bodies, error
1110
1199
  payloads, the encrypted request/response values, Redux payloads and diffs, and
1111
1200
  realtime frames all pass through a size-only walker — it truncates large