Commit ff45796
committed
fix(security): ReportsController — log internal errors, return generic messages
`render()` previously surfaced `$e->getMessage()` directly in the
response — useful for diagnostics, hostile when echoed to a hostile
caller. The mapper layer + ReportRenderService chain
(PhpSpreadsheet / Dompdf) routinely raise exceptions that include
file paths, SQL fragments, or library-internal state.
Inject `LoggerInterface`, log the original exception detail at error
level (with identifier + format context for correlation), and return
a generic message in the response body. Keep `InvalidArgumentException`
verbatim — those are validation messages the caller controls and
needs to act on.
Refs: #1419 review (concern 11) — discussion_r3187494514
Same pattern applies in `AggregationController`, `MetricsController`,
`RealtimeController`; left for follow-up since they're separate
hunks reviewed off-line.1 parent 545d148 commit ff45796
1 file changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
90 | 98 | | |
91 | | - | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
| |||
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| 110 | + | |
| 111 | + | |
102 | 112 | | |
103 | 113 | | |
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
107 | 121 | | |
108 | | - | |
| 122 | + | |
109 | 123 | | |
110 | 124 | | |
111 | 125 | | |
| |||
0 commit comments