Fossil SCM
Further improvements to the artifact receipt log.
Commit
ca2f1e4e29994cd1645b204e36f7ee36bf6d721b
Parent
4bd49a210881483…
2 files changed
+3
-3
+26
-8
+3
-3
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -105,15 +105,15 @@ | ||
| 105 | 105 | "Edit HTML text for an ad unit inserted after the menu bar"); |
| 106 | 106 | setup_menu_entry("Logo", "setup_logo", |
| 107 | 107 | "Change the logo and background images for the server"); |
| 108 | 108 | setup_menu_entry("Shunned", "shun", |
| 109 | 109 | "Show artifacts that are shunned by this repository"); |
| 110 | - setup_menu_entry("Log", "rcvfromlist", | |
| 110 | + setup_menu_entry("Artifact Receipts Log", "rcvfromlist", | |
| 111 | 111 | "A record of received artifacts and their sources"); |
| 112 | - setup_menu_entry("User-Log", "access_log", | |
| 112 | + setup_menu_entry("User Log", "access_log", | |
| 113 | 113 | "A record of login attempts"); |
| 114 | - setup_menu_entry("Admin-Log", "admin_log", | |
| 114 | + setup_menu_entry("Administrative Log", "admin_log", | |
| 115 | 115 | "View the admin_log entries"); |
| 116 | 116 | setup_menu_entry("Stats", "stat", |
| 117 | 117 | "Display repository statistics"); |
| 118 | 118 | setup_menu_entry("SQL", "admin_sql", |
| 119 | 119 | "Enter raw SQL commands"); |
| 120 | 120 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -105,15 +105,15 @@ | |
| 105 | "Edit HTML text for an ad unit inserted after the menu bar"); |
| 106 | setup_menu_entry("Logo", "setup_logo", |
| 107 | "Change the logo and background images for the server"); |
| 108 | setup_menu_entry("Shunned", "shun", |
| 109 | "Show artifacts that are shunned by this repository"); |
| 110 | setup_menu_entry("Log", "rcvfromlist", |
| 111 | "A record of received artifacts and their sources"); |
| 112 | setup_menu_entry("User-Log", "access_log", |
| 113 | "A record of login attempts"); |
| 114 | setup_menu_entry("Admin-Log", "admin_log", |
| 115 | "View the admin_log entries"); |
| 116 | setup_menu_entry("Stats", "stat", |
| 117 | "Display repository statistics"); |
| 118 | setup_menu_entry("SQL", "admin_sql", |
| 119 | "Enter raw SQL commands"); |
| 120 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -105,15 +105,15 @@ | |
| 105 | "Edit HTML text for an ad unit inserted after the menu bar"); |
| 106 | setup_menu_entry("Logo", "setup_logo", |
| 107 | "Change the logo and background images for the server"); |
| 108 | setup_menu_entry("Shunned", "shun", |
| 109 | "Show artifacts that are shunned by this repository"); |
| 110 | setup_menu_entry("Artifact Receipts Log", "rcvfromlist", |
| 111 | "A record of received artifacts and their sources"); |
| 112 | setup_menu_entry("User Log", "access_log", |
| 113 | "A record of login attempts"); |
| 114 | setup_menu_entry("Administrative Log", "admin_log", |
| 115 | "View the admin_log entries"); |
| 116 | setup_menu_entry("Stats", "stat", |
| 117 | "Display repository statistics"); |
| 118 | setup_menu_entry("SQL", "admin_sql", |
| 119 | "Enter raw SQL commands"); |
| 120 |
+26
-8
| --- src/shun.c | ||
| +++ src/shun.c | ||
| @@ -295,37 +295,50 @@ | ||
| 295 | 295 | ** |
| 296 | 296 | ** Show a listing of RCVFROM table entries. |
| 297 | 297 | */ |
| 298 | 298 | void rcvfromlist_page(void){ |
| 299 | 299 | int ofst = atoi(PD("ofst","0")); |
| 300 | + int showAll = P("all")!=0; | |
| 300 | 301 | int cnt; |
| 301 | 302 | Stmt q; |
| 302 | 303 | |
| 303 | 304 | login_check_credentials(); |
| 304 | 305 | if( !g.perm.Admin ){ |
| 305 | 306 | login_needed(); |
| 306 | 307 | } |
| 307 | - style_header("Content Sources"); | |
| 308 | + style_header("Artifact Receipts"); | |
| 309 | + if( showAll ){ | |
| 310 | + ofst = 0; | |
| 311 | + }else{ | |
| 312 | + style_submenu_element("All", "All", "rcvfromlist?all=1"); | |
| 313 | + } | |
| 308 | 314 | if( ofst>0 ){ |
| 309 | 315 | style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d", |
| 310 | 316 | ofst>30 ? ofst-30 : 0); |
| 311 | 317 | } |
| 318 | + db_multi_exec( | |
| 319 | + "CREATE TEMP TABLE rcvidUsed(x INTEGER PRIMARY KEY);" | |
| 320 | + "INSERT OR IGNORE INTO rcvidUsed(x) SELECT rcvid FROM blob;" | |
| 321 | + ); | |
| 312 | 322 | db_prepare(&q, |
| 313 | - "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr" | |
| 323 | + "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr," | |
| 324 | + " EXISTS(SELECT 1 FROM rcvidUsed WHERE x=rcvfrom.rcvid)" | |
| 314 | 325 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 315 | - " ORDER BY rcvid DESC LIMIT 31 OFFSET %d", | |
| 316 | - ofst | |
| 326 | + " ORDER BY rcvid DESC LIMIT %d OFFSET %d", | |
| 327 | + showAll ? -1 : 31, ofst | |
| 317 | 328 | ); |
| 318 | 329 | @ <p>Whenever new artifacts are added to the repository, either by |
| 319 | 330 | @ push or using the web interface, an entry is made in the RCVFROM table |
| 320 | 331 | @ to record the source of that artifact. This log facilitates |
| 321 | 332 | @ finding and fixing attempts to inject illicit content into the |
| 322 | 333 | @ repository.</p> |
| 323 | 334 | @ |
| 324 | 335 | @ <p>Click on the "rcvid" to show a list of specific artifacts received |
| 325 | 336 | @ by a transaction. After identifying illicit artifacts, remove them |
| 326 | - @ using the "Shun" feature.</p> | |
| 337 | + @ using the "Shun" button. If an "rcvid" is not hyperlinked, that means | |
| 338 | + @ all artifacts associated with that rcvid have already been shunned | |
| 339 | + @ or purged.</p> | |
| 327 | 340 | @ |
| 328 | 341 | @ <table cellpadding="0" cellspacing="0" border="0"> |
| 329 | 342 | @ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th> |
| 330 | 343 | @ <th style="padding-right: 15px;text-align: left;">Date</th> |
| 331 | 344 | @ <th style="padding-right: 15px;text-align: left;">User</th> |
| @@ -334,17 +347,22 @@ | ||
| 334 | 347 | while( db_step(&q)==SQLITE_ROW ){ |
| 335 | 348 | int rcvid = db_column_int(&q, 0); |
| 336 | 349 | const char *zUser = db_column_text(&q, 1); |
| 337 | 350 | const char *zDate = db_column_text(&q, 2); |
| 338 | 351 | const char *zIpAddr = db_column_text(&q, 3); |
| 339 | - if( cnt==30 ){ | |
| 352 | + if( cnt==30 && !showAll ){ | |
| 340 | 353 | style_submenu_element("Older", "Older", |
| 341 | 354 | "rcvfromlist?ofst=%d", ofst+30); |
| 342 | 355 | }else{ |
| 343 | 356 | cnt++; |
| 344 | 357 | @ <tr> |
| 345 | - @ <td style="padding-right: 15px;text-align: right;"><a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td> | |
| 358 | + if( db_column_int(&q,4) ){ | |
| 359 | + @ <td style="padding-right: 15px;text-align: right;"> | |
| 360 | + @ <a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td> | |
| 361 | + }else{ | |
| 362 | + @ <td style="padding-right: 15px;text-align: right;">%d(rcvid)</td> | |
| 363 | + } | |
| 346 | 364 | @ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td> |
| 347 | 365 | @ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td> |
| 348 | 366 | @ <td style="text-align: left;">%s(zIpAddr)</td> |
| 349 | 367 | @ </tr> |
| 350 | 368 | } |
| @@ -365,11 +383,11 @@ | ||
| 365 | 383 | |
| 366 | 384 | login_check_credentials(); |
| 367 | 385 | if( !g.perm.Admin ){ |
| 368 | 386 | login_needed(); |
| 369 | 387 | } |
| 370 | - style_header("Content Source %d", rcvid); | |
| 388 | + style_header("Artifact Receipt %d", rcvid); | |
| 371 | 389 | if( db_exists( |
| 372 | 390 | "SELECT 1 FROM blob WHERE rcvid=%d AND" |
| 373 | 391 | " NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid) |
| 374 | 392 | ){ |
| 375 | 393 | style_submenu_element("Shun All", "Shun All", |
| 376 | 394 |
| --- src/shun.c | |
| +++ src/shun.c | |
| @@ -295,37 +295,50 @@ | |
| 295 | ** |
| 296 | ** Show a listing of RCVFROM table entries. |
| 297 | */ |
| 298 | void rcvfromlist_page(void){ |
| 299 | int ofst = atoi(PD("ofst","0")); |
| 300 | int cnt; |
| 301 | Stmt q; |
| 302 | |
| 303 | login_check_credentials(); |
| 304 | if( !g.perm.Admin ){ |
| 305 | login_needed(); |
| 306 | } |
| 307 | style_header("Content Sources"); |
| 308 | if( ofst>0 ){ |
| 309 | style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d", |
| 310 | ofst>30 ? ofst-30 : 0); |
| 311 | } |
| 312 | db_prepare(&q, |
| 313 | "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr" |
| 314 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 315 | " ORDER BY rcvid DESC LIMIT 31 OFFSET %d", |
| 316 | ofst |
| 317 | ); |
| 318 | @ <p>Whenever new artifacts are added to the repository, either by |
| 319 | @ push or using the web interface, an entry is made in the RCVFROM table |
| 320 | @ to record the source of that artifact. This log facilitates |
| 321 | @ finding and fixing attempts to inject illicit content into the |
| 322 | @ repository.</p> |
| 323 | @ |
| 324 | @ <p>Click on the "rcvid" to show a list of specific artifacts received |
| 325 | @ by a transaction. After identifying illicit artifacts, remove them |
| 326 | @ using the "Shun" feature.</p> |
| 327 | @ |
| 328 | @ <table cellpadding="0" cellspacing="0" border="0"> |
| 329 | @ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th> |
| 330 | @ <th style="padding-right: 15px;text-align: left;">Date</th> |
| 331 | @ <th style="padding-right: 15px;text-align: left;">User</th> |
| @@ -334,17 +347,22 @@ | |
| 334 | while( db_step(&q)==SQLITE_ROW ){ |
| 335 | int rcvid = db_column_int(&q, 0); |
| 336 | const char *zUser = db_column_text(&q, 1); |
| 337 | const char *zDate = db_column_text(&q, 2); |
| 338 | const char *zIpAddr = db_column_text(&q, 3); |
| 339 | if( cnt==30 ){ |
| 340 | style_submenu_element("Older", "Older", |
| 341 | "rcvfromlist?ofst=%d", ofst+30); |
| 342 | }else{ |
| 343 | cnt++; |
| 344 | @ <tr> |
| 345 | @ <td style="padding-right: 15px;text-align: right;"><a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td> |
| 346 | @ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td> |
| 347 | @ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td> |
| 348 | @ <td style="text-align: left;">%s(zIpAddr)</td> |
| 349 | @ </tr> |
| 350 | } |
| @@ -365,11 +383,11 @@ | |
| 365 | |
| 366 | login_check_credentials(); |
| 367 | if( !g.perm.Admin ){ |
| 368 | login_needed(); |
| 369 | } |
| 370 | style_header("Content Source %d", rcvid); |
| 371 | if( db_exists( |
| 372 | "SELECT 1 FROM blob WHERE rcvid=%d AND" |
| 373 | " NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid) |
| 374 | ){ |
| 375 | style_submenu_element("Shun All", "Shun All", |
| 376 |
| --- src/shun.c | |
| +++ src/shun.c | |
| @@ -295,37 +295,50 @@ | |
| 295 | ** |
| 296 | ** Show a listing of RCVFROM table entries. |
| 297 | */ |
| 298 | void rcvfromlist_page(void){ |
| 299 | int ofst = atoi(PD("ofst","0")); |
| 300 | int showAll = P("all")!=0; |
| 301 | int cnt; |
| 302 | Stmt q; |
| 303 | |
| 304 | login_check_credentials(); |
| 305 | if( !g.perm.Admin ){ |
| 306 | login_needed(); |
| 307 | } |
| 308 | style_header("Artifact Receipts"); |
| 309 | if( showAll ){ |
| 310 | ofst = 0; |
| 311 | }else{ |
| 312 | style_submenu_element("All", "All", "rcvfromlist?all=1"); |
| 313 | } |
| 314 | if( ofst>0 ){ |
| 315 | style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d", |
| 316 | ofst>30 ? ofst-30 : 0); |
| 317 | } |
| 318 | db_multi_exec( |
| 319 | "CREATE TEMP TABLE rcvidUsed(x INTEGER PRIMARY KEY);" |
| 320 | "INSERT OR IGNORE INTO rcvidUsed(x) SELECT rcvid FROM blob;" |
| 321 | ); |
| 322 | db_prepare(&q, |
| 323 | "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr," |
| 324 | " EXISTS(SELECT 1 FROM rcvidUsed WHERE x=rcvfrom.rcvid)" |
| 325 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 326 | " ORDER BY rcvid DESC LIMIT %d OFFSET %d", |
| 327 | showAll ? -1 : 31, ofst |
| 328 | ); |
| 329 | @ <p>Whenever new artifacts are added to the repository, either by |
| 330 | @ push or using the web interface, an entry is made in the RCVFROM table |
| 331 | @ to record the source of that artifact. This log facilitates |
| 332 | @ finding and fixing attempts to inject illicit content into the |
| 333 | @ repository.</p> |
| 334 | @ |
| 335 | @ <p>Click on the "rcvid" to show a list of specific artifacts received |
| 336 | @ by a transaction. After identifying illicit artifacts, remove them |
| 337 | @ using the "Shun" button. If an "rcvid" is not hyperlinked, that means |
| 338 | @ all artifacts associated with that rcvid have already been shunned |
| 339 | @ or purged.</p> |
| 340 | @ |
| 341 | @ <table cellpadding="0" cellspacing="0" border="0"> |
| 342 | @ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th> |
| 343 | @ <th style="padding-right: 15px;text-align: left;">Date</th> |
| 344 | @ <th style="padding-right: 15px;text-align: left;">User</th> |
| @@ -334,17 +347,22 @@ | |
| 347 | while( db_step(&q)==SQLITE_ROW ){ |
| 348 | int rcvid = db_column_int(&q, 0); |
| 349 | const char *zUser = db_column_text(&q, 1); |
| 350 | const char *zDate = db_column_text(&q, 2); |
| 351 | const char *zIpAddr = db_column_text(&q, 3); |
| 352 | if( cnt==30 && !showAll ){ |
| 353 | style_submenu_element("Older", "Older", |
| 354 | "rcvfromlist?ofst=%d", ofst+30); |
| 355 | }else{ |
| 356 | cnt++; |
| 357 | @ <tr> |
| 358 | if( db_column_int(&q,4) ){ |
| 359 | @ <td style="padding-right: 15px;text-align: right;"> |
| 360 | @ <a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td> |
| 361 | }else{ |
| 362 | @ <td style="padding-right: 15px;text-align: right;">%d(rcvid)</td> |
| 363 | } |
| 364 | @ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td> |
| 365 | @ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td> |
| 366 | @ <td style="text-align: left;">%s(zIpAddr)</td> |
| 367 | @ </tr> |
| 368 | } |
| @@ -365,11 +383,11 @@ | |
| 383 | |
| 384 | login_check_credentials(); |
| 385 | if( !g.perm.Admin ){ |
| 386 | login_needed(); |
| 387 | } |
| 388 | style_header("Artifact Receipt %d", rcvid); |
| 389 | if( db_exists( |
| 390 | "SELECT 1 FROM blob WHERE rcvid=%d AND" |
| 391 | " NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid) |
| 392 | ){ |
| 393 | style_submenu_element("Shun All", "Shun All", |
| 394 |