ez_logs_agent 0.2.18 → 0.2.20

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c86b0c49e264b12a903e122287f44ab66f64571e47973bf9905053a0ae5728d3
4
- data.tar.gz: c940c8ebf580e2145984501f81af80baaf034762720fc074a6a7f8b289e99eaf
3
+ metadata.gz: 127cdd7067399c75d4ca7e16c443db0aabb3cee143d8649e25e6bb1ed4e19033
4
+ data.tar.gz: '009638c00738f43bd75b95a2c6e39206f34d28cd94b262fff4bb3ed248fa69c0'
5
5
  SHA512:
6
- metadata.gz: dda0c02c9dc6822125c683be50fb0b71008b6141a1dcb906e262ebbc3b6e0f525c2ff15fb2320b6862f424fcc7cf436ec8c3d5b8dad7cecae7be56386b470ecc
7
- data.tar.gz: d5c4bc5c3eb64793fcc67a8780b6b4e17f1afbc55dcab421439b559769cef72e9f809bfa0f78dee051e52876620df8941d47494a03685b316e934395f3f191f8
6
+ metadata.gz: df24d5eb920bde2d114345332b622ff40fac0356b532c8d7b5b0bf67a6a7927bb874190eb26b5ddbf6879cd431559a358669bd79e83f4b0c234cc94fee895f25
7
+ data.tar.gz: e5f634288af46360bb25a8870652213d772779c2768c23651a630615bd9f4ffc4bc5d70990a0e14f6ff4ba7f680aa53a3032b127250f030cf7b431a3d3142947
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.2.20] — 2026-11-23
6
+
7
+ ### Fixed
8
+ - **A bulk write's filter never exposes a value after one ending in a backslash.** On PostgreSQL, Rails writes `'C:\'` with a bare backslash before its closing quote; the masking read that as an escaped quote, so the next value in the filter (`email = '…'`) was sent unmasked. Such a statement is now sent as unreadable: no filter, no values.
9
+
10
+ ### Changed
11
+ - **Dev-only endpoints are left out by default.** `/hotwire-livereload`, `/rails/info`, `/rails/mailers` and `/__better_errors/*` (reload channels and development pages, never a user action), each with its sub-paths and whole path segments only (`/rails/information` stays recorded), are in the default excluded paths, so a development app no longer records them.
12
+
13
+ ## [0.2.19] — 2026-11-22
14
+
15
+ ### Fixed
16
+ - **An outside call with invalid UTF-8 in its path is still recorded.** Such a path used to raise while it was turned into a pattern, and the call was silently left out (the app's call itself was never affected). The path now ends at the first invalid byte, as it does at a query string.
17
+
5
18
  ## [0.2.18] — 2026-11-22
6
19
 
7
20
  ### Changed
data/README.md CHANGED
@@ -196,6 +196,7 @@ Every incoming HTTP request, with intelligent noise filtering:
196
196
  - `/favicon.ico`, `/.well-known*`, `/robots.txt`, `/sitemap.xml` — Crawler / browser plumbing
197
197
  - `/cable*` — ActionCable WebSocket connections
198
198
  - `/sidekiq`, `/sidekiq/*` — Sidekiq Web UI (auto-polls every few seconds)
199
+ - `/hotwire-livereload`, `/rails/info`, `/rails/mailers`, `/__better_errors/*` (and their sub-paths) — development-only reload channel and pages
199
200
  - `*/sign_in*`, `*/sign_out*`, `*/login*`, `*/logout*`, `/users/password*`, `/session*` — Auth pages (Devise + common patterns)
200
201
 
201
202
  **Note on GraphQL:** All GraphQL operations (queries, mutations, subscriptions) are captured. The server classifies queries as "background" significance, allowing users to toggle their visibility in the UI since they're typically read-only operations.
@@ -51,9 +51,10 @@ module EzLogsAgent
51
51
  # The order of placeholders in the SQL corresponds 1:1 with the order
52
52
  # of values in `binds` / `type_casted_binds`.
53
53
  PLACEHOLDER = /(?:\$\d+|\?)/.freeze
54
- # A SQL string literal: 'it''s', and MySQL's 'O\'Brien' (a PostgreSQL literal ending in a
55
- # backslash is rare and reads as longer: more is masked, never less). Literals are swapped for
56
- # tokens before anything else, so a keyword, comma, "?" or "$1" inside one never splits the SQL.
54
+ # A SQL string literal: 'it''s', and MySQL's 'O\'Brien'. Literals are swapped for tokens before
55
+ # anything else, so a keyword, comma, "?" or "$1" inside one never splits the SQL. A PostgreSQL
56
+ # literal ending in a backslash ('C:\') is misread as escaping its closing quote; the quote left
57
+ # over outside every token then makes the statement unparseable, so no value is ever sent.
57
58
  SQL_STRING_LITERAL = /'(?:[^'\\]|\\.|'')*'/m.freeze
58
59
  LITERAL_TOKEN = /'\u0001(\d+)'/.freeze
59
60
  LITERAL_MASK = "'[redacted]'"
@@ -73,10 +74,16 @@ module EzLogsAgent
73
74
 
74
75
  case sql_stripped
75
76
  when /\ADELETE FROM /i
76
- parse_delete(tokenize_literals(sql_stripped, []), type_casted_binds || [])
77
+ tokenized = tokenize_literals(sql_stripped, [])
78
+ return { unparseable: true } if stray_quote?(tokenized)
79
+
80
+ parse_delete(tokenized, type_casted_binds || [])
77
81
  when /\AUPDATE /i
78
82
  literals = []
79
- parse_update(tokenize_literals(sql_stripped, literals), type_casted_binds || [], literals)
83
+ tokenized = tokenize_literals(sql_stripped, literals)
84
+ return { unparseable: true } if stray_quote?(tokenized)
85
+
86
+ parse_update(tokenized, type_casted_binds || [], literals)
80
87
  when /\AINSERT INTO /i
81
88
  parse_insert(sql_stripped)
82
89
  else
@@ -92,6 +99,13 @@ module EzLogsAgent
92
99
  end
93
100
 
94
101
  # The statement with each string literal swapped for "'\u0001N'" (N its index in `literals`).
102
+ # A quote or backslash outside every literal token: the literals were not read as written (see
103
+ # SQL_STRING_LITERAL; an E'' string after a backslash-ended literal).
104
+ def stray_quote?(tokenized)
105
+ rest = tokenized.gsub(LITERAL_TOKEN, "")
106
+ rest.include?("'") || rest.include?("\\")
107
+ end
108
+
95
109
  def tokenize_literals(sql, literals)
96
110
  sql.gsub(SQL_STRING_LITERAL) do
97
111
  literals << Regexp.last_match(0)
@@ -95,6 +95,13 @@ module EzLogsAgent
95
95
  "/metrics", # Prometheus metrics endpoint
96
96
  "/favicon.ico", # Browser favicon
97
97
  "/*.hot-update.*", # Hot module replacement
98
+ "/hotwire-livereload", # hotwire-livereload dev-server reload channel (whole segments only)
99
+ "/hotwire-livereload/*",
100
+ "/rails/info", # Rails dev-only info pages
101
+ "/rails/info/*",
102
+ "/rails/mailers", # Rails dev-only mailer previews
103
+ "/rails/mailers/*",
104
+ "/__better_errors/*", # better_errors dev-only error page endpoints
98
105
  "/.well-known*", # Well-known URIs (security.txt, etc.)
99
106
  "/robots.txt", # Search engine crawler config
100
107
  "/sitemap.xml", # Sitemap for crawlers
@@ -17,10 +17,9 @@ module EzLogsAgent
17
17
  # - fails open: nothing here can raise into, hang or retry the app's call.
18
18
  module OutboundCapture
19
19
  # The server's rules (Summary::OutboundCall, EventIngest::OutboundCalls), so nothing it would drop
20
- # ever leaves the app: only API versions and the first segment after them when it is in
21
- # COLLECTIONS ("/v1/customers/cus_9x/orders" → "/v1/customers/:id/:id"); a host's registrable
22
- # domain, never an address or an internal name.
23
- # The first word after the version is kept only when it is one of these common API collections
20
+ # ever leaves the app: the path kept by REST structure (#keep_segment?: "/v1/customers/cus_9x/orders"
21
+ # → "/v1/customers/:id/orders"); a host's registrable domain, never an address or an internal name.
22
+ # A collection word is kept only when it is one of these common API collections
24
23
  # ("/v1/charges" → "Created a charge"). Any other word becomes :id, even one that looks plural:
25
24
  # "charles" or "james" could be a person (owner decision, 2026-11-21). Identical in the server,
26
25
  # ez_logs_agent and ezlogs-nextjs (spec/domain/summary/outbound_call_spec.rb checks).
@@ -37,7 +36,7 @@ module EzLogsAgent
37
36
  transcriptions transfers translations uploads users videos webhooks workspaces
38
37
  ].to_set.freeze
39
38
  # Generic API vocabulary, kept by REST structure (deny by default): a verb only as the last segment,
40
- # where the operation sits ("/transactions/sync", "/charges/:id/refund"); a noun, like a collection,
39
+ # where the operation sits ("/charges/:id/refund", "/link/token/create"); a noun, like a collection,
41
40
  # only where a collection sits: first (after the version), after an id, or after a kept noun
42
41
  # ("/link/token/create", "/v1/checkout/sessions"). Right after a collection comes an id's place,
43
42
  # where a name could be ("/users/chat" → "/users/:id"). No vendor's words. Identical in the three places.
@@ -152,7 +151,8 @@ module EzLogsAgent
152
151
 
153
152
  # "/v1/customers/cus_9x/subscriptions?expand=x" → "/v1/customers/:id/subscriptions".
154
153
  def path_pattern(path)
155
- all = path.to_s.split(/[?#]/, 2).first.to_s.split("/").reject(&:empty?)
154
+ # scrub: invalid UTF-8 would raise in split and lose the call; "?" ends the path there, so it never forms a word.
155
+ all = path.to_s.scrub("?").split(/[?#]/, 2).first.to_s.split("/").reject(&:empty?)
156
156
  kept = []
157
157
  all.first(MAX_SEGMENTS).each_with_index do |segment, i|
158
158
  kept << (keep_segment?(segment, i, all.size, kept) ? segment : ":id")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzLogsAgent
4
- VERSION = "0.2.18"
4
+ VERSION = "0.2.20"
5
5
  end
@@ -45,7 +45,8 @@ EzLogsAgent.configure do |config|
45
45
  # =============================================================================
46
46
 
47
47
  # Additional paths to exclude from capture, with the database writes inside them (added to built-in defaults)
48
- # Built-in: /rails/active_storage*, /assets*, /packs*, /vite*, /health*, /up, /favicon.ico
48
+ # Built-in: /rails/active_storage*, /assets*, /packs*, /vite*, /health*, /up, /favicon.ico,
49
+ # /hotwire-livereload, /rails/info, /rails/mailers, /__better_errors/* (development-only)
49
50
  # config.excluded_paths = ["/admin*", "/internal*"]
50
51
 
51
52
  # Additional tables to exclude from database capture (added to built-in defaults)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez_logs_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.18
4
+ version: 0.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - dezsirazvan
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-11-22 00:00:00.000000000 Z
10
+ date: 2026-11-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: request_store