-
Notifications
You must be signed in to change notification settings - Fork 39
refactor: safe PHP 7.4 modernization #212
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
Open
somethingwithproof
wants to merge
7
commits into
Cacti:develop
Choose a base branch
from
somethingwithproof:refactor/modernization
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fb9fa5b
refactor: add strict typing and clean up standalone infra
somethingwithproof 5141012
refactor: safe PHP 7.4 modernization (arrays, null coalescing)
somethingwithproof bfb48fa
fix: restore corrupted function calls from refactor tool
somethingwithproof 23d9cdc
fix: restore corrupted syntax from refactor tool
somethingwithproof bfd5a42
fix: remove duplicate declare(strict_types) statements
somethingwithproof c95ea06
fix(security): escape request reuse in monitor views
somethingwithproof 576c9a1
fix:Run php-cs-fixit to resolve workflows
TheWitness File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,3 +21,4 @@ | |
|
|
||
| locales/po/*.mo | ||
| vendor/ | ||
| .omc/ | ||
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?php | ||
| /* | ||
| +-------------------------------------------------------------------------+ | ||
| | Copyright (C) 2004-2026 The Cacti Group | | ||
| +-------------------------------------------------------------------------+ | ||
| | Cacti: The Complete RRDTool-based Graphing Solution | | ||
| +-------------------------------------------------------------------------+ | ||
| */ | ||
|
|
||
| $checks = array( | ||
| __DIR__ . '/../../monitor_controller.php' => array( | ||
| "html_escape(get_request_var('downhosts'))", | ||
| "html_escape(get_request_var('mute'))", | ||
| "html_escape(get_request_var('tree'))", | ||
| "html_escape(get_request_var('site'))", | ||
| "html_escape(get_request_var('template'))", | ||
| "html_escape(get_request_var('size'))", | ||
| "html_escape(get_request_var('trim'))", | ||
| ), | ||
| __DIR__ . '/../../monitor_render.php' => array( | ||
| "rawurlencode(get_request_var('rfilter'))", | ||
| ), | ||
| ); | ||
|
|
||
| foreach ($checks as $path => $patterns) { | ||
| $contents = file_get_contents($path); | ||
|
|
||
| if ($contents === false) { | ||
| fwrite(STDERR, "Unable to read {$path}\n"); | ||
| exit(1); | ||
| } | ||
|
|
||
| foreach ($patterns as $pattern) { | ||
| if (strpos($contents, $pattern) === false) { | ||
| fwrite(STDERR, "Missing expected output hardening: {$pattern}\n"); | ||
| exit(1); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| print "OK\n"; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?php | ||
| /* | ||
| +-------------------------------------------------------------------------+ | ||
| | Copyright (C) 2004-2026 The Cacti Group | | ||
| +-------------------------------------------------------------------------+ | ||
| | Cacti: The Complete RRDTool-based Graphing Solution | | ||
| +-------------------------------------------------------------------------+ | ||
| */ | ||
|
|
||
| $checks = array( | ||
| __DIR__ . '/../../monitor_controller.php' => array( | ||
| "get_request_var('downhosts') . '\"><input id=\"mute\" type=\"hidden\" value=\"' . get_request_var('mute')", | ||
| "get_request_var('tree') . '\"></td>'", | ||
| "get_request_var('site') . '\"></td>'", | ||
| "get_request_var('template') . '\"></td>'", | ||
| "get_request_var('size') . '\"></td>'", | ||
| "get_request_var('trim') . '\"></td>'", | ||
| ), | ||
| __DIR__ . '/../../monitor_render.php' => array( | ||
| "monitor.php?rfilter=' . get_request_var('rfilter')", | ||
| ), | ||
| ); | ||
|
|
||
| foreach ($checks as $path => $patterns) { | ||
| $contents = file_get_contents($path); | ||
|
|
||
| if ($contents === false) { | ||
| fwrite(STDERR, "Unable to read {$path}\n"); | ||
| exit(1); | ||
| } | ||
|
|
||
| foreach ($patterns as $pattern) { | ||
| if (strpos($contents, $pattern) !== false) { | ||
| fwrite(STDERR, "Raw request reuse remains: {$pattern}\n"); | ||
| exit(1); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| print "OK\n"; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?php | ||
| /* | ||
| +-------------------------------------------------------------------------+ | ||
| | Copyright (C) 2004-2026 The Cacti Group | | ||
| +-------------------------------------------------------------------------+ | ||
| | Cacti: The Complete RRDTool-based Graphing Solution | | ||
| +-------------------------------------------------------------------------+ | ||
| */ | ||
|
|
||
| $payload = "\" autofocus onfocus=\"alert(1)"; | ||
| $escaped = htmlspecialchars($payload, ENT_QUOTES, 'UTF-8'); | ||
|
|
||
| if (strpos($escaped, '"') === false && strpos($escaped, '"') !== false) { | ||
| print "OK\n"; | ||
| exit(0); | ||
| } | ||
|
|
||
| fwrite(STDERR, "Expected request values to be escaped for hidden inputs\n"); | ||
| exit(1); |
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.