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

ROX-20122: set gRPC max concurrent streams to 100 #1287

Merged
merged 3 commits into from
Oct 13, 2023

Conversation

vladbologa
Copy link
Contributor

@vladbologa vladbologa commented Oct 12, 2023

As part of the mitigation for cve-2023-44487, some projects have decided to reduce MaxConcurrentStreams to 100 (this is the minimum recommended value in the HTTP/2 standard - default is 250).

This PR applies this change to the Scanner gRPC server.

@ghost
Copy link

ghost commented Oct 12, 2023

Images are ready for the commit at c923de3.

To use the images, use the tag 2.31.x-29-gc923de3650.

@vladbologa
Copy link
Contributor Author

/test e2e-tests

Copy link
Contributor

@dcaravel dcaravel left a comment

Choose a reason for hiding this comment

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

Can we make the 100 configurable via an env variable? So that we have a workaround in the event this causes issues.

@vladbologa
Copy link
Contributor Author

Can we make the 100 configurable via an env variable? So that we have a workaround in the event this causes issues.

@dcaravel Yes we could make it configurable. BTW since I'm not familiar with Scanner, do you know what the e2e failures are about? Can it be something that this PR caused?

@dcaravel
Copy link
Contributor

dcaravel commented Oct 12, 2023

BTW since I'm not familiar with Scanner, do you know what the e2e failures are about? Can it be something that this PR caused?

No not caused by this PR. TL;DR; our tests rely on external data / vuln feeds, when those feeds change our tests may break (like what your seeing) - I'll fix this particular failure in a different PR.

@dcaravel dcaravel requested a review from a team October 12, 2023 14:56
@dcaravel
Copy link
Contributor

FYI, #1288 has been merged, if bring in those changes here e2e tests should pass.

@RTann
Copy link
Collaborator

RTann commented Oct 12, 2023

Created #1289 so we can accept integer env vars

@RTann
Copy link
Collaborator

RTann commented Oct 13, 2023

also, I'm thinking we call it ROX_MAX_CONCURRENT_STREAMS. We should coordinate with whatever may be done for the stackrox repo, though

@vladbologa vladbologa force-pushed the max-concurrent-streams branch 2 times, most recently from 604d1b2 to 1685e2d Compare October 13, 2023 11:27
@vladbologa
Copy link
Contributor Author

also, I'm thinking we call it ROX_MAX_CONCURRENT_STREAMS. We should coordinate with whatever may be done for the stackrox repo, though

@RTann I called it ROX_GRPC_MAX_CONCURRENT_STREAMS. It's the same in stackrox/stackrox, but there we have an additional setting ROX_HTTP2_MAX_CONCURRENT_STREAMS

@vladbologa
Copy link
Contributor Author

/test unit-tests

@vladbologa vladbologa force-pushed the max-concurrent-streams branch from 1685e2d to 678ead4 Compare October 13, 2023 16:48
api/grpc/grpc.go Outdated
)

func maxGrpcConcurrentStreams() uint32 {
if maxGrpcConcurrentStreamsSetting.Int() < 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Though the gRPC library defaults this to math.MaxUint when 0, the HTTP/2 library defaults it to at least 100 when 0. Can we also default it to 100?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you suggesting that I change < 0 to<= 0?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I missed that. I should do it also in stackrox.

api/grpc/grpc.go Outdated
)

func init() {
grpcprometheus.EnableHandlingTimeHistogram()
}

var (
maxGrpcConcurrentStreamsSetting = env.RegisterIntegerSetting("ROX_GRPC_MAX_CONCURRENT_STREAMS", defaultGrpcMaxConcurrentStreams)
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's put this in pkg/env/list.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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

Successfully merging this pull request may close these issues.

3 participants