File tree Expand file tree Collapse file tree
core-tests/e2e-tests/spring/spring-rest-openapi-v3/src
main/kotlin/com/foo/rest/examples/spring/openapi/v3/security/xss/stored/html
test/kotlin/com/foo/rest/examples/spring/openapi/v3/security/xss/stored/html Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.foo.rest.examples.spring.openapi.v3.security.xss.stored.html
22
3+ import com.foo.rest.examples.spring.openapi.v3.security.xss.stored.json.XSSStoredJSONApplication
34import io.swagger.v3.oas.annotations.Operation
45import io.swagger.v3.oas.annotations.responses.ApiResponse
56import io.swagger.v3.oas.annotations.responses.ApiResponses
@@ -31,9 +32,16 @@ open class XSSStoredApplication {
3132 private val guestbookEntries = mutableListOf<Pair <String , String >>() // Query parameter
3233 }
3334
35+
36+ open fun resetDB () {
37+ comments.clear()
38+ userBios.clear()
39+ guestbookEntries.clear()
40+ }
41+
3442 // ==== BODY PARAMETER - Comment System ====
3543
36- @PostMapping(path = [" /comment " ], produces = [MediaType .TEXT_HTML_VALUE ])
44+ @PostMapping(path = [" /comments " ], produces = [MediaType .TEXT_HTML_VALUE ])
3745 open fun storeComment (@RequestBody commentDto : CommentDto ): String {
3846 // VULNERABLE: Stores user input without sanitization
3947 val comment = commentDto.comment ? : " No comment"
Original file line number Diff line number Diff line change 11package com.foo.rest.examples.spring.openapi.v3.security.xss.stored.html
22
33import com.foo.rest.examples.spring.openapi.v3.SpringController
4- import com.foo.rest.examples.spring.openapi.v3.security.xss.stored.json.XSSStoredJSONApplication
54
65class XSSStoredController : SpringController (XSSStoredApplication : :class.java){
76 override fun resetStateOfSUT () {
8- val app = ctx!! .getBean(XSSStoredJSONApplication ::class .java)
7+ val app = ctx!! .getBean(XSSStoredApplication ::class .java)
98 app.resetDB()
109 }
1110}
You can’t perform that action at this time.
0 commit comments