Commit b4cdbf0
molty3000
fix(security): register global error handler to prevent stack trace leakage
Previously config.errorHandler (an object) was passed to the router
instead of a callable function, causing all unhandled exceptions to
crash through to Bun's native error overlay which leaked:
- Full internal file paths (gateway.ts, 0http-bun/lib/next.js)
- Dependency chain details
- Exception types and call stacks
Now wraps user errorHandler configs into a proper function that:
1. Logs errors safely (without leaking to clients)
2. Returns sanitized 500 responses
3. Preserves custom error handler support for users who pass functions1 parent 48a886a commit b4cdbf0
1 file changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
154 | 178 | | |
155 | 179 | | |
156 | 180 | | |
157 | 181 | | |
158 | 182 | | |
159 | | - | |
| 183 | + | |
160 | 184 | | |
161 | 185 | | |
162 | 186 | | |
| |||
0 commit comments