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

rfc43: add constraint DoS limits #409

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Jan 13, 2024

Problem: A caller has the ability to specify an unbounded sized constraint object, which could serve as a denial of service (DoS) attack on the job list service.

Specify hard constraint limits on the size of operator arrays and constraint depth.


initial proposal based on flux-framework/flux-core#5681

@chu11
Copy link
Member Author

chu11 commented Feb 1, 2024

accidentally closed, re-opened and re-pushed with updated description of "comparison limits", per PR flux-framework/flux-core#5681

Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

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

This seems good to me. Just a few wording suggestions inline.

spec_43.rst Outdated
@@ -247,6 +247,20 @@ Filter jobs that belong to userid 42 and were submitted after January 1, 2000.

{ "and": [ { "userid": [ 42 ] }, { "t_submit": [ ">946713600.0" ] } ] }

In order to limit the potential for a constraint to cause a denial of service (DoS) or long job list service hang, the instance owner can configure a maximum number of *comparisons* a constraint can consume while filtering jobs. Every "check" against a job is considered a comparison. In the last example above, the constraint is looking for all jobs belonging to userid 42 and submitted after January 1, 2000. It will consume at most 2 *comparisons* for each job. The ``userid`` check will always consume 1 comparison and the submission time will consume a comparison if the ``userid`` check passes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: reword this description to be in "RFC speak"? E.g. "The instance owner MAY configure...". "Every check SHALL be considered one comparison"...

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I wonder if "The instance owner MAY" could be dropped and we can just say "a comparison limit for constraints MAY be configured"

spec_43.rst Outdated
@@ -247,6 +247,20 @@ Filter jobs that belong to userid 42 and were submitted after January 1, 2000.

{ "and": [ { "userid": [ 42 ] }, { "t_submit": [ ">946713600.0" ] } ] }

In order to limit the potential for a constraint to cause a denial of service (DoS) or long job list service hang, the instance owner can configure a maximum number of *comparisons* a constraint can consume while filtering jobs. Every "check" against a job is considered a comparison. In the last example above, the constraint is looking for all jobs belonging to userid 42 and submitted after January 1, 2000. It will consume at most 2 *comparisons* for each job. The ``userid`` check will always consume 1 comparison and the submission time will consume a comparison if the ``userid`` check passes.

After the maximum number of *comparisons* is consumed, an error is returned to the caller. The caller can decrease their search footprint by limiting their search using other inputs in the job list request or making tighter constraints. For example, take following two constraints:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above, "an error SHALL be returned to the caller. The caller MAY decrease ..."

spec_43.rst Outdated

{ "and": [ { "userid": [ 42 ] }, { "queue": [ "foobar" ] } ] }

In these examples the caller wants to filter jobs submitted to the queue foobar and submitted by userid 42. The only difference is the order of the checks. If "foobar" is the most common queue in the system (i.e. the check for queue "foobar" typically succeeds) and ``userid`` is not the most common user in the system (i.e. the check for userid "42" typically fails), the latter constraint will consumes fewer comparisons.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/consumes/consume/

Actually just removing "will" would work too and be more succinct.

Problem: A caller has the ability to specify an unbounded sized
constraint object, which could serve as a denial of service (DoS)
attack on the job list service.

Add description of comparison limits for constraints.  By limiting
total number of "checks", we can bound constraints and their ability
to DoS the job list service.
@chu11
Copy link
Member Author

chu11 commented Feb 2, 2024

@grondo Thanks. Re-pushed with some tweaks per comments above.

@grondo
Copy link
Contributor

grondo commented Feb 2, 2024

Already approved so feel free to set MWP!

@mergify mergify bot merged commit ecf422b into flux-framework:master Feb 2, 2024
7 checks passed
@chu11 chu11 deleted the rfc43_constraint_limit branch February 2, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants