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

Encryption #2135

Merged
merged 8 commits into from
Aug 20, 2019
Merged

Encryption #2135

merged 8 commits into from
Aug 20, 2019

Conversation

jim-parry
Copy link
Contributor

Barebones encryption module - OpenSSL only.
This should satisy those that want "something" built in, while not offending those who don't want "anything" built-in.
libsodium support can be added once it gets bundled with our minimum version, and indeed the module is architected to make it easy to add any other encryption handlers.

@jim-parry jim-parry requested a review from lonnieezell August 13, 2019 02:03
@MGatner
Copy link
Member

MGatner commented Aug 13, 2019

You're crushing it tonight @jim-parry, keep it up :)

Copy link
Member

@lonnieezell lonnieezell left a comment

Choose a reason for hiding this comment

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

Left a few comments. Sorry :)

system/Config/Services.php Show resolved Hide resolved
system/Config/Services.php Outdated Show resolved Hide resolved
*/
public function __construct($params = null)
{
$this->config = array_merge($this->default, (array) new \Config\Encryption());
Copy link
Member

Choose a reason for hiding this comment

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

The config instance should be passed in. Makes it easier to test and customize, instead of forcing the dependency creation inside the constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reworked

$params = ['driver' => $params];
}

$params = $this->properParams($params);
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused why we're keeping an instance of $params here since they are set to $this->config in properParams()?

Seems cleaner to do $this->config = $this->properparams($params); here and not have properParams set it to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reworked

}

// determine what is installed
$this->handlers = [
Copy link
Member

Choose a reason for hiding this comment

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

This way of checking doesn't support users creating their own handlers, does it? Is that something we should allow for this? Part of me says yes, because if they're on 7.3+ and the framework is still 7.2, they could write one to take advantage of new features.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it wasn't the intent that users create their own drivers for use here, but that we might provide several alternatives

system/Encryption/Handlers/OpenSSLHandler.php Outdated Show resolved Hide resolved
system/Encryption/Handlers/OpenSSLHandler.php Outdated Show resolved Hide resolved
system/Encryption/Handlers/OpenSSLHandler.php Outdated Show resolved Hide resolved
system/Encryption/Handlers/OpenSSLHandler.php Outdated Show resolved Hide resolved
* @param string $str
* @return integer
*/
protected static function strlen($str)
Copy link
Member

Choose a reason for hiding this comment

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

Why do these methods exist in the different classes? I don't see them being used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they are used in the extending handlers, eg OpenSSLHandler

@jim-parry
Copy link
Contributor Author

@lonnieezell No apologies needed - appreciate the feedback.
Changes made, though my local build is having issues with a bunch of non-encryption stuff :-/

@jim-parry jim-parry changed the title Encryption DNR Encryption Aug 16, 2019
@jim-parry
Copy link
Contributor Author

I don't know what has gone wrong with the travis build, but definitely something serious :(
I will recreate this branch/PR and see if that helps.

@jim-parry jim-parry changed the title DNR Encryption Encryption Aug 16, 2019
@jim-parry
Copy link
Contributor Author

Found & fixed the root problem with my travis build - messing with Services:logger.
Addressing unit testing & code coverage before updting this PR.

@jim-parry
Copy link
Contributor Author

@lonnieezell Looking better - simplified, tested & hopefully addressing the concerns you raised :)

@lonnieezell
Copy link
Member

@jim-parry Looks good to me. Merge at your discretion.

@lonnieezell lonnieezell merged commit 3f84126 into codeigniter4:develop Aug 20, 2019
@jim-parry jim-parry deleted the encryption branch August 28, 2019 23:46
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

Successfully merging this pull request may close these issues.

3 participants