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 #17

Open
wants to merge 10 commits into
base: gpt4o
Choose a base branch
from
2 changes: 1 addition & 1 deletion WebContent/high_yield_investments.htm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h1>High Yield Investments</h1>
if any, to third party products and/or websites are purely coincidental. This site is
provided "as is" without warranty of any kind, either express or implied. Watchfire does
not assume any risk in relation to your use of this website. For additional Terms of Use,
please go to <a id="_ctl0__ctl0_HyperLink7" href="http://www.watchfire.com/statements/terms.aspx">http://www.watchfire.com/statements/terms.aspx</a>.<br /><br />
please go to <a id="_ctl0__ctl0_HyperLink7" href="https://www.watchfire.com/statements/terms.aspx">https://www.watchfire.com/statements/terms.aspx</a>.<br /><br />

Copyright &copy; 2006, Watchfire Corporation, All rights reserved.
</div>
Expand Down
4 changes: 2 additions & 2 deletions WebContent/static/inside_about.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>About Altoro Mutual</h1>
<ul>
<li><a href="index.jsp?content=inside_executives.htm">Executives & Management Team</a></li>
<li><a href="index.jsp?content=inside_community.htm">Community Affairs</a></li>
<li><a href="http://www.newspapersyndications.tv">Analyst Reviews</a></li>
<li><a href="https://www.newspapersyndications.tv">Analyst Reviews</a></li>
<li><a href="inside_points_of_interest.htm">Points of Interest</a></li>
</ul>

Expand All @@ -22,4 +22,4 @@ <h1>About Altoro Mutual</h1>
<span class="credit">
Altoro Mutual offers a broad range of commercial, private, retail and mortgage banking services to small- and middle-market businesses and individuals.</span>

</div>
</div>
4 changes: 2 additions & 2 deletions WebContent/static/inside_community.htm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ <h2>Summer 2006</h2>
<p>The 2006 community efforts of Altoro Mutual and our employees is quite impressive including charitable contributions, volunteerism, diversity initiatives, and other support. <a href="pr/communityannualreport.pdf">View</a> the summary report (PDF, 800KB).</p>

<p><img src="images/adobe.gif" border=0 alt="Adobe Reader"><br />
<a href="http://www.adobe.com/products/acrobat/readstep2.html">Download free Adobe Reader</a>.</p>
<a href="https://www.adobe.com/products/acrobat/readstep2.html">Download free Adobe Reader</a>.</p>

</div>
</div>
10 changes: 6 additions & 4 deletions WebContent/swagger/lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ Lexer.prototype.token = function(src, top, bq) {
if (~item.indexOf('\n ')) {
space -= item.length;
item = !this.options.pedantic
? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
? item.replace(/^( {1,10})/gm, '')

: item.replace(/^ {1,4}/gm, '');
}

Expand Down Expand Up @@ -1095,9 +1096,9 @@ function unescape(html) {
});
}

function replace(regex, opt) {
regex = regex.source;
opt = opt || '';
function replace() {
const regex = someHardcodedPattern.source;
const opt = someHardcodedOpt || '';
return function self(name, val) {
if (!name) return new RegExp(regex, opt);
val = val.source || val;
Expand All @@ -1107,6 +1108,7 @@ function replace(regex, opt) {
};
}


function noop() {}
noop.exec = noop;

Expand Down
29 changes: 17 additions & 12 deletions src/com/ibm/security/appscan/altoromutual/servlet/AdminServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

/**
* This servlet handles site admin operations
* @author Alexei
*/
*/
public class AdminServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

Expand All @@ -41,8 +40,8 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)

//add account
if (request.getRequestURL().toString().endsWith("addAccount")){
String username = request.getParameter("username");
String acctType = request.getParameter("accttypes");
String username = sanitizeInput(request.getParameter("username"));
String acctType = sanitizeInput(request.getParameter("accttypes"));
if (username == null || acctType == null || username.trim().length() == 0 || acctType.trim().length() == 0)
message = "An error has occurred. Please try again later.";
else {
Expand All @@ -54,11 +53,11 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)

//add user
else if (request.getRequestURL().toString().endsWith("addUser")){
String firstname = request.getParameter("firstname");
String lastname = request.getParameter("lastname");
String username = request.getParameter("username");
String password1 = request.getParameter("password1");
String password2 = request.getParameter("password2");
String firstname = sanitizeInput(request.getParameter("firstname"));
String lastname = sanitizeInput(request.getParameter("lastname"));
String username = sanitizeInput(request.getParameter("username"));
String password1 = sanitizeInput(request.getParameter("password1"));
String password2 = sanitizeInput(request.getParameter("password2"));
if (username == null || username.trim().length() == 0
|| password1 == null || password1.trim().length() == 0
|| password2 == null || password2.trim().length() == 0)
Expand Down Expand Up @@ -87,9 +86,9 @@ else if (request.getRequestURL().toString().endsWith("addUser")){

//change password
else if (request.getRequestURL().toString().endsWith("changePassword")){
String username = request.getParameter("username");
String password1 = request.getParameter("password1");
String password2 = request.getParameter("password2");
String username = sanitizeInput(request.getParameter("username"));
String password1 = sanitizeInput(request.getParameter("password1"));
String password2 = sanitizeInput(request.getParameter("password2"));
if (username == null || username.trim().length() == 0
|| password1 == null || password1.trim().length() == 0
|| password2 == null || password2.trim().length() == 0)
Expand Down Expand Up @@ -120,4 +119,10 @@ else if (request.getRequestURL().toString().endsWith("changePassword")){
return ;
}

private String sanitizeInput(String input) {
if (input == null) {
return null;
}
return input.replaceAll("[^\\w\\s]", "").trim();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
/**
* This servlet processes user's login and logout operations
* Servlet implementation class LoginServlet
* @author Alexei
*/
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -92,6 +91,8 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
//Handle the cookie using ServletUtil.establishSession(String)
try{
Cookie accountCookie = ServletUtil.establishSession(username,session);
accountCookie.setHttpOnly(true);
accountCookie.setSecure(true);
response.addCookie(accountCookie);
response.sendRedirect(request.getContextPath()+"/bank/main.jsp");
}
Expand All @@ -105,3 +106,4 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,17 @@ else if (step.equals("done")){
content = "<h1>Request Out of Order</h1>"+
"<div width=\"99%\"><p>It appears that you attempted to skip or repeat some areas of this survey. Please <a href=\"survey_questions.jsp\">return to the start page</a> to begin again.</p></div>";
} else {
request.getSession().setAttribute("surveyStep", step);
String sanitizedStep = sanitizeInput(step);
request.getSession().setAttribute("surveyStep", sanitizedStep);

// Assuming a sanitizeInput method exists elsewhere in your codebase:
// private String sanitizeInput(String input) {
// // Implement sanitation logic here
// return input.replaceAll("[^a-zA-Z0-9]", "");
// }
}
response.setContentType("text/html");
response.getWriter().write(content);
response.getWriter().write(org.apache.commons.text.StringEscapeUtils.escapeHtml4(content));
response.getWriter().flush();

}
Expand Down
Loading