Skip to content

Commit 13e3bb8

Browse files
author
Jason White
committed
Update for WEB-69. Fix for JSONInjection lesson. Stub in javascript for CSRF lesson update/fix
1 parent bcf7c9a commit 13e3bb8

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/main/java/org/owasp/webgoat/lessons/JSONInjection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void handleRequest(WebSession s)
106106
protected Element createContent(WebSession s)
107107
{
108108
ElementContainer ec = new ElementContainer();
109-
String lineSep = System.getProperty("line.separator");
109+
String lineSep = System.getProperty("line.separator");
110110
String script = "<script>"
111111
+ lineSep
112112
+ "function getFlights() {"
@@ -192,11 +192,11 @@ protected Element createContent(WebSession s)
192192

193193
"function check(){"
194194
+ lineSep
195-
+ " if ( document.getElementById('radio0').checked )"
195+
+ " if ( document.getElementById('radio0') && document.getElementById('radio0').checked )"
196196
+ lineSep
197197
+ " { document.getElementById('price2Submit').value = document.getElementById('priceID0').innerHTML; return true;}"
198198
+ lineSep
199-
+ " else if ( document.getElementById('radio1').checked )"
199+
+ " else if ( document.getElementById('radio1') && document.getElementById('radio1').checked )"
200200
+ lineSep
201201
+ " { document.getElementById('price2Submit').value = document.getElementById('priceID1').innerHTML; return true;}"
202202
+ lineSep + " else " + lineSep + " { alert('Please choose one flight'); return false;}" + lineSep + "}"

src/main/webapp/WEB-INF/pages/main_new.jsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@
148148
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-left" id="showPrevHintBtn" ng-click="viewPrevHint()"></span>
149149
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-right" id="showNextHintBtn" ng-click="viewNextHint()"></span>
150150
<br/>
151-
152-
<span id="curHintContainer"></span><!--{{curHint}}-->
151+
<span bind-html-unsafe="curHint"></span>
152+
<!--<span id="curHintContainer"></span>-->
153153
</div>
154154
</div>
155155
</div>

src/main/webapp/js/goatControllers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
8282
$("#lessonTitle").text(reply.data);
8383
}
8484
);
85+
//TODO encode html or get angular js portion working
8586
$("#lesson_content").html(reply.data);
8687
//hook forms
8788
goat.utils.makeFormsAjax();
8889
$('#leftside-navigation').height($('#main-content').height()+15)//TODO: get ride of fixed value (15)here
90+
//notifies goatLesson Controller of the less change
8991
$scope.$emit('lessonUpdate',{params:curScope.parameters});
9092
}
9193
)
@@ -207,7 +209,7 @@ var goatLesson = function($scope,$http,$log) {
207209
$scope.curHint = $scope.hints[$scope.hintIndex].hint;
208210
//$scope.curHint = $sce.trustAsHtml($scope.hints[$scope.hintIndex].hint);
209211
//TODO get html binding workin in the UI ... in the meantime ...
210-
$scope.renderCurHint();
212+
//$scope.renderCurHint();
211213
$scope.manageHintButtons();
212214
};
213215

src/main/webapp/js/goatUtil.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ goat.utils = {
9090
},
9191
makeId: function (lessonName) {
9292
return lessonName.replace(/\s|\(|\)|\!|\:|\;|\@|\#|\$|\%|\^|\&|\*/g,'');//TODO move the replace routine into util function
93+
},
94+
ajaxifyAttackHREF: function () {
95+
// stub for dealing with CSRF lesson link issues and other similar issues
9396
}
9497
};
9598

0 commit comments

Comments
 (0)