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

fix: Fixes auth for forwarded requests for pull queries #6895

Merged

Conversation

AlanConfluent
Copy link
Member

Description

The PR #6665 made HARouting a singleton. Unfortunately, it also kept a reference to the service context rather than using the user-aware context. What this meant is that all forward requests did not provide authentication and failed. This didn't fail in testing because it requires more than two nodes to expose the forwarding failure, since HA makes the request fall back to the fowarder itself. For that reason, I made the routing functional test use auth, which does test the three node case and was able to expose the bug.

Testing done

PullQueryRoutingFunctionalTest with auth.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@AlanConfluent AlanConfluent requested a review from a team as a code owner January 25, 2021 23:04
Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

Just a very nit question, otherwise LGTM!

@@ -392,11 +400,24 @@ public static void makeAdminRequest(TestKsqlRestApp restApp, final String sql) {
RestIntegrationTestUtil.makeKsqlRequest(restApp, sql, Optional.empty());
}

public static void makeAdminRequest(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why we have a makeAdminRequest and makeAdminRequestWithResponse here? Both of them call the same callee. Could we just have one makeAdminRequest that always returns (a potential empty list), and its callers can just ignore the returned value or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, just noticed your question. I don't think there's a reason to have two separate methods. I agree with you. I'll do a quick followup PR to fix this.

Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

Great detective work figuring this out!

@@ -122,6 +129,19 @@
SerdeFeatures.of()
);

private static final String PROPS_JAAS_REALM = "KsqlServer-Props";
private static final String KSQL_RESOURCE = "ksql-user";
private static final String USER_WITH_ACCESS = "harry";
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have a test trying out a user with no access? that will make sure that we haven't accidentally just changed it to allow all users 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

We do have tests elsewhere that test auth for pull queries and check the negative case.

@AlanConfluent AlanConfluent merged commit c360c9c into confluentinc:master Jan 27, 2021
rodesai added a commit that referenced this pull request Jan 27, 2021
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