-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Security: remove uses of payment intent secret and existing meta (#6836)
- Loading branch information
1 parent
e7484d6
commit edcc5ee
Showing
5 changed files
with
76 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/PaymentGateways/Gateways/Stripe/Migrations/RemovePaymentIntentSecretMeta.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Give\PaymentGateways\Gateways\Stripe\Migrations; | ||
|
||
use Give\Framework\Database\DB; | ||
use Give\Framework\Migrations\Contracts\Migration; | ||
|
||
/** | ||
* Removes the secret meta that was unnecessarily stored in the database for donations. | ||
* | ||
* @unreleased | ||
*/ | ||
class RemovePaymentIntentSecretMeta extends Migration | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function id(): string | ||
{ | ||
return 'remove_payment_intent_secret_meta'; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function title(): string | ||
{ | ||
return __('Remove payment intent secret meta', 'give'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function timestamp() | ||
{ | ||
return strtotime('2023-06-29 00:00:00'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function run() | ||
{ | ||
DB::delete( | ||
DB::prefix('give_donationmeta'), | ||
['meta_key' => '_give_stripe_payment_intent_client_secret'], | ||
['%s'] | ||
); | ||
|
||
$commentsTable = DB::prefix('give_comments'); | ||
DB::query( | ||
DB::prepare( | ||
"DELETE FROM {$commentsTable} WHERE comment_type = 'donation' AND comment_content LIKE %s", | ||
'Stripe Payment Intent Client Secret:%' | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters