tina4ruby 3.13.6 → 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 +4 -4
- data/lib/tina4/rack_app.rb +28 -2
- data/lib/tina4/templates/errors/500.twig +1 -1
- data/lib/tina4/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6526c615d8d8dd6c8bdba089bceb5969917b2c4400d44886f3c3d757ad4ef14f
|
|
4
|
+
data.tar.gz: ddebcbd9f847f2660b6ed32e6f7ef86b7e3bd5aa1df3f37f2827d4a2549d9efb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 066d4124d585f5e79c3b41e3a763dc655c68d45e5c4afb19c01e0c5dc50fec29f50e21c0fe2eb3b6c8a9941664e45134eb46ef21c42827298c729a77801e766e
|
|
7
|
+
data.tar.gz: '0148be259f7b00d815abfc04b35f7bbca09e0e5561ff24e72e4a94a4e9e2c7d94236f67949e31d48daba76d383550a12f0c67d690a03a107db7642ef2a9e5570'
|
data/lib/tina4/rack_app.rb
CHANGED
|
@@ -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" => "
|
|
808
|
+
"error_message" => "",
|
|
783
809
|
"request_id" => SecureRandom.hex(6)
|
|
784
|
-
}) rescue "500 Internal Server Error
|
|
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