-
Notifications
You must be signed in to change notification settings - Fork 81
Use a running count of resolved placeables to protect against denial of service attacks #439
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
Conversation
…f service attacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK, but we'll need to update the parent scope when we return from term references, too. I want to take a look at that one again.
In the generator I have in Python, I'm kinda making the same mistake, but I catch that in the outer loop still.
When we talk about standardization, we'll need to have a second look at whether it's parts or placeables that are better to restrict.
Also, the Python impl uses MAX_PARTS = 1000
, which is a bit more lenient than MAX_PLACEABLES = 100
. I wish we had good reasons to choose one number over the other ;-).
Thanks, great feedback. Since we need to clean up after resolving a I also changed how the resolver detects that it's inside a
+1
Does it sound like a good idea to start with the lower number and see if it's enough? In the future, we could also consider making this an option to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if using a Map
for named parameters would be better than an Object, but we're not off worse here, just slightly different if someone goes for __proto__
as variable name.
Thanks for the review!
That's what I did in the reference resolver (WIP). The semantics of
I've had a change of heart this morning :) Let me revert to using |
Remove the arbitrary limit imposed on the length of resolved placeables. Instead, keep a running count of how many placeables there have been so far in the current call to
formatPattern
. This includes all nested placeables, preventing deeply nested hierarchies of references from eating up the memory and the CPU during resolution.