Commit bcbbc59
authored
Propagate correct HTTP status for security exceptions on SQL analytic… (opensearch-project#5473)
* Propagate correct HTTP status for security exceptions on SQL analytics path
The SQL plugin's unified query handler (/_plugins/_sql) returned HTTP 500
for all exceptions from the analytics engine path, including security
exceptions that should be 403 Forbidden. This caused authorization denials
to appear as internal server errors to users.
Fix: Check if the exception is an OpenSearchException and extract its
proper HTTP status (e.g., 403 for OpenSearchSecurityException) instead of
hardcoding 500. Both the explain and execute paths are fixed.
Also updates AnalyticsEngineSecurityIT SQL deny tests to assert 403
directly, removing the previous workaround that accepted either 403 or 500.
Signed-off-by: carrofin <carrofin@amazon.com>
Signed-off-by: Finn Carroll <carrofin@amazon.com>
* Spotless apply
Signed-off-by: Finn Carroll <carrofin@amazon.com>
* Re-use helper.
Signed-off-by: Finn Carroll <carrofin@amazon.com>
---------
Signed-off-by: carrofin <carrofin@amazon.com>
Signed-off-by: Finn Carroll <carrofin@amazon.com>1 parent 1183e73 commit bcbbc59
3 files changed
Lines changed: 6 additions & 24 deletions
File tree
- integ-test/src/test/java/org/opensearch/sql/security
- legacy/src/main/java/org/opensearch/sql/legacy/plugin
- plugin/src/main/java/org/opensearch/sql/plugin
Lines changed: 3 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | 266 | | |
273 | 267 | | |
274 | 268 | | |
275 | 269 | | |
276 | 270 | | |
277 | 271 | | |
278 | 272 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 273 | + | |
284 | 274 | | |
285 | 275 | | |
286 | 276 | | |
| |||
291 | 281 | | |
292 | 282 | | |
293 | 283 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 284 | + | |
299 | 285 | | |
300 | 286 | | |
301 | 287 | | |
| |||
306 | 292 | | |
307 | 293 | | |
308 | 294 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 295 | + | |
314 | 296 | | |
315 | 297 | | |
316 | 298 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
0 commit comments