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 sensitive field handling; add Basic settings tab validations #703

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp commented Jul 30, 2019

Changes

  • Fix password field types (client secret and API token) triggering password managers
  • Add empty required field error styles
  • Add validation/sanitization for domain, custom domain, client secret, and token algorithm fields

Note to reviewers: bulk of the additions here are missing tests

References

Internal support request.

Testing

Please describe how this can be tested by reviewers. Tests must be added for new functionality and existing tests should complete without errors.

  • This change adds unit test coverage
  • This change has been tested on WP 5.2.2

Checklist

  • All existing and new tests complete without errors
  • All code quality tools/guidelines in the Contribution guide have been run/followed
  • All active GitHub CI checks have passed

@joshcanhelp joshcanhelp added this to the 3.11.1 milestone Jul 30, 2019
@@ -7,7 +7,7 @@
"php": "^5.3 || ^7.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Development dependency

$input['client_id'] = sanitize_text_field( $input['client_id'] );
$input['cache_expiration'] = absint( $input['cache_expiration'] );

$input['allow_signup'] = ( isset( $input['allow_signup'] ) ? $input['allow_signup'] : 0 );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting no longer exists

$input['client_id'] = sanitize_text_field( $input['client_id'] );
$input['cache_expiration'] = absint( $input['cache_expiration'] );

$input['allow_signup'] = ( isset( $input['allow_signup'] ) ? $input['allow_signup'] : 0 );
$input['client_secret'] = sanitize_text_field( $input['client_secret'] );
if ( __( '[REDACTED]', 'wp-auth0' ) === $input['client_secret'] ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If client secret is unchanged (set as [REDACTED] when saved), keep the previous one.

$input['client_secret_b64_encoded'] = ( isset( $input['client_secret_b64_encoded'] )
? $input['client_secret_b64_encoded'] == 1
: false );
if ( ! in_array( $input['client_signing_algorithm'], array( 'HS256', 'RS256' ) ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a radio button input with 2 choices.

@joshcanhelp joshcanhelp requested a review from a team July 30, 2019 21:27
@joshcanhelp joshcanhelp merged commit a422c36 into wordpress-org-plugin Jul 31, 2019
@joshcanhelp joshcanhelp deleted the fix-password-field-type branch July 31, 2019 01:08
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants