Skip to content

Commit

Permalink
WAF: Include waf_supported and automatic_rules_last_updated in the je…
Browse files Browse the repository at this point in the history
…tpack/v4/waf REST API endpoint response (#39511)
  • Loading branch information
nateweller authored Oct 7, 2024
1 parent 8443130 commit 318aa2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions projects/packages/waf/changelog/add-waf-api-new-properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

WAF: Add new properties to the WAF feature's REST API endpoint.
10 changes: 9 additions & 1 deletion projects/packages/waf/src/class-rest-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ public static function update_rules() {
* @return WP_REST_Response
*/
public static function waf() {
return rest_ensure_response( Waf_Runner::get_config() );
return rest_ensure_response(
array_merge(
Waf_Runner::get_config(),
array(
'waf_supported' => Waf_Runner::is_supported_environment(),
'automatic_rules_last_updated' => Waf_Stats::get_automatic_rules_last_updated(),
)
)
);
}

/**
Expand Down

0 comments on commit 318aa2c

Please sign in to comment.