-
-
Notifications
You must be signed in to change notification settings - Fork 28
[#2198] Added support for ACME challenge in Shield. #2254
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
Conversation
WalkthroughThis pull request adds support for Let's Encrypt ACME HTTP-01 challenge path passthrough in Drupal Shield, controlled via the DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE environment variable, with corresponding comprehensive test coverage for various ACME configuration scenarios. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/phpunit/Drupal/SwitchableSettingsTest.php`:
- Around line 546-563: Add a PROD environment test case to the ACME passthrough
data set in SwitchableSettingsTest similar to the DEV/LOCAL entries: add an
array entry using self::ENVIRONMENT_PROD with DRUPAL_SHIELD_USER,
DRUPAL_SHIELD_PASS and DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE=1 as the environment
input, and assert the expected 'shield.settings' output contains credentials
(['shield' => ['user' => 'drupal_shield_user','pass' => 'drupal_shield_pass']])
plus 'method' => 0 and 'paths' => '/.well-known/acme-challenge/*' but omit
'shield_enable' (since in PROD it is UI-managed); place this new case alongside
the existing ACME challenge entries so it gets exercised by the same data
provider used by the test methods.
|
|
||
| // ACME challenge passthrough tests. | ||
| [ | ||
| self::ENVIRONMENT_DEV, | ||
| [ | ||
| 'DRUPAL_SHIELD_USER' => 'drupal_shield_user', | ||
| 'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass', | ||
| 'DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE' => 1, | ||
| ], | ||
| [ | ||
| 'shield.settings' => [ | ||
| 'shield_enable' => TRUE, | ||
| 'credentials' => ['shield' => ['user' => 'drupal_shield_user', 'pass' => 'drupal_shield_pass']], | ||
| 'method' => 0, | ||
| 'paths' => '/.well-known/acme-challenge/*', | ||
| ], | ||
| ], | ||
| ], |
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.
🧹 Nitpick | 🔵 Trivial
Consider adding a PROD environment test case for ACME passthrough.
The current tests cover DEV and LOCAL environments. Adding a PROD test case would verify ACME passthrough works correctly in production where shield_enable is typically managed through the UI rather than environment variables.
💡 Suggested test case for PROD environment
[
self::ENVIRONMENT_PROD,
[
'DRUPAL_SHIELD_USER' => 'drupal_shield_user',
'DRUPAL_SHIELD_PASS' => 'drupal_shield_pass',
'DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE' => 1,
],
[
'shield.settings' => [
'credentials' => ['shield' => ['user' => 'drupal_shield_user', 'pass' => 'drupal_shield_pass']],
'method' => 0,
'paths' => '/.well-known/acme-challenge/*',
],
],
],🤖 Prompt for AI Agents
In `@tests/phpunit/Drupal/SwitchableSettingsTest.php` around lines 546 - 563, Add
a PROD environment test case to the ACME passthrough data set in
SwitchableSettingsTest similar to the DEV/LOCAL entries: add an array entry
using self::ENVIRONMENT_PROD with DRUPAL_SHIELD_USER, DRUPAL_SHIELD_PASS and
DRUPAL_SHIELD_ALLOW_ACME_CHALLENGE=1 as the environment input, and assert the
expected 'shield.settings' output contains credentials (['shield' => ['user' =>
'drupal_shield_user','pass' => 'drupal_shield_pass']]) plus 'method' => 0 and
'paths' => '/.well-known/acme-challenge/*' but omit 'shield_enable' (since in
PROD it is UI-managed); place this new case alongside the existing ACME
challenge entries so it gets exercised by the same data provider used by the
test methods.
|
|
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2254 +/- ##
==========================================
- Coverage 76.85% 76.22% -0.63%
==========================================
Files 112 105 -7
Lines 5846 5687 -159
Branches 44 0 -44
==========================================
- Hits 4493 4335 -158
+ Misses 1353 1352 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closes #2198
Summary by CodeRabbit
Release Notes
New Features
Tests