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

contrib/internal/httptrace: store client_ip in tags for backend WAF #1328

Merged
merged 14 commits into from Jun 15, 2022

Conversation

Hellzy
Copy link
Contributor

@Hellzy Hellzy commented Jun 7, 2022

Store client IP in tags for backend WAF

This set of changes parses the client IP by browsing through the request headers and stores the IP, if found, in the tags at span creation. This is needed for the ongoing effort to setup the backend WAF.

Client IP resolution RFC:
https://datadoghq.atlassian.net/wiki/spaces/APS/pages/2118779066/Client+IP+addresses+resolution

This also updates go.mod and go.sum since the changes use inet.af/netaddr.

@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch from 94abde9 to 7a07462 Compare June 7, 2022 07:51
@Hellzy Hellzy added this to the 1.39.0 milestone Jun 7, 2022
@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch 2 times, most recently from 3bfbd1d to 0ebf5e7 Compare June 7, 2022 15:43
@Hellzy Hellzy requested a review from vdeturckheim June 7, 2022 15:43
@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch from 0ebf5e7 to 3f48379 Compare June 8, 2022 11:46
@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch 3 times, most recently from 1fbc8d3 to 046d394 Compare June 8, 2022 11:55
@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch from 046d394 to a56b30d Compare June 8, 2022 12:12
@Hellzy Hellzy marked this pull request as ready for review June 8, 2022 12:30
@Hellzy Hellzy requested a review from a team June 8, 2022 12:30
@Hellzy Hellzy requested a review from a team as a code owner June 8, 2022 12:30
contrib/internal/httptrace/options_test.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options_test.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options_test.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options_test.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch from c119d74 to ca69977 Compare June 9, 2022 15:38
Co-authored-by: Gabriel Aszalos <gabriel.aszalos@gmail.com>
@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch from ca69977 to adc7b28 Compare June 9, 2022 15:43
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options_test.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/options_test.go Outdated Show resolved Hide resolved
- Improve code wrt style guidelines
- Rework error checking in parseIP
- Use net.SplitHostPort instead of local function
- Minor nits
@Hellzy Hellzy force-pushed the francois.mazeau/backend-waf-client-ip branch from 27aac5d to 8b67d9e Compare June 10, 2022 13:14
@Hellzy Hellzy requested a review from gbbr June 13, 2022 12:29
vdeturckheim
vdeturckheim previously approved these changes Jun 13, 2022
Copy link

@vdeturckheim vdeturckheim left a comment

Choose a reason for hiding this comment

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

sgtm

contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
contrib/internal/httptrace/httptrace.go Outdated Show resolved Hide resolved
Hellzy and others added 2 commits June 14, 2022 17:52
@Hellzy Hellzy requested a review from gbbr June 15, 2022 11:48
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

👍🏻

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.

None yet

3 participants