Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/io/shiftleft/controller/AdminController.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ public String doPostLogin(@CookieValue(value = "auth", defaultValue = "notset")
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(authToken);
String cookieValue = new String(Base64.getEncoder().encode(bos.toByteArray()));
response.addCookie(new Cookie("auth", cookieValue ));
Cookie cookie = new Cookie("auth", cookieValue );
cookie.setHttpOnly(true);
cookie.setSecure(true);
response.addCookie(cookie);

// cookie is lost after redirection
request.getSession().setAttribute("auth",cookieValue);
Expand Down Expand Up @@ -135,3 +138,4 @@ public String doGetLogin(HttpServletResponse response, HttpServletRequest reques
return "redirect:/";
}
}

5 changes: 3 additions & 2 deletions src/main/java/io/shiftleft/controller/AppErrorController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.ServletRequestAttributes;
Expand Down Expand Up @@ -50,7 +51,7 @@ public ModelAndView errorHtml(HttpServletRequest request) {
* @param request
* @return
*/
@RequestMapping(value = ERROR_PATH)
@RequestMapping(value = ERROR_PATH, method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
Map<String, Object> body = getErrorAttributes(request, getTraceParameter(request));
Expand Down Expand Up @@ -102,4 +103,4 @@ private HttpStatus getStatus(HttpServletRequest request) {
}
return HttpStatus.INTERNAL_SERVER_ERROR;
}
}
}
4 changes: 3 additions & 1 deletion src/main/java/io/shiftleft/controller/SearchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ public class SearchController {
public String doGetSearch(@RequestParam String foo, HttpServletResponse response, HttpServletRequest request) {
java.lang.Object message = new Object();
try {
String sanitizedFoo = foo.replaceAll("[^a-zA-Z0-9\\s]", ""); // Sanitize input
ExpressionParser parser = new SpelExpressionParser();
Expression exp = parser.parseExpression(foo);
Expression exp = parser.parseExpression(sanitizedFoo);
message = (Object) exp.getValue();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return message.toString();
}
}

6 changes: 3 additions & 3 deletions src/main/resources/config/application-aws.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aws.accesskey=AKIAILQI6VLJU3HSCEQQ
aws.secretkey=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
aws.bucket=mysaas/customerid/account/date
aws.accesskey=${AWS_ACCESS_KEY_ID}
aws.secretkey=${AWS_SECRET_ACCESS_KEY}
aws.bucket=mysaas/customerid/account/date