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

The function rest_is_ip_address should be not issue for sanitize #2483

Open
davidperezgar opened this issue Sep 6, 2024 · 1 comment
Open

Comments

@davidperezgar
Copy link
Member

A user is reporting in Plugin Check Plugin using WPCS Sanitize check, a possible false positive with the function rest_is_ip_address.

The code shared was this:

// Generate a unique session id
function wppa_get_session_id() {
global $wppa_version;
static $session_id;

	// Found already?
	if ( $session_id ) {
		return $session_id;
	}

	// Look for a cookie
	if ( isset( $_COOKIE['wppa_session_id'] ) ) {
(30)		$t = rest_is_ip_address( wp_unslash( $_COOKIE['wppa_session_id'] ) );
		if ( $t ) {
			$session_id = $t;
			return $session_id;
		}
	}

You can see it in this support post

I believe that this function does not need to have sanitized data as is checking if it's a correct IP.

@GaryJones
Copy link
Member

Please see the bug report template to include the necessary details so that the report can be processed - what version of PHPCS, WPCS, the violation code, the minimal snippet, current behaviour, expected behaviour, etc.

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

No branches or pull requests

2 participants