| @@ -31,15 +31,8 @@ | ||
| 31 | 31 | // is total_max_points(), which sums the declared "max" of every category |
| 32 | 32 | // in get_categories(). Bump this only when manually verifying the sum. |
| 33 | 33 | const TOTAL_MAX_POINTS = 106; |
| 34 | 34 | const REGRESSION_THRESHOLD = 10; // Points dropped before sending the alert email. |
| 35 | - /* | |
| 36 | - * Highest score a site can show while the self-protection check reports | |
| 37 | - * tampering: every other result of this report was computed by the same | |
| 38 | - * code whose files were reported as changed, so a high number next to it | |
| 39 | - * would be a lie. 29 is the top of grade E in compute_grade(). | |
| 40 | - */ | |
| 41 | - const SCORE_CAP_ON_TAMPER = 29; | |
| 42 | 35 | |
| 43 | 36 | /** |
| 44 | 37 | * Sum of the declared "max" of every category. This is the canonical |
| 45 | 38 | * maximum a scan can earn. Using this instead of the constant prevents |
| @@ -103,11 +96,9 @@ | ||
| 103 | 96 | 'label' => __( 'Internal Checks (exclusive)', 'vigilante' ), |
| 104 | 97 | // Sum of the max values of every check in |
| 105 | 98 | // Vigilante_SA_Category_Internal. Update when adding/removing |
| 106 | 99 | // checks or changing their max value. |
| 107 | - // 3.0.0: 30 -> 40 (self_integrity check added, worth 10: the | |
| 108 | - // integrity of the plugin that runs every other check). | |
| 109 | - 'max' => 40, | |
| 100 | + 'max' => 30, | |
| 110 | 101 | ), |
| 111 | 102 | 'reputation' => array( |
| 112 | 103 | 'slug' => 'reputation', |
| 113 | 104 | 'label' => __( 'Reputation / Blacklists', 'vigilante' ), |
| @@ -270,24 +261,8 @@ | ||
| 270 | 261 | // Normalize against the declared category max so skipped checks don't erode the score. |
| 271 | 262 | $declared_max = self::total_max_points(); |
| 272 | 263 | $grade = Vigilante_SA_Helpers::compute_grade( $total_earned, $declared_max ); |
| 273 | 264 | |
| 274 | - // Self-protection caps the score (see SCORE_CAP_ON_TAMPER). The same | |
| 275 | - // cap is applied when phases are merged, in rebuild_from_categories(). | |
| 276 | - $capped_by = ''; | |
| 277 | - foreach ( $results as $r ) { | |
| 278 | - if ( $r instanceof Vigilante_SA_Check_Result | |
| 279 | - && 'self_integrity' === $r->id | |
| 280 | - && Vigilante_SA_Check_Result::STATE_FAIL === $r->state ) { | |
| 281 | - $capped_by = 'self_integrity'; | |
| 282 | - break; | |
| 283 | - } | |
| 284 | - } | |
| 285 | - if ( 'self_integrity' === $capped_by && $grade['score'] > self::SCORE_CAP_ON_TAMPER ) { | |
| 286 | - $grade['score'] = self::SCORE_CAP_ON_TAMPER; | |
| 287 | - $grade['grade'] = 'E'; | |
| 288 | - } | |
| 289 | - | |
| 290 | 265 | return array( |
| 291 | 266 | 'ran_at' => $started, |
| 292 | 267 | 'phase' => $phase, |
| 293 | 268 | 'total_earned' => $total_earned, |
| @@ -294,9 +269,8 @@ | ||
| 294 | 269 | 'total_max' => $declared_max, |
| 295 | 270 | 'total_evaluated'=> $total_max, // Actual evaluated max (excluding skipped). |
| 296 | 271 | 'score' => $grade['score'], |
| 297 | 272 | 'grade' => $grade['grade'], |
| 298 | - 'capped_by' => $capped_by, | |
| 299 | 273 | 'counts' => $counts, |
| 300 | 274 | 'categories' => $categories, |
| 301 | 275 | ); |
| 302 | 276 | } |
| @@ -418,24 +392,8 @@ | ||
| 418 | 392 | |
| 419 | 393 | $total_max = self::total_max_points(); |
| 420 | 394 | $grade = Vigilante_SA_Helpers::compute_grade( $total_earned, $total_max ); |
| 421 | 395 | |
| 422 | - // Self-protection caps the score (see SCORE_CAP_ON_TAMPER). | |
| 423 | - $capped_by = ''; | |
| 424 | - foreach ( $categories as $cat ) { | |
| 425 | - foreach ( (array) $cat['checks'] as $c ) { | |
| 426 | - if ( 'self_integrity' === ( isset( $c['id'] ) ? $c['id'] : '' ) | |
| 427 | - && Vigilante_SA_Check_Result::STATE_FAIL === ( isset( $c['state'] ) ? $c['state'] : '' ) ) { | |
| 428 | - $capped_by = 'self_integrity'; | |
| 429 | - break 2; | |
| 430 | - } | |
| 431 | - } | |
| 432 | - } | |
| 433 | - if ( 'self_integrity' === $capped_by && $grade['score'] > self::SCORE_CAP_ON_TAMPER ) { | |
| 434 | - $grade['score'] = self::SCORE_CAP_ON_TAMPER; | |
| 435 | - $grade['grade'] = 'E'; | |
| 436 | - } | |
| 437 | - | |
| 438 | 396 | return array( |
| 439 | 397 | 'categories' => $categories, |
| 440 | 398 | 'total_earned' => $total_earned, |
| 441 | 399 | 'total_max' => $total_max, |
| @@ -441,9 +399,8 @@ | ||
| 441 | 399 | 'total_max' => $total_max, |
| 442 | 400 | 'total_evaluated'=> $total_evaluated, |
| 443 | 401 | 'score' => $grade['score'], |
| 444 | 402 | 'grade' => $grade['grade'], |
| 445 | - 'capped_by' => $capped_by, | |
| 446 | 403 | 'counts' => $counts, |
| 447 | 404 | ); |
| 448 | 405 | } |
| 449 | 406 | |