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

Flexible / sane header forwarding #5103

Merged
merged 7 commits into from
Feb 24, 2023

Conversation

Groxx
Copy link
Member

@Groxx Groxx commented Feb 16, 2023

Blindly forwarding all inbound headers to outbound requests is unambiguously wrong, and causing problems.

This adds a semi-flexible system to allow controlling what headers are forwarded, via static and dynamic config.
Dynamic config is currently only loaded at startup, but at least internally it's still quicker than changing static config. We should consider making this truly dynamic.

As this has historically been copying ?? to outbounds, leading to ?? total headers: the current version does not change anything. We'll likely experiment internally to make sure our new sets of headers are safe with our setup, and will make a separate PR to tighten down the list somewhat when we've confirmed that it works + is likely to work in other clusters.


Why this kind of add/remove/regex list structure? No strong reason, I've just used it in previous projects pretty happily. Only-inclusive or only-exclusive has been insufficient every time, but I've had this in a couple services for years without needing more.

Longer-term we probably want this to be truly dynamically updatable and/or fully pluggable. If we're lucky we might not need more than this though, and driving it via config is pretty convenient and easily understood.

Blindly copying all inbound headers to outbound is unamibguously wrong, but the exact list that //is// appropriate is complex and not necessarily the same everywhere.
So this adds a semi-flexible config-driven rule for controlling this.

It is in dynamic config currently because it's easier for us to change internally, while trying to build a smarter list of headers - it belongs in static config, and possibly dynamic config *after refreshing is added*.
Copy link
Member

@davidporter-id-au davidporter-id-au left a comment

Choose a reason for hiding this comment

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

hard to fault this,

@coveralls
Copy link

coveralls commented Feb 21, 2023

Pull Request Test Coverage Report for Build 018680fa-b35d-4ed0-9dd6-083a9e7a9c5d

  • 46 of 131 (35.11%) changed or added relevant lines in 9 files are covered.
  • 118 unchanged lines in 19 files lost coverage.
  • Overall coverage decreased (-0.06%) to 57.208%

Changes Missing Coverage Covered Lines Changed/Added Lines %
common/dynamicconfig/nopClient.go 0 3 0.0%
common/dynamicconfig/inMemoryClient.go 0 8 0.0%
host/dynamicconfig.go 0 9 0.0%
common/dynamicconfig/configstore/config_store_client.go 0 10 0.0%
common/dynamicconfig/file_based_client.go 0 10 0.0%
common/dynamicconfig/config.go 0 13 0.0%
common/rpc/params.go 23 36 63.89%
common/dynamicconfig/constants.go 4 23 17.39%
Files with Coverage Reduction New Missed Lines %
common/dynamicconfig/constants.go 1 50.26%
service/history/queue/transfer_queue_processor_base.go 1 77.62%
common/peerprovider/ringpopprovider/config.go 2 81.58%
common/persistence/nosql/nosqlplugin/cassandra/tasks.go 2 76.32%
common/task/weightedRoundRobinTaskScheduler.go 2 89.12%
service/history/task/transfer_active_task_executor.go 2 72.15%
common/log/tag/tags.go 3 50.82%
common/persistence/nosql/nosqlplugin/cassandra/workflow.go 3 59.1%
common/persistence/nosql/nosqlTaskStore.go 3 64.59%
service/history/task/fetcher.go 4 91.24%
Totals Coverage Status
Change from base Build 01867e09-6300-4965-80ed-9328454d8a9d: -0.06%
Covered Lines: 85185
Relevant Lines: 148903

💛 - Coveralls

@Groxx Groxx marked this pull request as ready for review February 22, 2023 02:41
@Groxx Groxx merged commit 4fd55ca into cadence-workflow:master Feb 24, 2023
@Groxx Groxx deleted the sane-header-forwarding branch February 24, 2023 17:42
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