Fossil SCM

Fix SQL Injection vulnerability introduced by the new code in this branch. There still exists XSS vulnerabilities, but this is a first step.

drh 2025-04-12 13:53 tkt-improvements
Commit ffb5a4671577ec0747d9bc7c897b0acea813bd7f9fc07d683309cdd15fdb8645
1 file changed +8 -4
+8 -4
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -520,14 +520,18 @@
520520
@ <th1>enable_output 1</th1>
521521
@ <tr><td class="tktDspLabel">Version&nbsp;Found&nbsp;In:</td>
522522
@ <td colspan="3" valign="top" class="tktDspValue">
523523
@ <th1>
524524
@ set versionlink ""
525
-@ query "SELECT count(*) AS match FROM tag WHERE tagname = 'sym-$foundin'" {
526
-@ if {$match} {set versionlink "/timeline?t=$foundin"}}
527
-@ query "SELECT count(*) AS match FROM blob WHERE uuid LIKE '$foundin%'" {
528
-@ if {$match} {set versionlink "/info/$foundin"}}
525
+@ query {SELECT count(*) AS match FROM tag
526
+@ WHERE tagname=concat('sym-',$foundin)} {
527
+@ if {$match} {set versionlink "/timeline?t=$foundin"}
528
+@ }
529
+@ set pattern $foundin%
530
+@ query {SELECT count(*) AS match FROM blob WHERE uuid GLOB $pattern} {
531
+@ if {$match} {set versionlink "/info/$foundin"}
532
+@ }
529533
@ if {$versionlink eq ""} {
530534
@ html "$foundin"
531535
@ } else {
532536
@ html "<a href=\"$versionlink\">$foundin</a>"
533537
@ }
534538
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -520,14 +520,18 @@
520 @ <th1>enable_output 1</th1>
521 @ <tr><td class="tktDspLabel">Version&nbsp;Found&nbsp;In:</td>
522 @ <td colspan="3" valign="top" class="tktDspValue">
523 @ <th1>
524 @ set versionlink ""
525 @ query "SELECT count(*) AS match FROM tag WHERE tagname = 'sym-$foundin'" {
526 @ if {$match} {set versionlink "/timeline?t=$foundin"}}
527 @ query "SELECT count(*) AS match FROM blob WHERE uuid LIKE '$foundin%'" {
528 @ if {$match} {set versionlink "/info/$foundin"}}
 
 
 
 
529 @ if {$versionlink eq ""} {
530 @ html "$foundin"
531 @ } else {
532 @ html "<a href=\"$versionlink\">$foundin</a>"
533 @ }
534
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -520,14 +520,18 @@
520 @ <th1>enable_output 1</th1>
521 @ <tr><td class="tktDspLabel">Version&nbsp;Found&nbsp;In:</td>
522 @ <td colspan="3" valign="top" class="tktDspValue">
523 @ <th1>
524 @ set versionlink ""
525 @ query {SELECT count(*) AS match FROM tag
526 @ WHERE tagname=concat('sym-',$foundin)} {
527 @ if {$match} {set versionlink "/timeline?t=$foundin"}
528 @ }
529 @ set pattern $foundin%
530 @ query {SELECT count(*) AS match FROM blob WHERE uuid GLOB $pattern} {
531 @ if {$match} {set versionlink "/info/$foundin"}
532 @ }
533 @ if {$versionlink eq ""} {
534 @ html "$foundin"
535 @ } else {
536 @ html "<a href=\"$versionlink\">$foundin</a>"
537 @ }
538

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button