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

Check whether passthru() is disabled #114

Closed
davidjeddy opened this issue Apr 7, 2016 · 4 comments
Closed

Check whether passthru() is disabled #114

davidjeddy opened this issue Apr 7, 2016 · 4 comments

Comments

@davidjeddy
Copy link

Recommend throwing exception if passthru is not available.
screen shot 2016-04-07 at 18 02 32

@ramsey ramsey added the bug label Apr 9, 2016
@ramsey
Copy link
Owner

ramsey commented Apr 9, 2016

Thanks for the bug report. There is currently a work-around for this that you can implement in the meantime, while I'm working on a solution for this in the library.

  • Create a new FeatureSet class that extends FeatureSet and overrides the buildNodeProvider() method to return a RandomNodeProvider. The RandomNodeProvider generates a random string to act as the "node," since you're unable to make the system call to get its node.
class MyFeatureSet extends \Ramsey\Uuid\FeatureSet
{
    protected function buildNodeProvider()
    {
        return new \Ramsey\Uuid\Provider\Node\RandomNodeProvider();
    }
}
  • Instantiate a UuidFactory with your feature set and set that factory as the one to use when generating UUIDs:
$uuidFactory = new \Ramsey\Uuid\UuidFactory(new MyFeatureSet());
\Ramsey\Uuid\Uuid::setFactory($uuidFactory);
  • Now, when you generate version 1 UUIDs, it will use the RandomNodeProvider as a substitution for the node:
$uuid = \Ramsey\Uuid\Uuid::uuid1();

This work-around will work well. In the meantime, I'll think through approaches for how to handle this internally in the library.

Thanks!

@davidjeddy
Copy link
Author

Looks good! Thank you for the response.

@ramsey
Copy link
Owner

ramsey commented Apr 11, 2016

No problem!

I'm reopening the issue to track this issue as an enhancement to provide better checking of whether passthru() is enabled.

@ramsey ramsey reopened this Apr 11, 2016
@ramsey ramsey added enhancement and removed bug labels Apr 11, 2016
@ramsey ramsey changed the title BUG: Passthru disabled for security reasons... Check whether passthru() is disabled Apr 11, 2016
@ramsey ramsey closed this as completed in 8d62148 Jul 19, 2018
@ramsey
Copy link
Owner

ramsey commented Jul 19, 2018

I have a solution for this that will be available in the next 3.x release. Thanks!

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

No branches or pull requests

2 participants