@hakam-aldeen-kh/blix 0.6.1 → 0.8.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.*
@@ -747,16 +786,17 @@ The panel is one header, one rail and two panes.
747
786
  Query. They are not filters over one table: each has its own columns and its
748
787
  own notion of a row, so switching source switches the whole view. `1`–`4` jump
749
788
  between them, and each keeps its own selection, so stepping to Redux and back
750
- returns you to the request you were reading. Below the sources it carries the
751
- session totals, and it collapses to icons — click the chevron, or let a narrow
752
- dock do it for you.
789
+ returns you to the request you were reading. Each row ends with its own number
790
+ key, because a shortcut is best taught where it is used. Below the sources it
791
+ carries the session totals; collapsed, it keeps the sources and their counts
792
+ and drops the totals, since four numbers without their labels are four
793
+ unattributed numbers.
753
794
 
754
795
  **The header is the session**, not the entry: whether capture is running, what
755
- is being filtered out, and where the panel lives. Filter tokens you have
756
- already applied become chips *inside* the filter field, each removable on its
757
- own, so `method:post status:5xx` is two things you can undo separately rather
758
- than one string to re-edit. `.*` widens the search to request and response
759
- bodies.
796
+ is being filtered out, and where the panel lives. While a filter is on, the
797
+ field carries its own count — `8 of 56` — and a clear button, so you never
798
+ have to read the status bar to know one is applied. `.*` widens the search to
799
+ request and response bodies.
760
800
 
761
801
  **`Ctrl/⌘ K` opens the command palette**, and for several things it is the only
762
802
  way in — sort order, row density, dock position, the copy formats, the filter
@@ -765,6 +805,13 @@ reach for occasionally lives one keystroke away instead of costing a button
765
805
  each. Every row shows its key binding where it has one, so the palette teaches
766
806
  its own shortcuts. `?` still opens the full cheatsheet.
767
807
 
808
+ **The columns are yours.** Right-click the column head — or open **Columns** in
809
+ the overflow menu — and switch off any of Pin, Method, Size, Status, Time,
810
+ Linked and Timing. The choice persists. ROUTE has no switch: it is the column
811
+ that says *which* entry a row is, and a list of rows you cannot identify is not
812
+ a list. A narrow pane drops columns on its own, worst-affordable first, so the
813
+ route keeps the width it needs.
814
+
768
815
  **Linked events tie the sources together.** When Blix can see that a query
769
816
  caused a request, that a request came from a query, or that one entry is a
770
817
  replay of another, the row grows a coloured tick and the foot of the detail
@@ -821,6 +868,8 @@ says what it will contain before you pick a format.
821
868
 
822
869
  Captured `Authorization` headers are masked, so cURL and fetch output carries a
823
870
  placeholder rather than a working token — use **Replay** for a real re-run.
871
+ Every export and snippet stays masked even with Authorization shown in full in
872
+ the panel (see [What is redacted](#what-is-redacted)).
824
873
 
825
874
  ### Themes
826
875
 
@@ -854,14 +903,18 @@ panel's other preferences and survives a reload.
854
903
  The panel never inherits your app's styling — it portals outside every stacking
855
904
  context and ships its own palettes, so nothing you do to your own theme can
856
905
  distort it. Themes are complete rather than partial: every colour the panel
857
- paints, down to the JSON syntax highlighting and the duration bars, comes from
858
- the active theme. Each palette is checked against WCAG contrast targets — 4.5:1
859
- for anything read as text, 3:1 for badges and quiet chrome — which is why a few
860
- of the ported palettes differ by a shade from the originals in the slots used
861
- for dense monospace.
862
-
863
- There is no API for adding your own; a theme is ~20 colours in
864
- `src/ui/themes/themes.ts` if you are working from source.
906
+ paints, down to the JSON syntax highlighting and the timing bars, comes from
907
+ the active theme. The two tones that carry text are held to 4.5:1 against every
908
+ ground they land on, which is why a few of the ported palettes differ by a
909
+ shade from the originals in the slots used for dense monospace. One tone is
910
+ deliberately below it and may never hold text: it is for separators, payload
911
+ punctuation and disabled glyphs.
912
+
913
+ There is no API for adding your own; a theme is 33 colour slots in
914
+ `src/ui/themes/bx.ts` if you are working from source. Every theme fills the
915
+ same set — a theme that cannot is reported in the console during development,
916
+ along with any whose text tones fall under 4.5:1 on a ground they actually
917
+ land on.
865
918
 
866
919
  ### `dbName` — when you need it
867
920
 
@@ -1106,6 +1159,54 @@ Shorter values are replaced outright. The Headers tab tags every masked row
1106
1159
  `MASKED` rather than leaving you to infer it from an ellipsis, and the stored
1107
1160
  value keeps a `(masked)` suffix so every export path carries the fact too.
1108
1161
 
1162
+ #### Showing `Authorization` in full
1163
+
1164
+ Blix is development-only, and a developer reading their own token on their own
1165
+ screen is not the risk — the token leaving the machine is. So masking of
1166
+ `authorization`, and only `authorization`, can be switched off: command palette
1167
+ → **Show Authorization values in full**, or **⋯ More actions** → **Show
1168
+ Authorization in full**. It is a saved preference, off by default, and while it
1169
+ is on the status bar reads **UNMASKED Authorization** and every such row in the
1170
+ Headers tab is tagged `UNMASKED`.
1171
+
1172
+ - It applies to requests captured **after** it is switched on. Earlier entries
1173
+ were masked when they were captured — the full value was never kept — and
1174
+ the panel cannot reveal them; their row says so. An axios request re-reads
1175
+ its headers when it settles (see
1176
+ [Which request headers the panel shows](#which-request-headers-the-panel-shows)),
1177
+ so for one still in flight what counts is the setting at the moment it
1178
+ settles.
1179
+ - The full value is held in memory only. It is **never** written to IndexedDB,
1180
+ and **every** export and copy path — HAR, JSON, NDJSON, CSV, Markdown, the
1181
+ cURL script, **Copy as cURL** and **Copy as fetch** — still carries the
1182
+ masked value. The row's own **Copy** button is the one way to take the full
1183
+ value.
1184
+ - Masking again discards every full value held.
1185
+ - `cookie`, `set-cookie`, `x-api-key` and realtime connect tokens stay masked
1186
+ regardless.
1187
+
1188
+ #### JWT claims
1189
+
1190
+ When an `Authorization` value is a JWT, Blix decodes it — for axios when the
1191
+ request settles, for `fetch` when it is made — and keeps only `alg`, `sub`,
1192
+ `iss`, `iat` and `exp`, never the token or its signature.
1193
+ The **JWT** chip on that row opens them, with the time left until `exp`, in red
1194
+ once it has passed. This works with masking on. The signature is not verified,
1195
+ and a value that is not a well-formed JWT stores no claims at all. The claims
1196
+ say where they were read: when a `fetch` call was made, from the headers an
1197
+ axios request settled with, or — for an axios request that never settled, or
1198
+ used the `auth` option — when it started.
1199
+
1200
+ `alg` is shown but never acted on: a missing, empty or non-string `alg` still
1201
+ yields every other claim, and no value of it withholds anything. The XML-DSig
1202
+ URIs .NET writes into `alg` — `http://www.w3.org/2001/04/xmldsig-more#hmac-sha256`
1203
+ and its HMAC, RSA, RSA-PSS and ECDSA siblings — are shown by name, as
1204
+ `HMAC-SHA256 (HS256)`, with the raw value in the tooltip; the entry and the
1205
+ exports keep the raw value. An `alg` of `none`, in any letter case, is flagged
1206
+ as an unsigned token. The claims
1207
+ are part of the entry, so — unlike the token — they are saved with
1208
+ preserve-log on and included in the JSON and NDJSON exports.
1209
+
1109
1210
  **Nothing inside a body is redacted.** Request bodies, response bodies, error
1110
1211
  payloads, the encrypted request/response values, Redux payloads and diffs, and
1111
1212
  realtime frames all pass through a size-only walker — it truncates large