Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 6145fc8

Browse files
authored
Merge pull request #326 from appirio-tech/dev
sanitize project name and desc
2 parents 173ca4a + 11df8c9 commit 6145fc8

File tree

21 files changed

+271
-95
lines changed

21 files changed

+271
-95
lines changed

build-dependencies.xml

+2
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@
399399
<property name="ejb3-persistence.jar" value="${ext_libdir}/ejb-api/ejb3-persistence.jar"/>
400400
<property name="javaee.jar" value="${ext_libdir}/j2ee/1.5/javaee.jar"/>
401401
<property name="jaxb.jar" value="${ext_libdir}/jaxb/2.1.7/jaxb-api.jar"/>
402+
<property name="encoder.jar" value="${ext_libdir}/owasp/encoder-1.2.1.jar" />
402403
<property name="jsr311.jar" value="${ext_libdir}/j2ee/jsr311-api-1.1.1.jar"/>
403404

404405
<property name="jai_codec-1.1.3.jar" value="${ext_libdir}/jai/jai_codec-1.1.3.jar"/>
@@ -643,6 +644,7 @@
643644
<pathelement location="${jira-soapclient-all.jar}"/>
644645
<pathelement location="${servlet-api.jar}"/>
645646
<pathelement location="${jaxb.jar}"/>
647+
<pathelement location="${encoder.jar}"/>
646648
<pathelement location="${javaee.jar}"/>
647649
<pathelement location="${aws-java-sdk.jar}"/>
648650
<pathelement location="${jrss.jar}"/>

build.xml

+1
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@
316316
<copy file="${jackson-annotations-2.3.0.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
317317
<copy file="${jackson-core-2.3.2.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
318318
<copy file="${jackson-databind-2.3.2.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
319+
<copy file="${encoder.jar}" todir="${ear_shared_libdir}" overwrite="true" />
319320

320321
<copy file="${yuicompressor.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
321322
<copy file="${java-jwt-1.0.0.jar}" todir="${ear_shared_libdir}" overwrite="true"/>
35.8 KB
Binary file not shown.

services/project_service/build-dependencies.xml

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<property name="jboss-jaxws.jar" value="${jboss_home}/server/${jboss_config_name}/lib/jboss-jaxws.jar" />
5050
<property name="log4j.jar" value="${jboss_home}/server/${jboss_config_name}/lib/log4j.jar" />
5151
<property name="jaxb-api.jar" value="${ext_libdir}/jaxb/2.1.7/jaxb-api.jar" />
52+
<property name="encoder.jar" value="${ext_libdir}/owasp/encoder-1.2.1.jar" />
5253

5354
<property name="jboss-ejb3x.jar" value="${jboss_home}/client/jboss-ejb3x.jar" />
5455
<property name="ejb3-persistence.jar" value="${jboss_home}/client/ejb3-persistence.jar" />
@@ -80,6 +81,7 @@
8081
<pathelement location="${jbossall-client.jar}" />
8182
<pathelement location="${jboss-jaxws.jar}" />
8283
<pathelement location="${jaxb-api.jar}" />
84+
<pathelement location="${encoder.jar}" />
8385
</path>
8486

8587
<path id="component.test.3rdParty-dependencies">

services/project_service/src/java/main/com/topcoder/service/project/impl/ProjectServiceBean.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import com.topcoder.util.log.Level;
6262
import com.topcoder.util.log.Log;
6363
import com.topcoder.util.log.LogManager;
64+
import org.owasp.encoder.Encode;
6465

6566
/**
6667
* <p>
@@ -870,10 +871,12 @@ public ProjectData createProject(TCSubject tcSubject, ProjectData projectData) t
870871
// Validate
871872
checkProjectData(projectData, true);
872873

873-
// Create a new Project, copy name and description
874+
// Create a new Project, copy name and description, and sanitize them
874875
Project project = new Project();
875-
project.setName(projectData.getName());
876-
project.setDescription(projectData.getDescription());
876+
String projectName = Encode.forHtml(projectData.getName());
877+
project.setName(projectName);
878+
String description = Encode.forHtml(projectData.getDescription());
879+
project.setDescription(description);
877880
if (projectData.getProjectBillingAccountId() > 0) {
878881
// if there is billing account, activate the project
879882
project.setProjectStatusId(PROJECT_STATUS_ACTIVE);

src/java/main/com/topcoder/direct/services/view/action/contest/launch/SaveDraftContestAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,12 @@ public class SaveDraftContestAction extends ContestAction {
518518
* Checkpoint date of the contest if any.
519519
* </p>
520520
*/
521-
private Date checkpointDate = new Date();
521+
private Date checkpointDate = null;
522522

523523
/**
524524
* The registration end date
525525
*/
526-
private Date regEndDate = new Date();
526+
private Date regEndDate = null;
527527

528528
/**
529529
* <p>

src/web/WEB-INF/includes/contest/editTab.jsp

+20
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,20 @@
803803

804804
<div class="bottom_spec">
805805
</div>
806+
807+
<div class="hide">
808+
<p class="det_font">
809+
<span class="name"><strong>Environment </strong></span>
810+
<br />
811+
<span class="small_info_spec" id="rswEnvironment"></span>
812+
<br /><br/>
813+
<span class="name"><strong>Code repo </strong> </span>
814+
<br />
815+
<span class="small_info_spec" id="rswRepo"></span>
816+
</p>
817+
<div class="bottom_spec"></div>
818+
</div>
819+
806820
<p class="det_font">
807821
<span class="name"><strong>Final Deliverables</strong></span>
808822
<br />
@@ -869,6 +883,12 @@
869883

870884
</div>
871885
<!-- end .guidelines -->
886+
<div class="envRepo hide">
887+
<h3>Environment</h3>
888+
<input class="environmentEdit" name="environmentEdit" type="text" maxlength="500"/>
889+
<h3>Code Repo</h3>
890+
<input type="text" class="repoEdit" maxlength="500" />
891+
</div>
872892
</div> <!-- end .contestDetail -->
873893
<div class="deliverables">
874894
<h3><span class="icon">Final Deliverables:</span><a href="javascript:;" class="helpIcon"><span class="hide">Help</span></a></h3>

src/web/WEB-INF/includes/contest/editTabMarathon.jsp

+20-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
<span class="name fixWidthName" title="Enter challenge groups"><strong>Group(s):</strong></span>
261261
<div id="groupDiv"><div id="groups"></div></div>
262262
</div>
263-
<br/><br/>
263+
<br /><br />
264264
<span class="name fixWidthName"><strong>Created By</strong></span>
265265
<span class ='small_info_spec' id="challegneCreatorLabel"></span>
266266
<br/>
@@ -529,6 +529,19 @@
529529
</span>
530530
</div>
531531
</p>
532+
<div class="bottom_spec"></div>
533+
<div class="hide">
534+
<p class="det_font">
535+
<span class="name"><strong>Environment </strong></span>
536+
<br />
537+
<span class="small_info_spec" id="rswEnvironment"></span>
538+
<br /><br/>
539+
<span class="name"><strong>Code repo </strong> </span>
540+
<br />
541+
<span class="small_info_spec" id="rswRepo"></span>
542+
</p>
543+
<div class="bottom_spec"></div>
544+
</div>
532545
</div><!-- End .detailsContent -->
533546
</div><!-- End .details -->
534547
<!-- END Spec Display -->
@@ -576,6 +589,12 @@
576589

577590
</div>
578591
<!-- end .guidelines -->
592+
<div class="envRepo hide">
593+
<h3>Environment</h3>
594+
<input class="environmentEdit" name="environmentEdit" type="text" maxlength="500"/>
595+
<h3>Code Repo</h3>
596+
<input type="text" class="repoEdit" maxlength="500" />
597+
</div>
579598
</div> <!-- end .contestDetail -->
580599

581600
</div> <!-- End .launchContestOut -->

src/web/WEB-INF/includes/contest/editTabSoftware.jsp

+21-2
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
</div>
353353
</div>
354354
<div class="ms-group-display">
355-
<span class="name fixWidthName" title="Enter challenge groups"><strong>Group(s):</strong></span>
355+
<span class="name fixWidthName" title="Enter challenge groups"><strong>Group(s)</strong></span>
356356
<div class="ms-group-div"><div id="groups"></div></div>
357357
</div>
358358
<br/>
@@ -838,7 +838,20 @@
838838

839839
<div class="bottom_spec">
840840
</div>
841-
</div> <!-- End .component -->
841+
</div>
842+
<!-- End .component -->
843+
<div class="hide">
844+
<p class="det_font">
845+
<span class="name"><strong>Environment </strong></span>
846+
<br />
847+
<span class="small_info_spec" id="rswEnvironment"></span>
848+
<br /><br/>
849+
<span class="name"><strong>Code repo </strong> </span>
850+
<br />
851+
<span class="small_info_spec" id="rswRepo"></span>
852+
</p>
853+
<div class="bottom_spec"></div>
854+
</div>
842855
</div><!-- End .detailsContent -->
843856
</div><!-- End .details -->
844857
<!-- END Spec Display -->
@@ -944,6 +957,12 @@
944957
</div> <!-- end of prizesInner_tech -->
945958
</div>
946959
</s:if>
960+
<div class="envRepo hide">
961+
<h3>Environment</h3>
962+
<input class="environmentEdit" name="environmentEdit" type="text" maxlength="500"/>
963+
<h3>Code Repo</h3>
964+
<input type="text" class="repoEdit" maxlength="500" />
965+
</div>
947966
</div> <!-- end .contestDetail -->
948967
</div> <!-- End .launchContestOut -->
949968

src/web/WEB-INF/includes/launch/overview.jsp

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@
6868
</div>
6969
</div>
7070
<!-- end round 2 information -->
71+
<!-- Environment -->
72+
<div class="prizes hide">
73+
<h3>Environment :</h3>
74+
<input class="environmentEdit text" name="environmentEdit" type="text" maxlength="500"/>
75+
</div>
76+
77+
<!-- repo -->
78+
<div class="prizes hide">
79+
<h3>Code Repo :</h3>
80+
<input class="repoEdit text" name="repo" type="text" maxlength="500"/>
81+
</div>
7182
<!-- upload -->
7283
<div id="uploadSection">
7384

src/web/WEB-INF/includes/launch/overviewAlgorithm.jsp

+11
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@
4646
</div>
4747
</div>
4848
<!-- end Match Rules -->
49+
<!-- Environment -->
50+
<div class="prizes hide">
51+
<h3>Environment :</h3>
52+
<input class="environmentEdit text" name="environmentEdit" type="text" maxlength="500"/>
53+
</div>
54+
55+
<!-- repo -->
56+
<div class="prizes hide">
57+
<h3>Code Repo :</h3>
58+
<input class="repoEdit text" name="repo" type="text" maxlength="500"/>
59+
</div>
4960
<!-- upload -->
5061
<div id="alUploadSection">
5162
<h3>File Upload (20MB maximum):</h3>

src/web/WEB-INF/includes/launch/overviewSoftware.jsp

+11
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@
109109
</select>
110110
</div> <!-- end of prizesInner_tech -->
111111
</div>
112+
<!-- Environment -->
113+
<div class="prizes hide">
114+
<h3>Environment :</h3>
115+
<input class="environmentEdit text" name="environmentEdit" type="text" maxlength="500"/>
116+
</div>
117+
118+
<!-- repo -->
119+
<div class="prizes hide">
120+
<h3>Code Repo :</h3>
121+
<input class="repoEdit text" name="repo" type="text" maxlength="500"/>
122+
</div>
112123
<!-- Contest Detail -->
113124

114125
<!-- upload -->

src/web/WEB-INF/includes/launch/review.jsp

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979

8080
<dt class="rMultiInfo">Round Two Information :</dt>
8181
<dd class="rMultiInfo"><span id="rRound2Info"></span><a href="javascript: showPage('overviewPage');" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
82+
83+
<dt>Environment :</dt>
84+
<dd class="rEnvironment"><a href="javascript: backReview();" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
85+
86+
<dt>Code Repo :</dt>
87+
<dd class="rRepo"><a href="javascript: backReview();" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
8288
</dl>
8389
</div>
8490
<!-- end .contentList -->

src/web/WEB-INF/includes/launch/reviewAlgorithm.jsp

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262

6363
<dt>Match Rules :</dt>
6464
<dd><span id="ralMatchRules"></span><a href="javascript: showPage('overviewAlgorithmPage');" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
65+
66+
<dt>Environment :</dt>
67+
<dd class="rEnvironment"><a href="javascript: backReview();" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
68+
69+
<dt>Code Repo :</dt>
70+
<dd class="rRepo"><a href="javascript: backReview();" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
6571
</dl>
6672
</div>
6773
<!-- end .contentList -->

src/web/WEB-INF/includes/launch/reviewSoftware.jsp

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@
8383

8484
<dt>Technologies :</dt>
8585
<dd id="rTechnologies"><a href="javascript: backReview();" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
86+
87+
<dt>Environment :</dt>
88+
<dd class="rEnvironment"><a href="javascript: backReview();" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
89+
90+
<dt>Code Repo :</dt>
91+
<dd class="rRepo"><a href="javascript: backReview();" class="tipLink"><img src="/images/edit-icon.png" alt="Edit"/></a> </dd>
8692
</dl>
8793
</div>
8894
<!-- end .contentList -->

src/web/css/direct/launchcontest.css

+15
Original file line numberDiff line numberDiff line change
@@ -3267,4 +3267,19 @@ div.ms-group-display .ms-group-div{
32673267
border: 1px solid rgba(0,0,0,.15);
32683268
background-clip: padding-box;
32693269
margin-top: -2px;
3270+
}
3271+
3272+
.prizes input.text {
3273+
width: 396px;
3274+
height: 25px;
3275+
padding: 0 5px;
3276+
line-height: 25px;
3277+
border-radius: 4px;
3278+
border: 1px solid #C1C1C1;
3279+
font-size: 12px;
3280+
}
3281+
3282+
.envRepo input {
3283+
width: 401px;
3284+
height: 25px;
32703285
}

0 commit comments

Comments
 (0)