Skip to content

refactor: safe PHP 7.4 modernization - #69

Draft
somethingwithproof wants to merge 8 commits into
Cacti:developfrom
somethingwithproof:refactor/modernization
Draft

refactor: safe PHP 7.4 modernization#69
somethingwithproof wants to merge 8 commits into
Cacti:developfrom
somethingwithproof:refactor/modernization

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

This PR adds strict typing, short array syntax, and null coalescing operators across the plugin. Standalone infrastructure files were removed per architectural mandate.

Copilot AI review requested due to automatic review settings April 9, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown

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 modernizes the WebSeer plugin’s PHP code style (strict typing + short arrays) and adds initial security hardening scaffolding (audit docs, URL validator, tests, and CI config).

Changes:

  • Add declare(strict_types=1); across plugin entrypoints and supporting files, and refactor many array() usages to [] (including prepared-statement parameter arrays).
  • Introduce security documentation and a new UrlValidator seam plus a new security-focused test file.
  • Add CI/static-analysis config (GitHub Actions, PHPUnit config, PHPStan config, Infection config).

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
webseer.php Adds strict types; converts prepared-statement params and arrays to short syntax
webseer_servers.php Adds strict types; converts prepared-statement params and arrays to short syntax
webseer_proxies.php Adds strict types; converts arrays to short syntax
webseer_process.php Adds strict types; converts prepared-statement params/arrays to short syntax
setup.php Adds strict types; converts arrays/prepared-statement params to short syntax
poller_webseer.php Adds strict types; converts prepared-statement params/arrays to short syntax
remote.php Adds strict types; converts some arrays to short syntax; touches remote actions
includes/functions.php Adds strict types; converts arrays to short syntax; touches remote-sync helpers
includes/arrays.php Adds strict types; converts config/field definition arrays to short syntax
includes/constants.php Adds strict types
includes/index.php Adds strict types
index.php Adds strict types
classes/cURL.php Adds strict types; refactors some arrays and signature defaults
classes/mxlookup.php Adds strict types; converts arrays to short syntax in class internals
classes/index.php Adds strict types
images/index.php Adds strict types
locales/index.php Adds strict types
locales/po/index.php Adds strict types
locales/LC_MESSAGES/index.php Adds strict types
src/Security/UrlValidator.php Adds SSRF-oriented URL validation helper + shim function
tests/Security/SsrfTest.php Adds security regression/spec tests (Pest-style)
phpunit.xml Adds PHPUnit configuration
phpstan.neon Adds PHPStan configuration
infection.json Adds Infection mutation-testing configuration
.github/workflows/ci.yml Adds GitHub Actions workflow to run tests + PHPStan
SECURITY.md Adds vulnerability disclosure policy
SECURITY-AUDIT.md Adds detailed security audit findings and remediation notes
BACKLOG.md Adds security hardening backlog and acceptance criteria
.omc/state/subagent-tracking.json Adds tool state artifact (appears non-source)
.omc/state/checkpoints/checkpoint-2026-03-10T08-14-41-766Z.json Adds tool checkpoint artifact (appears non-source)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread classes/cURL.php Outdated
Comment thread classes/cURL.php Outdated
Comment thread includes/functions.php Outdated
Comment thread remote.php Outdated
Comment thread tests/Security/SsrfTest.php Outdated
Comment thread phpunit.xml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread phpstan.neon Outdated
Comment thread .omc/state/subagent-tracking.json Outdated
Comment thread .omc/state/checkpoints/checkpoint-2026-03-10T08-14-41-766Z.json Outdated
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
- Use inet_pton() to normalize IPv6 before checking loopback/link-local/ULA
- Catch expanded notation like 0:0:0:0:0:0:0:1 as loopback
- Detect IPv4-mapped IPv6 (::ffff:a.b.c.d) and check the inner v4 address
- Resolve both A and AAAA records via dns_get_record so IPv6-only hosts
  aren't blocked as 'unresolvable'
- Split IPv4/IPv6 internal checks into dedicated helpers

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof marked this pull request as draft April 11, 2026 00:10
@somethingwithproof

Copy link
Copy Markdown
Member Author

Converted to draft to serialize the stack in this repo. Blocked by #65; will un-draft after that merges to avoid cross-PR merge conflicts.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
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.

2 participants