-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protect: WAF Phase 2 #27726
Protect: WAF Phase 2 #27726
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
Protect plugin:
|
81b26f0
to
33999e6
Compare
…y of each other (#27724)
Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I didn't test all scenarios with the standalone plugin, but I trust you've done that already :)
I'm suggesting a few changes but will apply them right away and approve the PR.
} | ||
|
||
if ( ! $wp_filesystem->put_contents( $automatic_rules_file_path, $rules ) ) { | ||
throw new \Exception( 'Failed writing automatic rules file to: ' . $automatic_rules_file_path ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nateweller I keep getting the following Fatal error in my development environment since this was merged:
[01-Feb-2023 07:52:03 UTC] PHP Fatal error: Uncaught Exception: Failed writing automatic rules file to: /var/www/html/wp-content/jetpack-waf/rules/automatic-rules.php in /usr/local/src/jetpack-monorepo/projects/packages/waf/src/class-waf-rules-manager.php:242
Stack trace:
#0 /usr/local/src/jetpack-monorepo/projects/packages/waf/src/class-waf-rules-manager.php(78): Automattic\Jetpack\Waf\Waf_Rules_Manager::generate_automatic_rules()
#1 /var/www/html/wp-includes/class-wp-hook.php(308): Automattic\Jetpack\Waf\Waf_Rules_Manager::update_rules_cron()
#2 /var/www/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#3 /var/www/html/wp-includes/plugin.php(565): WP_Hook->do_action()
#4 /var/www/html/wp-cron.php(188): do_action_ref_array()
#5 {main}
thrown in /usr/local/src/jetpack-monorepo/projects/packages/waf/src/class-waf-rules-manager.php on line 242
Anything we can do about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You bet, I will address this and open up a PR 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeherve I may have identified the potential cause of this, can you fill me in on the details of your local environment when this fatal is occurring?
- Is the
waf
module currently enabled or disabled? - Does the
wp-content/jetpack-waf
directory exist? If so, what files are currently in that directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a PR to address this: #28760
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It's enabled.
- I have a
bootstrap.php
and arules
directory. Therules
directory has the following files:allow-ip.php
,automatic-rules.php
,block-ip.php
,rules.php
Project branch for adding the second iteration of the WAF integration in Jetpack Protect.
This PR affects three projects:
Changes proposed in this Pull Request:
Other information:
Jetpack product discussion
peb6dq-4G-p2
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Bonus Points:
?test=<script>
request is blocked. Validate the contents of the rule files inwp-content/jetpack-waf/rules/
.?test=<script>
request is not blocked. Validate the contents of the rule files inwp-content/jetpack-waf/rules/
.