Skip to content
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

fix: Broken Access Control Vulnerability Issue #36

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Insights.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* and admin email.
*/
class Insights
{

Check failure on line 13 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening brace should be on the same line as the declaration for class Insights

/**
* The notice text
Expand Down Expand Up @@ -51,9 +51,9 @@
* @param null $name
* @param null $file
*/
public function __construct($client, $name = null, $file = null)

Check failure on line 54 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

No space after opening parenthesis is prohibited

Check failure on line 54 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected exactly one space between closing parenthesis and opening control structure; " " found.

Check failure on line 54 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 54 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

No space before closing parenthesis is prohibited
{

Check failure on line 55 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening brace should be on the same line as the declaration
if (is_string($client) && !empty($name) && !empty($file)) {

Check failure on line 56 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

No space after opening parenthesis is prohibited

Check failure on line 56 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 56 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces before closing parenthesis; 0 found

Check failure on line 56 in src/Insights.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 space after "!"; 0 found
$client = new Client($client, $name, $file);
}

Expand Down Expand Up @@ -496,6 +496,10 @@
return;
}

if (!current_user_can('manage_options')) {
return;
}

if (isset($_GET[$this->client->slug . '_tracker_optin']) && $_GET[$this->client->slug . '_tracker_optin'] === 'true') {
$this->optin();

Expand Down