Add insecure code
This commit is contained in:
@@ -1,13 +1,26 @@
|
|||||||
package dev.brammie15.HelloSpring;
|
package dev.brammie15.HelloSpring;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class HelloController {
|
public class HelloController {
|
||||||
|
private static final String API_KEY = "my-secret-api-key-123";
|
||||||
@GetMapping("/hello")
|
@GetMapping("/hello")
|
||||||
public String hello() {
|
public String hello() {
|
||||||
return "Hello, Spring Boot!";
|
return "Hello, Spring Boot!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/world")
|
||||||
|
public String world(@RequestParam String name) {
|
||||||
|
// Echoing user input directly
|
||||||
|
return "<h1>Hello " + name + "</h1>";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/run")
|
||||||
|
public String run(@RequestParam String cmd) throws Exception {
|
||||||
|
Runtime.getRuntime().exec(cmd);
|
||||||
|
return "Executed";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user