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.
Ticket(s)
Closes #462.
Description
This PR adds hook information to the policy
Input
data. This adds yet another piece of information that can be leveraged by policies with better granularity. These are now passed to the policies:Hook.Name
: the name of the plugin hook that was run and received the Act signals.Hook.Priority
: the priority of the plugin hook. This shows at which point from the top of the list of registered hook the plugin hook was called from.Hook.Params
: the parameters passed to the plugin hook.Hook.Result
: the result of running the plugin hook. This is usually a superset of theHook.Params
, because the plugin hook must return the same request that was passed to it by theHook.Params
.This feature will work with all the future signals, policies and actions and will enable a lot of interesting use cases. For example, these initial scenarios and policies can be written after merging this PR:
terminate
policy can be updated to check for IP address of the incoming client or outgoing connection to the database. The example below means that terminating the request only happens if the request isn't coming from127.0.0.1
(localhost
). Note that thetrafficData
internal help function injects these values into the parameters that are passed to the plugin hook.TODO
Related PRs
Hook
to the policyInput
for enrichment gatewayd-plugin-sdk#33Development Checklist
make gen-docs
command.Legal Checklist