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

internal/appsec: implement WAF actions for http/grpc #1533

Merged
merged 34 commits into from Dec 12, 2022

Conversation

Hellzy
Copy link
Contributor

@Hellzy Hellzy commented Oct 20, 2022

What does this PR do?

Add a system of "actions", which are basically callbacks that are executed after the WAF matches specific rules.
Also add a default action - both for grpc and http - that will block a before its execution if said action is called.

Motivation

This change allows the libraries to react proactively when a rule gets matched by the WAF. The primary example is when
blocking a user depending on their IP. If a blocked IP issues a request, the WAF will match a rule that links to an action that will block the request before it gets a chance of being executed.

Describe how to test/QA your changes

Reviewer's Checklist

  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • Changed code has unit tests for its functionality.
  • If this interacts with the agent in a new way, a system test has been added.

Base automatically changed from francois.mazeau/http-client-ip-rework to main October 24, 2022 19:17
@Hellzy Hellzy force-pushed the francois.mazeau/ip-blocking branch from f6cb235 to 24bd90f Compare October 25, 2022 07:53
@Hellzy Hellzy added this to the v1.44.0 milestone Oct 25, 2022
@Hellzy Hellzy force-pushed the francois.mazeau/ip-blocking branch from 24bd90f to a36fc28 Compare October 26, 2022 13:50
@Hellzy Hellzy changed the base branch from main to francois.mazeau/rc-asm-data October 26, 2022 13:51
@Hellzy Hellzy changed the base branch from francois.mazeau/rc-asm-data to main November 3, 2022 10:32
@Hellzy Hellzy force-pushed the francois.mazeau/ip-blocking branch 5 times, most recently from e859163 to aa4e477 Compare November 3, 2022 11:11
@Hellzy Hellzy changed the title [WIP] internal/appsec: block requests based on client ip [WIP] internal/appsec: implement WAF actions for http/grpc Nov 3, 2022
@Hellzy Hellzy marked this pull request as ready for review November 3, 2022 16:01
@Hellzy Hellzy requested a review from a team as a code owner November 3, 2022 16:01
ASM now instanciates an action handler that will perform various
actions commanded by the WAF after a match is performed. The
"block_request" action type is the only kind of action currently
supported, allowing to block an HTTP request.
@Hellzy Hellzy changed the title [WIP] internal/appsec: implement WAF actions for http/grpc internal/appsec: implement WAF actions for http/grpc Nov 21, 2022
@ajgajg1134 ajgajg1134 modified the milestones: v1.44.0, v1.45.0 Nov 21, 2022
internal/appsec/dyngo/instrumentation/httpsec/http.go Outdated Show resolved Hide resolved
internal/appsec/dyngo/instrumentation/httpsec/http.go Outdated Show resolved Hide resolved
internal/appsec/dyngo/instrumentation/httpsec/http.go Outdated Show resolved Hide resolved
internal/appsec/dyngo/instrumentation/httpsec/http.go Outdated Show resolved Hide resolved
internal/appsec/waf.go Show resolved Hide resolved
internal/appsec/waf.go Outdated Show resolved Hide resolved
internal/appsec/waf.go Outdated Show resolved Hide resolved
internal/appsec/dyngo/instrumentation/common.go Outdated Show resolved Hide resolved
internal/appsec/waf.go Outdated Show resolved Hide resolved
@Hellzy Hellzy force-pushed the francois.mazeau/ip-blocking branch 2 times, most recently from 83b510b to 8d590ce Compare December 6, 2022 15:57
@Hellzy Hellzy force-pushed the francois.mazeau/ip-blocking branch from 772a9ea to ca98bff Compare December 7, 2022 13:34
@Hellzy Hellzy requested a review from a team December 8, 2022 16:31
knusbaum
knusbaum previously approved these changes Dec 8, 2022
Copy link
Contributor

@knusbaum knusbaum left a comment

Choose a reason for hiding this comment

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

All good from trace side.

@pr-commenter
Copy link

pr-commenter bot commented Dec 8, 2022

Benchmarks

Comparing candidate commit e7a01b3 in PR branch francois.mazeau/ip-blocking with baseline commit 989e14a in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 6 cases.

@Hellzy Hellzy force-pushed the francois.mazeau/ip-blocking branch from 1d99f66 to 5b350a9 Compare December 9, 2022 19:18
@Hellzy Hellzy force-pushed the francois.mazeau/ip-blocking branch from 5b350a9 to 7281ec4 Compare December 9, 2022 19:19
@Julio-Guerra Julio-Guerra requested a review from a team as a code owner December 12, 2022 14:09
Copy link
Contributor

@ajgajg1134 ajgajg1134 left a comment

Choose a reason for hiding this comment

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

👍 for APM

@Julio-Guerra Julio-Guerra merged commit 4b12722 into main Dec 12, 2022
@Julio-Guerra Julio-Guerra deleted the francois.mazeau/ip-blocking branch December 12, 2022 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants