Skip to content

Commit bd74088

Browse files
committed
CLAP-372 Chore: xss 공격 테스트 api 구현
<footer> - 관련: #475
1 parent 320dd9e commit bd74088

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package clap.server.adapter.inbound.web;
2+
3+
import clap.server.common.annotation.architecture.WebAdapter;
4+
import clap.server.common.annotation.swagger.DevelopOnlyApi;
5+
import io.swagger.v3.oas.annotations.Operation;
6+
import jakarta.servlet.http.HttpServletRequest;
7+
import lombok.extern.slf4j.Slf4j;
8+
import org.springframework.http.ResponseEntity;
9+
import org.springframework.web.bind.annotation.*;
10+
11+
@Slf4j
12+
@WebAdapter
13+
@RequestMapping("/api/xss-test")
14+
public class XssTestController {
15+
16+
@GetMapping
17+
@DevelopOnlyApi
18+
@Operation(summary = "파라미터 xss test")
19+
public ResponseEntity<String> testGetXss(@RequestParam String input) {
20+
log.info("Received GET input: {}", input);
21+
return ResponseEntity.ok("Processed GET input: " + input);
22+
}
23+
24+
@PostMapping
25+
@DevelopOnlyApi
26+
@Operation(summary = "dto xss test")
27+
public ResponseEntity<XssTestResponse> testPostXss(@RequestBody XssTestRequest request) {
28+
log.info("Received POST input: {}", request);
29+
return ResponseEntity.ok(new XssTestResponse(request.content()));
30+
}
31+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package clap.server.adapter.inbound.web;
2+
3+
import jakarta.validation.constraints.NotNull;
4+
5+
public record XssTestRequest(
6+
@NotNull
7+
String content
8+
) {}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package clap.server.adapter.inbound.web;
2+
3+
public record XssTestResponse(
4+
String sanitizedContent
5+
) {}

0 commit comments

Comments
 (0)