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

[security] introduce sensitive value object. #79

Merged
merged 8 commits into from Nov 14, 2013

Conversation

makasim
Copy link
Member

@makasim makasim commented Nov 12, 2013

it fixes #78

The workflow:

<?php

$model['cardNumber'] = new SensitiveValue('1111222233334444');

serialize($model['cardNumber']);
//NULL

clone $model['cardNumber'];
// exception

$model['cardNumber']->erase();
// remove value forever.

$model['cardNumber']->get();
// get sensitive value and erase it

$model['cardNumber']->peek();
// get sensitive value but not erase it. use carefully

(string) $model['cardNumber'];
// empty string

// later in action:

$model = ArrayObject::ensureArrayObject($model);
$api->purchase($model->toUnsafeArray());

//the array contains unsafe credit card number. This primitive array never stored anywhere, just passed as is to gateway.

TODO:

  • add test for __clone
  • add test for ArrayObject::toUnsafeArray()
  • update all currently supported payment to use this object.
  • update docs
  • update payum rest
  • update zend module
  • update yii extension

@makasim
Copy link
Member Author

makasim commented Nov 13, 2013

@mtudor just added some more tests. Here you could look at real life examples:

working on example for symfony bundle and sandbox

@@ -143,6 +145,8 @@ specific hashes from the tokens. After all is prepared, finally we start the cap
The main purpose of using tokens is to hide any sensitive\guessable information from a spying user.
All a spying user sees is the random hash so it would be a bit hard to hack your payment process.

_**Attention**: All sensitive values must not be passed directly but wrapped by `SensitiveValue` class. That's required to ensure it would not saved anywhere accidentally. For more info read [dedicated chapter](working-with-sensitive-information.md)._
Copy link
Contributor

Choose a reason for hiding this comment

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

it would not save not saved

Copy link
Contributor

Choose a reason for hiding this comment

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

or it would not be saved

makasim added a commit that referenced this pull request Nov 14, 2013
…object

[WIP][security] introduce sensitive value object.
@makasim makasim merged commit e2b50de into master Nov 14, 2013
@makasim makasim deleted the security-introduce-sensitive-value-object branch November 14, 2013 16:21
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.

Payum and PCI DSS Compliance
3 participants