Skip to content

Commit 866acd2

Browse files
committed
Hardening: use POST for profiling/debugging REST endpoints (#8515)
1 parent ef60c8f commit 866acd2

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

docs/STORM-UI-REST-API.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,9 +1298,9 @@ Sample response:
12981298
}
12991299
```
13001300

1301-
## Profiling and Debugging GET Operations
1301+
## Profiling and Debugging POST Operations
13021302

1303-
### /api/v1/topology/\<id\>/profiling/start/\<host-port\>/\<timeout\> (GET)
1303+
### /api/v1/topology/\<id\>/profiling/start/\<host-port\>/\<timeout\> (POST)
13041304

13051305
Request to start profiler on worker with timeout. Returns status and link to profiler artifacts for worker.
13061306
Substitute appropriate values for \<id\>, \<host-port\> and \<timeout\>.
@@ -1339,7 +1339,7 @@ Sample response:
13391339
}
13401340
```
13411341

1342-
### /api/v1/topology/\<id\>/profiling/dumpprofile/\<host-port\> (GET)
1342+
### /api/v1/topology/\<id\>/profiling/dumpprofile/\<host-port\> (POST)
13431343

13441344
Request to dump profiler recording on worker. Returns status and worker id for the request.
13451345
Substitute for \<id\> and \<host-port\>.
@@ -1371,7 +1371,7 @@ Sample response:
13711371
}
13721372
```
13731373

1374-
### /api/v1/topology/\<id\>/profiling/stop/\<host-port\> (GET)
1374+
### /api/v1/topology/\<id\>/profiling/stop/\<host-port\> (POST)
13751375

13761376
Request to stop profiler on worker. Returns status and worker id for the request.
13771377
Substitute for \<id\> and \<host-port\>.
@@ -1403,7 +1403,7 @@ Sample response:
14031403
}
14041404
```
14051405

1406-
### /api/v1/topology/\<id\>/profiling/dumpjstack/\<host-port\> (GET)
1406+
### /api/v1/topology/\<id\>/profiling/dumpjstack/\<host-port\> (POST)
14071407

14081408
Request to dump jstack on worker. Returns status and worker id for the request.
14091409
Substitute for \<id\> and \<host-port\>.
@@ -1435,7 +1435,7 @@ Sample response:
14351435
}
14361436
```
14371437

1438-
### /api/v1/topology/\<id\>/profiling/dumpheap/\<host-port\> (GET)
1438+
### /api/v1/topology/\<id\>/profiling/dumpheap/\<host-port\> (POST)
14391439

14401440
Request to dump heap (jmap) on worker. Returns status and worker id for the request.
14411441
Substitute for \<id\> and \<host-port\>.
@@ -1467,7 +1467,7 @@ Sample response:
14671467
}
14681468
```
14691469

1470-
### /api/v1/topology/\<id\>/profiling/restartworker/\<host-port\> (GET)
1470+
### /api/v1/topology/\<id\>/profiling/restartworker/\<host-port\> (POST)
14711471

14721472
Request to request the worker. Returns status and worker id for the request.
14731473
Substitute for \<id\> and \<host-port\>.

storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/component.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@
386386
var passed = {}
387387
Object.keys(workerActionSelected).forEach(function (id) {
388388
var url = "/api/v1/topology/"+topologyId+"/profiling/start/" + id + "/" + timeout;
389-
$.get(url, function(response,status,jqXHR) {
389+
$.post(url, function(response,status,jqXHR) {
390390
jsError(function() {
391391
getStatic("/templates/component-page-template.html", function(template) {
392392
var host_port_split = id.split(":");
@@ -428,7 +428,7 @@
428428
$("#stop_" + id).prop('disabled', true);
429429
setTimeout(function(){ $("#stop_" + id).prop('disabled', false); }, 5000);
430430

431-
$.get(url, function(response,status,jqXHR) {
431+
$.post(url, function(response,status,jqXHR) {
432432
alert("Submitted request to stop profiling...");
433433
})
434434
.fail(function(response) {
@@ -445,7 +445,7 @@
445445
$("#dump_profile_" + id).prop('disabled', true);
446446
setTimeout(function(){ $("#dump_profile_" + id).prop('disabled', false); }, 5000);
447447

448-
$.get(url, function(response,status,jqXHR) {
448+
$.post(url, function(response,status,jqXHR) {
449449
alert("Submitted request to dump profile snapshot...");
450450
})
451451
.fail(function(response) {
@@ -465,7 +465,7 @@
465465
$("#dump_jstack_" + id).prop('disabled', true);
466466
setTimeout(function(){ $("#dump_jstack_" + id).prop('disabled', false); }, 5000);
467467

468-
$.get(url).fail(function(response) {
468+
$.post(url).fail(function(response) {
469469
failed[id] = response;
470470
});
471471
if (!(id in failed)) {
@@ -490,7 +490,7 @@
490490
$("#dump_jstack_" + id).prop('disabled', true);
491491
setTimeout(function(){ $("#dump_jstack_" + id).prop('disabled', false); }, 5000);
492492

493-
$.get(url, function(response,status,jqXHR) {
493+
$.post(url, function(response,status,jqXHR) {
494494
alert("Submitted request for jstack dump...");
495495
})
496496
.fail(function(response) {
@@ -509,7 +509,7 @@
509509
$("#restart_worker_jvm_" + id).prop('disabled', true);
510510
setTimeout(function(){ $("#restart_worker_jvm_" + id).prop('disabled', false); }, 5000);
511511

512-
$.get(url).fail(function(response) {
512+
$.post(url).fail(function(response) {
513513
failed[id] = response;
514514
});
515515
if (!(id in failed)) {
@@ -537,7 +537,7 @@
537537
$("#dump_heap_" + id).prop('disabled', true);
538538
setTimeout(function(){ $("#dump_heap_" + id).prop('disabled', false); }, 5000);
539539

540-
$.get(url).fail(function(response) {
540+
$.post(url).fail(function(response) {
541541
failed[id] = response;
542542
});
543543
if (!(id in failed)) {
@@ -562,7 +562,7 @@
562562
$("#dump_heap_" + id).prop('disabled', true);
563563
setTimeout(function(){ $("#dump_heap_" + id).prop('disabled', false); }, 5000);
564564

565-
$.get(url, function(response,status,jqXHR) {
565+
$.post(url, function(response,status,jqXHR) {
566566
alert("Submitted request for jmap dump...");
567567
})
568568
.fail(function(response) {

storm-webapp/src/main/java/org/apache/storm/daemon/ui/resources/StormApiResource.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ public Response putTopologyKill(
596596
/**
597597
* /api/v1/topology/:id/profiling/start/:host-port/:timeout -> profiling start.
598598
*/
599-
@GET
599+
@POST
600600
@Path("/topology/{id}/profiling/start/{host-port}/{timeout}")
601601
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
602602
@Produces("application/json")
@@ -615,7 +615,7 @@ public Response getTopologyProfilingStart(@PathParam("id") String id,
615615
/**
616616
* /api/v1/topology/:id/profiling/stop/:host-port -> profiling stop.
617617
*/
618-
@GET
618+
@POST
619619
@Path("/topology/{id}/profiling/stop/{host-port}")
620620
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
621621
@Produces("application/json")
@@ -633,7 +633,7 @@ public Response getTopologyProfilingStop(@PathParam("id") String id,
633633
/**
634634
* /api/v1/topology/:id/profiling/dumpprofile/:host-port -> dump profile.
635635
*/
636-
@GET
636+
@POST
637637
@Path("/topology/{id}/profiling/dumpprofile/{host-port}")
638638
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
639639
@Produces("application/json")
@@ -651,7 +651,7 @@ public Response getTopologyProfilingDumpProfile(@PathParam("id") String id,
651651
/**
652652
* /api/v1/topology/:id/profiling/dumpjstack/:host-port -> dump jstack.
653653
*/
654-
@GET
654+
@POST
655655
@Path("/topology/{id}/profiling/dumpjstack/{host-port}")
656656
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
657657
@Produces("application/json")
@@ -671,7 +671,7 @@ public Response getTopologyProfilingDumpJstack(@PathParam("id") String id,
671671
/**
672672
* /api/v1/topology/:id/profiling/restartworker/:host-port -> restart worker.
673673
*/
674-
@GET
674+
@POST
675675
@Path("/topology/{id}/profiling/restartworker/{host-port}")
676676
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
677677
@Produces("application/json")
@@ -691,7 +691,7 @@ public Response getTopologyProfilingRestartWorker(@PathParam("id") String id,
691691
/**
692692
* /api/v1/topology/:id/profiling/dumpheap/:host-port -> dump heap.
693693
*/
694-
@GET
694+
@POST
695695
@Path("/topology/{id}/profiling/dumpheap/{host-port}")
696696
@AuthNimbusOp(value = "setWorkerProfiler", needsTopoId = true)
697697
@Produces("application/json")

0 commit comments

Comments
 (0)