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

Commit 96bee4f

Browse files
committed
sanitize challenge properties before saving
1 parent 37e8286 commit 96bee4f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

components/project_management/src/java/main/com/topcoder/management/project/persistence/AbstractInformixProjectPersistence.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import com.topcoder.util.sql.databaseabstraction.CustomResultSet;
6868
import com.topcoder.util.sql.databaseabstraction.InvalidCursorStateException;
6969
import com.topcoder.util.sql.databaseabstraction.NullColumnValueException;
70+
import org.owasp.encoder.Encode;
7071

7172
/**
7273
* <p>
@@ -5985,13 +5986,15 @@ private void createProjectProperties(Long projectId, Project project, Map idValu
59855986
for (Iterator it = idValueMap.entrySet().iterator(); it.hasNext();) {
59865987
Entry entry = (Entry) it.next();
59875988

5989+
Long key = (Long) entry.getKey();
5990+
String value = (String) entry.getValue();
5991+
value = Encode.forHtml(value);
59885992
// insert the project property into database
5989-
Object[] queryArgs = new Object[] {projectId, entry.getKey(),
5990-
entry.getValue(), operator, operator };
5993+
Object[] queryArgs = new Object[] {projectId, key,
5994+
value, operator, operator };
59915995
Helper.doDMLQuery(preparedStatement, queryArgs);
59925996

5993-
auditProjectInfo(conn, projectId, project, AUDIT_CREATE_TYPE, (Long) entry.getKey(),
5994-
(String) entry.getValue());
5997+
auditProjectInfo(conn, projectId, project, AUDIT_CREATE_TYPE, key, value);
59955998
}
59965999

59976000
} catch (SQLException e) {

0 commit comments

Comments
 (0)