Skip to content

Commit 285e0dc

Browse files
committed
fix: made UI xss safe and not namespace hard coded
1 parent 3cd0382 commit 285e0dc

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,8 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
253253
set Action = 7
254254
quit $$$OK
255255
} elseif (menuItemName = "Sync") {
256-
#; if ..CheckForUncommittedFiles() {
257-
#; set Target = "Enter a commit message for the sync operation"
258-
#; set Action = 7
259-
#; set Msg = ..PreSync()
260-
#; } else {
261-
#; set Target = ""
262-
#; do ..Sync("",.Target)
263-
#; if (Target '= "") {
264-
#; set Action = 6
265-
#; }
266-
#; }
267256
set Action = 2 + externalBrowser
268-
set Target = urlPrefix _ "/isc/studio/usertemplates/gitsourcecontrol/sync.csp"
257+
set Target = urlPrefix _ "/isc/studio/usertemplates/gitsourcecontrol/sync.csp?Namespace="_$NAMESPACE
269258

270259
quit $$$OK
271260
} elseif (menuItemName = "Push") {

csp/sync.csp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
88
<link rel="stylesheet" type="text/css" href="css/git-webui.css" />
9-
<server>set $NAMESPACE = "USER"</server>
109
#(##class(SourceControl.Git.Utils).GetSourceControlInclude())#
1110
<style type="text/css">
1211
h1, h2 {
@@ -92,12 +91,12 @@
9291
while iterator.%GetNext(,.uncommitted) {
9392
set action = uncommitted.%Get("action")
9493
set file = uncommitted.%Get("file")
95-
&html<<li class="list-group-item #(action)#">#(file)#</li>>
94+
&html<<li class="list-group-item #(..EscapeHTML(action))#">#(..EscapeHTML(file))#</li>>
9695
}
9796
</server>
9897
</ul>
9998
<h3 class="section-header">Sync commit message:</h3>
100-
<input class="form-control" type="text" name="syncMsg" id="syncMsg" value="#(commitMsg)#">
99+
<input class="form-control" type="text" name="syncMsg" id="syncMsg" value="#(..EscapeHTML(commitMsg))#">
101100
</div>
102101
<div style="display: #(noFileDisplay)#">
103102
<h2 class="text-center">No files to commit with sync</h2>
@@ -111,7 +110,7 @@
111110
}
112111
</server>
113112

114-
<button class="btn btn-lg btn-primary" id="syncBtn" onClick="disableInput()">Sync</button>
113+
<button class="btn btn-lg btn-primary" id="syncBtn" onClick="disableInput(); #server(..PerformSync(self.document.getElementById('syncMsg').value))#">Sync</button>
115114
<div>
116115
<h3 class="output-header" id="outputHeader" style="display: #(outputDisplay)#">Sync output: </h3>
117116
<div class="container output" id="outputContainer" style="display: #(outputDisplay)#">
@@ -128,7 +127,6 @@
128127
document.getElementById('syncMsg').disabled = true;
129128
document.getElementById('syncBtn').innerHTML = 'Syncing...';
130129
document.getElementById('syncBtn').disabled = true;
131-
#server(..PerformSync(self.document.getElementById('syncMsg').value))#
132130
}
133131
</script>
134132
<script language="cache" method="PerformSync" arguments="syncMsg:%String">

0 commit comments

Comments
 (0)