8000 Feature/account security by ideadude · Pull Request #2677 · gocodebox/lifterlms · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Feature/account security #2677

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

Draft
wants to merge 15 commits into
base: dev
Choose a base branch
from
Draft

Feature/account security #2677

wants to merge 15 commits into from

Conversation

ideadude
Copy link
Member

Description

We are going to add some spam/security features:
[x] IP Block at checkout if there are more than 10 failures within 15 minutes.
[ ] Built in support for captcha's like recaptcha and turnstile.
[ ] Built in integration with Akismet to check emails at checkout/registration.

How has this been tested?

Screenshots

Types of changes

Checklist:

  • This PR requires and contains at least one changelog file.
  • My code has been tested.
  • My code passes all existing automated tests.
  • My code follows the LifterLMS Coding & Documentation Standards.

Sorry, something went wrong.

@ideadude ideadude changed the base branch from trunk to dev June 14, 2024 15:13
@ideadude ideadude added this to the 7.8 milestone Jul 11, 2024
@brianhogg brianhogg modified the milestones: 7.8, Next Available Release Nov 4, 2024
@ideadude ideadude modified the milestones: Next Available Release, 8.1 Mar 31, 2025

// Remove old items.
$new_activity = [];
$now = current_time( 'timestamp', true ); // UTC
Copy link
Contributor

Choose a reason for hiding this comment

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

current_time( 'timestamp' ) isn't recommended since WP 5.3 https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/

$now = current_time( 'timestamp', true ); // UTC
foreach( $activity as $item ) {
// Determine whether this item is recent enough to include.
if ( $item > $now-( LLMS_SPAM_ACTION_TIME_LIMIT ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrap in absint() in case the constant is defined incorrectly

Comment on lines +105 to +108
if ( count( $activity ) > LLMS_SPAM_ACTION_NUM_LIMIT ) {
rsort( $activity );
$activity = array_slice( $activity, 0, LLMS_SPAM_ACTION_NUM_LIMIT );
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add absint() around the constants


$ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $ip );
$transient_key = 'llms_spam_activity_' . $ip;
$activity = get_transient( $transient_key );
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it's an issue using transients when they can be deleted at any time? It does allow us to use the WP system of tracking the temporary data without making our own table etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants
0