| | @@ -118,24 +118,15 @@ |
| 118 | 118 | { "adunit-omit-if-user", CONFIGSET_SKIN }, |
| 119 | 119 | { "default-csp", CONFIGSET_SKIN }, |
| 120 | 120 | { "sitemap-extra", CONFIGSET_SKIN }, |
| 121 | 121 | { "safe-html", CONFIGSET_SKIN }, |
| 122 | 122 | |
| 123 | | -#ifdef FOSSIL_ENABLE_TH1_DOCS |
| 124 | | - { "th1-docs", CONFIGSET_TH1 }, |
| 125 | | -#endif |
| 126 | 123 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 127 | 124 | { "th1-hooks", CONFIGSET_TH1 }, |
| 128 | 125 | #endif |
| 129 | | - { "th1-setup", CONFIGSET_TH1 }, |
| 130 | 126 | { "th1-uri-regexp", CONFIGSET_TH1 }, |
| 131 | 127 | |
| 132 | | -#ifdef FOSSIL_ENABLE_TCL |
| 133 | | - { "tcl", CONFIGSET_TH1 }, |
| 134 | | - { "tcl-setup", CONFIGSET_TH1 }, |
| 135 | | -#endif |
| 136 | | - |
| 137 | 128 | { "project-name", CONFIGSET_PROJ }, |
| 138 | 129 | { "short-project-name", CONFIGSET_PROJ }, |
| 139 | 130 | { "project-description", CONFIGSET_PROJ }, |
| 140 | 131 | { "index-page", CONFIGSET_PROJ }, |
| 141 | 132 | { "manifest", CONFIGSET_PROJ }, |
| | @@ -239,17 +230,35 @@ |
| 239 | 230 | ** |
| 240 | 231 | ** "Safe" in the previous paragraph means the permission is granted to |
| 241 | 232 | ** export the property. In other words, the requesting side has presented |
| 242 | 233 | ** login credentials and has sufficient capabilities to access the requested |
| 243 | 234 | ** information. |
| 235 | +** |
| 236 | +** Settings which are specifically flagged as sensitive will (as of |
| 237 | +** 2024-10-15) cause this function to return 0, regardless of user |
| 238 | +** permissions. As an example, if the th1-setup setting were not |
| 239 | +** sensitive then a malicious repo admin could set that to include |
| 240 | +** arbitrary TCL code and affect users who configure fossil with the |
| 241 | +** --with-tcl flag. |
| 244 | 242 | */ |
| 245 | 243 | int configure_is_exportable(const char *zName){ |
| 246 | 244 | int i; |
| 247 | 245 | int n = strlen(zName); |
| 246 | + Setting *pSet; |
| 248 | 247 | if( n>2 && zName[0]=='\'' && zName[n-1]=='\'' ){ |
| 248 | + char * zCpy; |
| 249 | 249 | zName++; |
| 250 | 250 | n -= 2; |
| 251 | + zCpy = fossil_strndup(zName, (ssize_t)n); |
| 252 | + pSet = db_find_setting(zCpy, 0); |
| 253 | + fossil_free(zCpy); |
| 254 | + }else{ |
| 255 | + pSet = db_find_setting(zName, 0); |
| 256 | + } |
| 257 | + if( pSet && pSet->sensitive ){ |
| 258 | + /* https://fossil-scm.org/forum/forumpost/6179500deadf6ec7 */ |
| 259 | + return 0; |
| 251 | 260 | } |
| 252 | 261 | for(i=0; i<count(aConfig); i++){ |
| 253 | 262 | if( strncmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){ |
| 254 | 263 | int m = aConfig[i].groupMask; |
| 255 | 264 | if( !g.perm.Admin ){ |
| | @@ -414,10 +423,15 @@ |
| 414 | 423 | if( nToken>=count(azToken)-1 ) break; |
| 415 | 424 | } |
| 416 | 425 | if( nToken<2 ) return; |
| 417 | 426 | if( aType[ii].zName[0]=='/' ){ |
| 418 | 427 | thisMask = configure_is_exportable(azToken[1]); |
| 428 | + if( 0==thisMask ){ |
| 429 | + fossil_warning("Skipping non-exportable setting: %s = %s", |
| 430 | + azToken[1], nToken>3 ? azToken[3] : "?"); |
| 431 | + /* Will be skipped below */ |
| 432 | + } |
| 419 | 433 | }else{ |
| 420 | 434 | thisMask = configure_is_exportable(aType[ii].zName); |
| 421 | 435 | } |
| 422 | 436 | if( (thisMask & groupMask)==0 ) return; |
| 423 | 437 | if( (thisMask & checkMask)!=0 ){ |
| | @@ -681,10 +695,15 @@ |
| 681 | 695 | } |
| 682 | 696 | db_prepare(&q, "SELECT mtime, quote(name), quote(value) FROM config" |
| 683 | 697 | " WHERE name=:name AND mtime>=%lld", iStart); |
| 684 | 698 | for(ii=0; ii<count(aConfig); ii++){ |
| 685 | 699 | if( (aConfig[ii].groupMask & groupMask)!=0 && aConfig[ii].zName[0]!='@' ){ |
| 700 | + const Setting * pSet = db_find_setting(aConfig[ii].zName, 0); |
| 701 | + if( pSet && pSet->sensitive ){ |
| 702 | + /* https://fossil-scm.org/forum/forumpost/6179500deadf6ec7 */ |
| 703 | + continue; |
| 704 | + } |
| 686 | 705 | db_bind_text(&q, ":name", aConfig[ii].zName); |
| 687 | 706 | while( db_step(&q)==SQLITE_ROW ){ |
| 688 | 707 | blob_appendf(&rec,"%s %s value %s", |
| 689 | 708 | db_column_text(&q, 0), |
| 690 | 709 | db_column_text(&q, 1), |
| 691 | 710 | |