Skip to content

Attempt at cleaning up the code a bit and hardening where it makes sense#21

Merged
protitude merged 9 commits into
1.2.xfrom
code-hardening
Jun 10, 2026
Merged

Attempt at cleaning up the code a bit and hardening where it makes sense#21
protitude merged 9 commits into
1.2.xfrom
code-hardening

Conversation

@protitude

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/Plugin/Util/UserClean.php
Comment thread src/Plugin/TopPages.php
Comment thread src/Plugin/RedirectAddAnalytics.php
Comment thread src/Controller/OitController.php
Comment thread oit.module Outdated
Comment thread src/Plugin/Block/TutorialBlock.php
Comment thread src/Plugin/Block/PageOverview.php
Comment thread src/Plugin/Block/ServiceAlertTweet.php
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.
@protitude protitude merged commit 191d058 into 1.2.x Jun 10, 2026
1 check passed
@protitude protitude deleted the code-hardening branch June 10, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants