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

IAST support for akka-http #5019

Merged
merged 1 commit into from
Apr 14, 2023
Merged

IAST support for akka-http #5019

merged 1 commit into from
Apr 14, 2023

Conversation

cataphract
Copy link
Contributor

No description provided.

@cataphract cataphract requested a review from a team April 4, 2023 00:43
@cataphract cataphract requested a review from a team as a code owner April 4, 2023 00:43
@cataphract cataphract force-pushed the glopes/iast-akka-http branch 3 times, most recently from dc4e34f to a92763d Compare April 4, 2023 01:11
@smola smola added the comp: asm iast Application Security Management (IAST) label Apr 4, 2023
@cataphract cataphract requested review from a team as code owners April 4, 2023 09:55
@cataphract cataphract force-pushed the glopes/iast-spring-webflux branch 2 times, most recently from ddb1169 to 2bb1cce Compare April 10, 2023 09:31
Base automatically changed from glopes/iast-spring-webflux to master April 12, 2023 18:26
@@ -73,6 +84,15 @@ muzzle {

configurations {
testArtifacts

iastTestImplemnentation.extendsFrom(baseTestImplementation)

Choose a reason for hiding this comment

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

Nice!, I did struggle with something similar in vert.x 3 and this solution is quite clean


static class TaintQueryStringAdvice {
@Advice.OnMethodExit(suppress = Throwable.class)
static void after(@Advice.This Uri uri, @Advice.Return scala.Option<String> ret) {

Choose a reason for hiding this comment

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

Why do you use the actual Uri type here and on TaintQueryAdvice it's an Object? I always got the impression that if you want to use the actual instrumented type you should extract the advice class to a separate one (but it might be wrong)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The explanation is in the comment for TaintQueryAdvice. I reuse the advice for a method in another class that also returns a Uri$Query. We only care if this is tainted. We can bind the arguments to the advice to a reference of any supertype of the formal type of the method argument/this. We can even do a downcast with typing = DYNAMIC

Choose a reason for hiding this comment

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

I wasn't aware about the dynamic typing, thanks!

@@ -33,6 +33,8 @@ public interface WebModule extends IastModule {

void onQueryString(@Nullable String queryString);

void onCookieNames(@Nullable Iterable<String> cookieNames);
Copy link
Member

Choose a reason for hiding this comment

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

So far I tried to use interfaces like Collection that are more explicit about the capability of being iterated more than once. But this is ok as long as the places where we call this are checked for types that are capable of multiple iterations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this to avoid having to some scala objects

@cataphract cataphract merged commit d87e9c3 into master Apr 14, 2023
@cataphract cataphract deleted the glopes/iast-akka-http branch April 14, 2023 16:15
@github-actions github-actions bot added this to the 1.12.0 milestone Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: asm iast Application Security Management (IAST)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants