Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch robot-restrict-simplified Excluding Merge-Ins
This is equivalent to a diff from 661991aa62 to 206089acd1
|
2025-08-16
| ||
| 13:59 | Improvements and simplifications to anti-robot defenses. check-in: 16b33097fe user: drh tags: trunk | |
| 13:57 | Improved anti-robot captcha. Closed-Leaf check-in: 206089acd1 user: drh tags: robot-restrict-simplified | |
| 10:10 | Correct the signature of an extern decl of fossil_strndup(), as reported in [forum:21ac5f59a0 | forum post 21ac5f59a0]. check-in: d546932976 user: stephan tags: trunk | |
| 00:36 | Add the "timelineX" tag to robot-restrict processing. Move /honeypot over to the captcha.c file and have it use the resources found there. check-in: 54afc94ce0 user: drh tags: robot-restrict-simplified | |
|
2025-08-15
| ||
| 23:18 | Simplifications to the logic that tries to keep robots out. check-in: 02adced1c1 user: drh tags: robot-restrict-simplified | |
| 19:58 | Add /zip and /tarball pages to the robot-squelch mechanism. check-in: 661991aa62 user: drh tags: trunk | |
| 19:07 | Add the "robot-squelch" defense against bot-nets. Still incomplete, but sufficient to hold off the latest attacks. check-in: de66eeaab7 user: drh tags: trunk | |
Changes to src/browse.c.
| ︙ | |||
1160 1161 1162 1163 1164 1165 1166 | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | - |
const char *zNow; /* Time of check-in */
int isBranchCI; /* name= is a branch name */
int showId = PB("showid");
Stmt q1, q2;
double baseTime;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
|
| ︙ |
Changes to src/captcha.c.
| ︙ | |||
742 743 744 745 746 747 748 | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 | - + + + + + + + + + - - + - - - + - |
const char *zPw = P("name");
if( zPw==0 || zPw[0]==0 ){
(void)exclude_spiders(1);
@ <hr><p>The captcha is shown above. Add a name=HEX query parameter
@ to see how HEX would be rendered in the current captcha font.
@ <h2>Debug/Testing Values:</h2>
@ <ul>
|
| ︙ | |||
828 829 830 831 832 833 834 | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | - + |
/* ^^^^--- Don't overwrite a valid login on another repo! */
login_set_anon_cookie(0, 0);
}
cgi_append_header("X-Robot: 0\r\n");
}
login_redirect_to_g();
}else{
|
| ︙ |
Changes to src/diff.c.
| ︙ | |||
3786 3787 3788 3789 3790 3791 3792 | 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 | - + - |
struct AnnVers *p;
unsigned clr1, clr2, clr;
int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
/* Gather query parameters */
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
|
| ︙ |
Changes to src/diffcmd.c.
| ︙ | |||
1520 1521 1522 1523 1524 1525 1526 | 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 | - + |
const char *zFrom = P("from");
const char *zTo = P("to");
DiffConfig DCfg;
cgi_check_for_malice();
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
|
Changes to src/info.c.
| ︙ | |||
1419 1420 1421 1422 1423 1424 1425 | 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 | - + |
int graphFlags = 0;
Blob qp; /* non-glob= query parameters for generated links */
Blob qpGlob; /* glob= query parameter for generated links */
int bInvert = PB("inv");
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
|
| ︙ | |||
1973 1974 1975 1976 1977 1978 1979 | 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 | - + |
ReCompiled *pRe = 0;
u32 objdescFlags = 0;
int verbose = PB("verbose");
DiffConfig DCfg;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
|
| ︙ | |||
2414 2415 2416 2417 2418 2419 2420 | 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 | - + - + |
blob_zero(&downloadName);
if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL;
object_description(rid, objdescFlags, 0, &downloadName);
style_submenu_element("Download", "%R/raw/%s?at=%T",
zUuid, file_tail(blob_str(&downloadName)));
@ <hr>
content_get(rid, &content);
|
| ︙ | |||
2700 2701 2702 2703 2704 2705 2706 | 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 | - - - - - |
const char *zName = P("name");
const char *zCI = P("ci");
HQuery url;
char *zCIUuid = 0;
int isSymbolicCI = 0; /* ci= exists and is a symbolic name, not a hash */
int isBranchCI = 0; /* ci= refers to a branch name */
char *zHeader = 0;
|
| ︙ |
Changes to src/login.c.
| ︙ | |||
1301 1302 1303 1304 1305 1306 1307 | 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
fossil_exit(0);
}
}
fossil_free(zDecode);
return uid;
}
|
| ︙ | |||
1427 1428 1429 1430 1431 1432 1433 | 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 | - + | ** is valid. If the login cookie checks out, it then sets global ** variables appropriately. ** ** g.userUid Database USER.UID value. Might be -1 for "nobody" ** g.zLogin Database USER.LOGIN value. NULL for user "nobody" ** g.perm Permissions granted to this user ** g.anon Permissions that would be available to anonymous |
| ︙ | |||
1468 1469 1470 1471 1472 1473 1474 | 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | - + |
uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin);
}else{
uid = db_int(0, "SELECT uid FROM user WHERE cap LIKE '%%s%%'");
}
g.zLogin = db_text("?", "SELECT login FROM user WHERE uid=%d", uid);
zCap = "sxy";
g.noPswd = 1;
|
| ︙ | |||
1602 1603 1604 1605 1606 1607 1608 | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 | - - + + + + + |
zCap = "";
}
login_create_csrf_secret("none");
}
login_set_uid(uid, zCap);
|
| ︙ | |||
1642 1643 1644 1645 1646 1647 1648 | 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 | - + - + - + - + |
** "nobody" user is a special case in that g.zLogin==0.
*/
g.userUid = uid;
if( fossil_strcmp(g.zLogin,"nobody")==0 ){
g.zLogin = 0;
}
if( PB("isrobot") ){
|
| ︙ |
Changes to src/main.c.
| ︙ | |||
231 232 233 234 235 236 237 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | - + + |
#if USE_SEE
const char *zPidKey; /* Saved value of the --usepidkey option. Only
* applicable when using SEE on Windows or Linux. */
#endif
int useLocalauth; /* No login required if from 127.0.0.1 */
int noPswd; /* Logged in without password (on 127.0.0.1) */
int userUid; /* Integer user id */
|
| ︙ |
Changes to src/robot.c.
| ︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - - - - - - - - - + | ** Fossil is run as a service. */ #include "config.h" #include "robot.h" #include <assert.h> #include <time.h> |
| ︙ | |||
69 70 71 72 73 74 75 | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | - + - + - + - - + + - + + - + - - - - - - - - - - - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + - - + + + + + + + - - - - - + + + - - - - + + - - + - - - - - - - - - + + - - + - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } h1 = (h1 % 900000000) + 100000000; h2 = (h2 % 900000000) + 100000000; /* If there is already a proof-of-work cookie with this value ** that means that the user agent has already authenticated. */ |
Changes to src/setup.c.
| ︙ | |||
493 494 495 496 497 498 499 | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | - - + + - - - - - - - - + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - | @ <p>The settings on this page are intended to help site administrators @ defend the site against robots. @ @ <form action="%R/setup_robot" method="post"><div> login_insert_csrf_secret(); @ <input type="submit" name="submit" value="Apply Changes"></p> @ <hr> |
| ︙ |
Changes to src/style.c.
| ︙ | |||
1388 1389 1390 1391 1392 1393 1394 | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
** Display CGI-variables and other aspects of the run-time
** environment, for debugging and trouble-shooting purposes.
*/
void page_test_env(void){
webpage_error("");
}
|
| ︙ | |||
1485 1486 1487 1488 1489 1490 1491 | 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | - + |
#endif
@ g.zBaseURL = %h(g.zBaseURL)<br>
@ g.zHttpsURL = %h(g.zHttpsURL)<br>
@ g.zTop = %h(g.zTop)<br>
@ g.zPath = %h(g.zPath)<br>
@ g.userUid = %d(g.userUid)<br>
@ g.zLogin = %h(g.zLogin)<br>
|
| ︙ |
Changes to src/tar.c.
| ︙ | |||
758 759 760 761 762 763 764 | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | - + |
Glob *pInclude = 0; /* The compiled in= glob pattern */
Glob *pExclude = 0; /* The compiled ex= glob pattern */
Blob tarball; /* Tarball accumulated here */
const char *z;
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
|
| ︙ |
Changes to src/timeline.c.
| ︙ | |||
1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 | 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 | + |
}
if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum)
|| (bisectLocal && !g.perm.Setup)
){
login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki);
return;
}
if( zBefore && robot_restrict("timelineX") ) return;
if( !bisectLocal ){
etag_check(ETAG_QUERY|ETAG_COOKIE|ETAG_DATA|ETAG_CONFIG, 0);
}
cookie_read_parameter("y","y");
zType = P("y");
if( zType==0 ){
zType = g.perm.Read ? "ci" : "all";
|
| ︙ |
Changes to src/zip.c.
| ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | - + |
Glob *pExclude = 0; /* The compiled ex= glob pattern */
Blob zip; /* ZIP archive accumulated here */
int eType = ARCHIVE_ZIP; /* Type of archive to generate */
char *zType; /* Human-readable archive type */
login_check_credentials();
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
|
| ︙ |