tina4ruby 3.13.5 → 3.13.7

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: f5a305c0c2ee88795cac09fabe5c275165fb83d6da1d83bc301a8097660d711c
4
- data.tar.gz: 68ee188aef588fd0e09d7779771de3eb47ed7ab5d9cfe426d3840b3015000064
3
+ metadata.gz: 6526c615d8d8dd6c8bdba089bceb5969917b2c4400d44886f3c3d757ad4ef14f
4
+ data.tar.gz: ddebcbd9f847f2660b6ed32e6f7ef86b7e3bd5aa1df3f37f2827d4a2549d9efb
5
5
  SHA512:
6
- metadata.gz: af2cb8dd1b51f7569d864aa41c4f0c52105696bea48e6c6fb50dd76b1d9bd11cf5e724cfdccb717bf5d42e2e84f032e10af1ada89ce9a3b74e660bc0a6f7c4f0
7
- data.tar.gz: 75b8d8f25a7efcfb38606414e1457b3bdbf0bedbe3d1ee0ec3b5dea2ee0a58ddb5292a9f1078dc212a9cc43df0625122e3a288d2fb78437479cd15bc26efeecd
6
+ metadata.gz: 066d4124d585f5e79c3b41e3a763dc655c68d45e5c4afb19c01e0c5dc50fec29f50e21c0fe2eb3b6c8a9941664e45134eb46ef21c42827298c729a77801e766e
7
+ data.tar.gz: '0148be259f7b00d815abfc04b35f7bbca09e0e5561ff24e72e4a94a4e9e2c7d94236f67949e31d48daba76d383550a12f0c67d690a03a107db7642ef2a9e5570'
@@ -118,7 +118,10 @@ module Tina4
118
118
 
119
119
  open_connection
120
120
  rescue LoadError
121
- raise "Firebird driver requires the 'fb' gem. Install it with: gem install fb"
121
+ raise LoadError,
122
+ "The 'fb' gem is required for Firebird connections. Install one of:\n" \
123
+ " bundle add fb # if your project uses Bundler\n" \
124
+ " gem install fb # bare driver"
122
125
  end
123
126
 
124
127
  def close
@@ -10,8 +10,9 @@ module Tina4
10
10
  require "mongo"
11
11
  rescue LoadError
12
12
  raise LoadError,
13
- "The 'mongo' gem is required for MongoDB connections. " \
14
- "Install: gem install mongo"
13
+ "The 'mongo' gem is required for MongoDB connections. Install one of:\n" \
14
+ " bundle add mongo # if your project uses Bundler\n" \
15
+ " gem install mongo # bare driver"
15
16
  end
16
17
 
17
18
  uri = build_uri(connection_string, username, password)
@@ -6,7 +6,14 @@ module Tina4
6
6
  attr_reader :connection
7
7
 
8
8
  def connect(connection_string, username: nil, password: nil)
9
- require "tiny_tds"
9
+ begin
10
+ require "tiny_tds"
11
+ rescue LoadError
12
+ raise LoadError,
13
+ "The 'tiny_tds' gem is required for MSSQL connections. Install one of:\n" \
14
+ " bundle add tiny_tds # if your project uses Bundler\n" \
15
+ " gem install tiny_tds # bare driver"
16
+ end
10
17
  uri = parse_connection(connection_string)
11
18
  @connection = TinyTds::Client.new(
12
19
  host: uri[:host],
@@ -6,7 +6,14 @@ module Tina4
6
6
  attr_reader :connection
7
7
 
8
8
  def connect(connection_string, username: nil, password: nil)
9
- require "mysql2"
9
+ begin
10
+ require "mysql2"
11
+ rescue LoadError
12
+ raise LoadError,
13
+ "The 'mysql2' gem is required for MySQL connections. Install one of:\n" \
14
+ " bundle add mysql2 # if your project uses Bundler\n" \
15
+ " gem install mysql2 # bare driver"
16
+ end
10
17
  uri = URI.parse(connection_string)
11
18
  @connection = Mysql2::Client.new(
12
19
  host: uri.host || "localhost",
@@ -21,8 +21,9 @@ module Tina4
21
21
  require "odbc"
22
22
  rescue LoadError
23
23
  raise LoadError,
24
- "The 'ruby-odbc' gem is required for ODBC connections. " \
25
- "Install: gem install ruby-odbc"
24
+ "The 'ruby-odbc' gem is required for ODBC connections. Install one of:\n" \
25
+ " bundle add ruby-odbc # if your project uses Bundler\n" \
26
+ " gem install ruby-odbc # bare driver"
26
27
  end
27
28
 
28
29
  dsn_string = connection_string.to_s
@@ -6,7 +6,14 @@ module Tina4
6
6
  attr_reader :connection
7
7
 
8
8
  def connect(connection_string, username: nil, password: nil)
9
- require "pg"
9
+ begin
10
+ require "pg"
11
+ rescue LoadError
12
+ raise LoadError,
13
+ "The 'pg' gem is required for PostgreSQL connections. Install one of:\n" \
14
+ " bundle add pg # if your project uses Bundler\n" \
15
+ " gem install pg # bare driver"
16
+ end
10
17
  url = connection_string
11
18
  if username || password
12
19
  uri = URI.parse(url)
@@ -774,14 +774,40 @@ module Tina4
774
774
  def handle_500(error, env = nil)
775
775
  Tina4::Log.error("500 Internal Server Error: #{error.message}")
776
776
  Tina4::Log.error(error.backtrace&.first(10)&.join("\n"))
777
+
778
+ # v3.13.7: surface route failures to observability (centralised
779
+ # logging, APM, Sentry) BEFORE rendering the 500. Listeners get
780
+ # the canonical {exception:, request:} pair — same shape as
781
+ # Python / PHP / Node. Listener exceptions are swallowed +
782
+ # warning-logged so a broken listener can't break the 500 page.
783
+ begin
784
+ request = env && env["tina4.request"]
785
+ Tina4::Events.emit("tina4.request.error", {
786
+ exception: error,
787
+ request: request
788
+ })
789
+ rescue StandardError => listener_err
790
+ begin
791
+ Tina4::Log.warning(
792
+ "Listener for tina4.request.error raised: " \
793
+ "#{listener_err.class}: #{listener_err.message}"
794
+ )
795
+ rescue StandardError
796
+ # Log failures must never block the 500 render.
797
+ end
798
+ end
799
+
777
800
  if dev_mode?
778
801
  # Rich error overlay with stack trace, source context, and line numbers
779
802
  body = Tina4::ErrorOverlay.render_error_overlay(error, request: env)
780
803
  else
804
+ # v3.13.7 SECURITY (CWE-209): production response body must NOT
805
+ # contain the stack trace. The trace stays in Log.error above
806
+ # and reaches observability via the tina4.request.error event.
781
807
  body = Tina4::Template.render_error(500, {
782
- "error_message" => "#{error.message}\n#{error.backtrace&.first(10)&.join("\n")}",
808
+ "error_message" => "",
783
809
  "request_id" => SecureRandom.hex(6)
784
- }) rescue "500 Internal Server Error: #{error.message}"
810
+ }) rescue "500 Internal Server Error"
785
811
  end
786
812
  [500, { "content-type" => "text/html" }, [body]]
787
813
  end
@@ -27,7 +27,7 @@ body { font-family: system-ui, -apple-system, sans-serif; background: #0f172a; c
27
27
  <div class="error-title">Server Error</div>
28
28
  </div>
29
29
  <div class="error-msg">Something went wrong while processing your request.</div>
30
- <pre class="error-trace">{{ error_message }}</pre>
30
+ {% if error_message %}<pre class="error-trace">{{ error_message }}</pre>{% endif %}
31
31
  <div class="error-footer">
32
32
  <span class="error-hint">Fix the error and save to auto-reload</span>
33
33
  <span class="error-id">{{ request_id }}</span>
data/lib/tina4/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tina4
4
- VERSION = "3.13.5"
4
+ VERSION = "3.13.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tina4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.13.5
4
+ version: 3.13.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tina4 Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-05 00:00:00.000000000 Z
11
+ date: 2026-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack