Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PatchWork AutoFix #9

Open
wants to merge 4 commits into
base: gemini-1.5-pro-latest
Choose a base branch
from
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:/";
}
}

7 changes: 4 additions & 3 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 @@ -40,7 +41,7 @@ public AppErrorController(ErrorAttributes errorAttributes) {
* @param request
* @return
*/
@RequestMapping(value = ERROR_PATH, produces = "text/html")
@RequestMapping(value = ERROR_PATH, produces = "text/html", method = RequestMethod.GET)
public ModelAndView errorHtml(HttpServletRequest request) {
return new ModelAndView("/errors/error", getErrorAttributes(request, false));
}
Expand All @@ -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;
}
}
}
5 changes: 2 additions & 3 deletions src/main/java/io/shiftleft/controller/SearchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ public class SearchController {
public String doGetSearch(@RequestParam String foo, HttpServletResponse response, HttpServletRequest request) {
java.lang.Object message = new Object();
try {
ExpressionParser parser = new SpelExpressionParser();
Expression exp = parser.parseExpression(foo);
message = (Object) exp.getValue();
message = (Object) "User searched for: " + foo;
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return message.toString();
}
}

7 changes: 4 additions & 3 deletions src/main/resources/config/application-aws.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
aws.accesskey=AKIAILQI6VLJU3HSCEQQ
aws.secretkey=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
aws.bucket=mysaas/customerid/account/date
import os
aws.accesskey=os.environ.get('AWS_ACCESS_KEY_ID')
aws.secretkey=os.environ.get('AWS_SECRET_ACCESS_KEY')
aws.bucket=mysaas/customerid/account/date