Skip to content

Commit

Permalink
more details in js and ts endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Iliyan Velichkov <velichkov.iliyan@gmail.com>
  • Loading branch information
iliyan-velichkov committed Nov 21, 2024
1 parent d97ea39 commit 38ecee2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public List<Dts> getDTS() throws IOException {
* @param params the params
* @return the response
*/
@WithSpan("java_script_endpoint")
@WithSpan("java_script_endpoint_get")
@GetMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> get(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
Expand Down Expand Up @@ -302,8 +302,10 @@ protected String normalizePath(String path) {
* @param params the params
* @return the response
*/
@WithSpan("java_script_endpoint_post")
@PostMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> post(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> post(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return executeJavaScript(projectName, projectFilePath, params, null);
}
Expand All @@ -317,9 +319,10 @@ public ResponseEntity<?> post(@PathVariable("projectName") String projectName, @
* @param file the file
* @return the response
*/
@WithSpan("java_script_endpoint_post_file")
@PostMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data")
public ResponseEntity<?> postFile(@PathVariable("projectName") String projectName,
@PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> postFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params,
@Validated @RequestParam("file") MultipartFile[] file) {
return executeJavaScript(projectName, projectFilePath, params, file);
Expand All @@ -333,8 +336,10 @@ public ResponseEntity<?> postFile(@PathVariable("projectName") String projectNam
* @param params the params
* @return the response
*/
@WithSpan("java_script_endpoint_put")
@PutMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> put(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> put(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return executeJavaScript(projectName, projectFilePath, params, null);
}

Check failure

Code scanning / CodeQL

Partial path traversal vulnerability from remote Critical

Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Partial Path Traversal Vulnerability due to insufficient guard against path traversal from
user-supplied data
.
Expand All @@ -348,9 +353,10 @@ public ResponseEntity<?> put(@PathVariable("projectName") String projectName, @P
* @param file the file
* @return the response
*/
@WithSpan("java_script_endpoint_put_file")
@PutMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data")
public ResponseEntity<?> putFile(@PathVariable("projectName") String projectName,
@PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> putFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params,
@Validated @RequestParam("file") MultipartFile file) {
return executeJavaScript(projectName, projectFilePath, params, new MultipartFile[] {file});
Expand All @@ -365,7 +371,9 @@ public ResponseEntity<?> putFile(@PathVariable("projectName") String projectName
* @return the response
*/
@PatchMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> patch(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath,
@WithSpan("java_script_endpoint_patch")
public ResponseEntity<?> patch(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return executeJavaScript(projectName, projectFilePath, params, null);
}
Expand All @@ -378,9 +386,10 @@ public ResponseEntity<?> patch(@PathVariable("projectName") String projectName,
* @param params the params
* @return the response
*/
@WithSpan("java_script_endpoint_delete")
@DeleteMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> delete(@PathVariable("projectName") String projectName,
@PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> delete(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return executeJavaScript(projectName, projectFilePath, params, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public TypeScriptEndpoint(JavascriptEndpoint javascriptEndpoint) {
* @param params the params
* @return the response entity
*/
@WithSpan("type_script_endpoint")
@WithSpan("type_script_endpoint_get")
@GetMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> get(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
Expand Down Expand Up @@ -86,8 +86,10 @@ private String replaceTSWithJSExtension(String projectFilePath) {
* @param params the params
* @return the response entity
*/
@WithSpan("type_script_endpoint_post")
@PostMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> post(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> post(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return javascriptEndpoint.post(projectName, replaceTSWithJSExtension(projectFilePath), params);
}
Expand All @@ -101,9 +103,10 @@ public ResponseEntity<?> post(@PathVariable("projectName") String projectName, @
* @param file the file
* @return the response entity
*/
@WithSpan("type_script_endpoint_post_file")
@PostMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data")
public ResponseEntity<?> postFile(@PathVariable("projectName") String projectName,
@PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> postFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params,
@Validated @RequestParam("file") MultipartFile[] file) {
return javascriptEndpoint.postFile(projectName, replaceTSWithJSExtension(projectFilePath), params, file);
Expand All @@ -117,8 +120,10 @@ public ResponseEntity<?> postFile(@PathVariable("projectName") String projectNam
* @param params the params
* @return the response entity
*/
@WithSpan("type_script_endpoint_put")
@PutMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> put(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> put(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return javascriptEndpoint.put(projectName, replaceTSWithJSExtension(projectFilePath), params);
}
Expand All @@ -132,9 +137,10 @@ public ResponseEntity<?> put(@PathVariable("projectName") String projectName, @P
* @param file the file
* @return the response entity
*/
@WithSpan("type_script_endpoint_put_file")
@PutMapping(value = HTTP_PATH_MATCHER, consumes = "multipart/form-data")
public ResponseEntity<?> putFile(@PathVariable("projectName") String projectName,
@PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> putFile(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params,
@Validated @RequestParam("file") MultipartFile file) {
return javascriptEndpoint.putFile(projectName, replaceTSWithJSExtension(projectFilePath), params, file);
Expand All @@ -148,8 +154,10 @@ public ResponseEntity<?> putFile(@PathVariable("projectName") String projectName
* @param params the params
* @return the response entity
*/
@WithSpan("type_script_endpoint_patch")
@PatchMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> patch(@PathVariable("projectName") String projectName, @PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> patch(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return javascriptEndpoint.patch(projectName, replaceTSWithJSExtension(projectFilePath), params);
}
Expand All @@ -162,9 +170,10 @@ public ResponseEntity<?> patch(@PathVariable("projectName") String projectName,
* @param params the params
* @return the response entity
*/
@WithSpan("type_script_endpoint_delete")
@DeleteMapping(HTTP_PATH_MATCHER)
public ResponseEntity<?> delete(@PathVariable("projectName") String projectName,
@PathVariable("projectFilePath") String projectFilePath,
public ResponseEntity<?> delete(@SpanAttribute("projectName") @PathVariable("projectName") String projectName,
@SpanAttribute("projectFilePath") @PathVariable("projectFilePath") String projectFilePath,
@Nullable @RequestParam(required = false) MultiValueMap<String, String> params) {
return javascriptEndpoint.delete(projectName, replaceTSWithJSExtension(projectFilePath), params);
}
Expand Down

0 comments on commit 38ecee2

Please sign in to comment.