Attempt at cleaning up the code a bit and hardening where it makes sense#21
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR focuses on incremental hardening and cleanup across the OIT Drupal module, primarily around safer string handling/escaping, redirect behavior, and network call robustness.
Changes:
- Hardened several HTML/URL construction points (escaping, exact-match whitelist handling, safer token output).
- Added cURL timeouts for external webhook/API calls to reduce hung requests.
- Tightened user cleanup logic to avoid deleting privileged accounts (with an additional safeguard still needed).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/Plugin/Util/UserClean.php |
Expands deletion guardrails for user cleanup (needs UID 1 protection). |
src/Plugin/Util/LatestAutoBan.php |
Adds cURL connect/overall timeouts for AbuseIPDB calls. |
src/Plugin/TopPages.php |
Hardens whitelist updates and escapes generated link HTML; improves <title> parsing safety. |
src/Plugin/TeamsAlert.php |
Fixes cURL timeout configuration (adds overall timeout). |
src/Plugin/RedirectAddAnalytics.php |
Improves UTM parameter appending (needs fragment-safe handling). |
src/Plugin/Block/TutorialBlock.php |
Adds documentation about Twig ` |
src/Plugin/Block/ServiceAlertTweet.php |
Adds documentation about a role machine name (file reference is incorrect). |
src/Plugin/Block/PageOverview.php |
Adds documentation about Twig ` |
src/Plugin/Block/FrontServiceHealth.php |
Escapes interpolated service name/id in generated links. |
src/Plugin/Block/FrontActionLinks.php |
Updates ShortcodeIcon import/type references. |
src/Form/AbuseConfirmForm.php |
Prevents duplicate IP whitelist entries via exact-match normalization. |
src/Controller/OitController.php |
Improves redirect handling (return response) and attempts to harden destination building (needs URL-encoding). |
oit.module |
Hardens login redirect destination handling (still needs URL-encoding) and adds early returns after send() in some hooks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This can be accomplished with /user/edit today, I don't think that was an option when I created this. From what I can tell nothing uses this path so should be safe to remove.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.