Fossil SCM

Apply the spider SQL check to the diff URL argument of the /vdiff page. Improve some related docs.

stephan 2023-02-07 16:24 spider-sql-detection
Commit 936c122ff9398443f57a322ce460ff5e5841f7bd179867868bee07bc93f99bbe
2 files changed +2 -2 +2 -2
+2 -2
--- src/cgi.c
+++ src/cgi.c
@@ -1540,12 +1540,12 @@
15401540
}
15411541
}
15421542
15431543
/*
15441544
** A variant of cgi_parameter() with the same semantics except that if
1545
-** the fetched value fails the might_be_sql() test then it calls
1546
-** cgi_begone_spider() and does not return.
1545
+** cgi_parameter(zName,zDefault) returns a value other than zDefault
1546
+** then it passes that value to cgi_value_spider_check().
15471547
*/
15481548
const char *cgi_parameter_nosql(const char *zName, const char *zDefault){
15491549
const char *zTxt = cgi_parameter(zName, zDefault);
15501550
15511551
if( zTxt!=zDefault ){
15521552
--- src/cgi.c
+++ src/cgi.c
@@ -1540,12 +1540,12 @@
1540 }
1541 }
1542
1543 /*
1544 ** A variant of cgi_parameter() with the same semantics except that if
1545 ** the fetched value fails the might_be_sql() test then it calls
1546 ** cgi_begone_spider() and does not return.
1547 */
1548 const char *cgi_parameter_nosql(const char *zName, const char *zDefault){
1549 const char *zTxt = cgi_parameter(zName, zDefault);
1550
1551 if( zTxt!=zDefault ){
1552
--- src/cgi.c
+++ src/cgi.c
@@ -1540,12 +1540,12 @@
1540 }
1541 }
1542
1543 /*
1544 ** A variant of cgi_parameter() with the same semantics except that if
1545 ** cgi_parameter(zName,zDefault) returns a value other than zDefault
1546 ** then it passes that value to cgi_value_spider_check().
1547 */
1548 const char *cgi_parameter_nosql(const char *zName, const char *zDefault){
1549 const char *zTxt = cgi_parameter(zName, zDefault);
1550
1551 if( zTxt!=zDefault ){
1552
+2 -2
--- src/info.c
+++ src/info.c
@@ -648,11 +648,11 @@
648648
" WHERE blob.rid=%d"
649649
" AND event.objid=%d",
650650
rid, rid
651651
);
652652
zBrName = branch_of_rid(rid);
653
-
653
+
654654
diffType = preferred_diff_type();
655655
if( db_step(&q1)==SQLITE_ROW ){
656656
const char *zUuid = db_column_text(&q1, 0);
657657
int nUuid = db_column_bytes(&q1, 0);
658658
char *zEUser, *zEComment;
@@ -1686,11 +1686,11 @@
16861686
dflt = db_get_int("preferred-diff-type",-99);
16871687
if( dflt<=0 ) dflt = user_agent_is_likely_mobile() ? 1 : 2;
16881688
zDflt[0] = dflt + '0';
16891689
zDflt[1] = 0;
16901690
cookie_link_parameter("diff","diff", zDflt);
1691
- return atoi(PD("diff",zDflt));
1691
+ return atoi(PD_NoSQL("diff",zDflt));
16921692
}
16931693
16941694
16951695
/*
16961696
** WEBPAGE: fdiff
16971697
--- src/info.c
+++ src/info.c
@@ -648,11 +648,11 @@
648 " WHERE blob.rid=%d"
649 " AND event.objid=%d",
650 rid, rid
651 );
652 zBrName = branch_of_rid(rid);
653
654 diffType = preferred_diff_type();
655 if( db_step(&q1)==SQLITE_ROW ){
656 const char *zUuid = db_column_text(&q1, 0);
657 int nUuid = db_column_bytes(&q1, 0);
658 char *zEUser, *zEComment;
@@ -1686,11 +1686,11 @@
1686 dflt = db_get_int("preferred-diff-type",-99);
1687 if( dflt<=0 ) dflt = user_agent_is_likely_mobile() ? 1 : 2;
1688 zDflt[0] = dflt + '0';
1689 zDflt[1] = 0;
1690 cookie_link_parameter("diff","diff", zDflt);
1691 return atoi(PD("diff",zDflt));
1692 }
1693
1694
1695 /*
1696 ** WEBPAGE: fdiff
1697
--- src/info.c
+++ src/info.c
@@ -648,11 +648,11 @@
648 " WHERE blob.rid=%d"
649 " AND event.objid=%d",
650 rid, rid
651 );
652 zBrName = branch_of_rid(rid);
653
654 diffType = preferred_diff_type();
655 if( db_step(&q1)==SQLITE_ROW ){
656 const char *zUuid = db_column_text(&q1, 0);
657 int nUuid = db_column_bytes(&q1, 0);
658 char *zEUser, *zEComment;
@@ -1686,11 +1686,11 @@
1686 dflt = db_get_int("preferred-diff-type",-99);
1687 if( dflt<=0 ) dflt = user_agent_is_likely_mobile() ? 1 : 2;
1688 zDflt[0] = dflt + '0';
1689 zDflt[1] = 0;
1690 cookie_link_parameter("diff","diff", zDflt);
1691 return atoi(PD_NoSQL("diff",zDflt));
1692 }
1693
1694
1695 /*
1696 ** WEBPAGE: fdiff
1697

Keyboard Shortcuts

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