Repository navigation
Async actions: signed closures - #13
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2, step E: closures as asynchronous handlers.
How
laravel/serializable-closureinrequire-dev(tests) andsuggest. Without it, a closure is rejected at registration and the message says what to install.SerializableClosure::setSecretKey(), which is global to the process and could clash with another plugin using the library. Descriptor:closure:{hmac-sha256}:{base64(serialize(SerializableClosure))}.hash_hmac('sha256', 'pollora/hook:async-closures', wp_salt('auth')), orAsync::useClosureKey()(the framework will pass its app key in phase 3).hash_equals()before anything is unserialized;pollora/async/failed, and nothing runs;SerializableClosureis refused.strlen(...),$object->method(...),Class::method(...)) travel by name like any handler: nothing serialized, and the current code version runs.Found by the real-WordPress tests:
wp_salt()is pluggablewp_salt()is loaded after mu-plugins and plugins, so a plugin calling->async()on a closure while it loads had no key, and its registration failed. Now:describeOrDefer()), so it still fails early on an object or generator that cannot travel, with a message that suggestsstatic fnand IDs;wp_salt()exists), then memoized inQueuedHandler;closurewithout computing its descriptor, and the loop-guard key moved inside the fallback.Tests
wp-cron.php, signed with the real salts. A payload whose signature is altered does not run and firespollora/async/failed.