Skip to content

Update Zendesk API Token and Provision Token #155

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

Merged
merged 4 commits into from
Jun 25, 2020

Conversation

yoshdog
Copy link
Contributor

@yoshdog yoshdog commented Jun 16, 2020

No description provided.

@@ -185,7 +185,7 @@ public function getProvisionToken($generate = false)
public function setProvisionToken($token = null)
{
if(!$token) {
$token = md5(time());
$token = hash('sha256', rand());
Copy link

@driskell driskell Jun 16, 2020

Choose a reason for hiding this comment

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

https://www.php.net/manual/en/function.random-bytes.php
Hi. It's usually good to use cryptographically secure APIs for this form of generation.

It's worth knowing this is already covered by Magento API within Core Helper:

Mage::helper('core')->getRandomString($len, $chars);

There's also Mage_OAuth helper which contains generators with even higher entropy (above is generally intended for highly random passwords but likely sufficient for this purpose). Mage::helper('oauth')->generateToken().
https://github.com/laurentlepee/magento-ce-1.9.2.4/blob/master/app/code/core/Mage/Oauth/Helper/Data.php

Copy link
Contributor Author

Choose a reason for hiding this comment

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

awesome thanks for the tips Jason

Copy link
Contributor

Choose a reason for hiding this comment

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

@yoshdog yoshdog marked this pull request as ready for review June 23, 2020 13:28
@thekindofme thekindofme merged commit 00db613 into master Jun 25, 2020
@thekindofme thekindofme deleted the PEGASUS-933-update-magento-api-token-discovery branch June 25, 2020 01:05
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