Skip to content

[FlightRPC][Java] Provide standard way to get client IP address #316

Open

Description

@asfimport

Obtaining the IP address of the client can be accomplished via gRPC, but the gRPC interface exposing this information is considered unstable.  It would be good to expose this through a standard interface in Flight, both to buffer any future changes/instability in gRPC, but also in support of alternative transports.

Reporter: Todd Farmer / @toddfarmer

Note: This issue was originally created as ARROW-16565. Please see the migration documentation for further details.

Activity

  1. asfimport commented on May 12, 2022

    @asfimport
    Author

    David Li / @lidavidm:
    Marking as Java since C++/Python support this.

  2. aiguofer commented on Jun 29, 2023

    @aiguofer
    Contributor

    It seems like this could be helpful in various situations. Although the gRPC interface for it is considered unstable, it's been around for quite a while and would likely not break unexpectedly (there would be a deprecation and migration path).

    An easy way to expose this could be creating some sort of RequestInfo object that gets added to the gRPC Context and later passed into the Flight CallContext so it's easily accessible in request handlers. What other types of data are exposed in the C++/Python interface that we might want to add?

  3. scruz-denodo commented on Jul 2, 2024

    @scruz-denodo

    Hi, I have done some changes about this issue. Before creating a pull request I would like to discuss them here.

    This is the change:
    apache/arrow@main...scruz-denodo:arrow:issue/31924

    About the experimetal status from the io.grpc.ServerCall#getAttributes method. There is some recent movement here.
    grpc/grpc-java#1779

    I think it is also useful if the following method receives the new org.apache.arrow.flight.RequestInfo object.
    org.apache.arrow.flight.auth2.CallHeaderAuthenticator#authenticate

    The information about the client ip could be interesting for deciding about the authentication.

    Updated: The movement on the grpc issue was before the comment of @aiguofer

  4. aiguofer commented on Jul 2, 2024

    @aiguofer
    Contributor

    This is great! I would love to have something like this. Another nice thing to add to the RequestInfo would be the authority.. we've been doing this apache/arrow#38911 (comment) but that interceptor happens after authenticate is called.

    Side note: I would also love to have the RequestContext passed to authenticate since it's likely users might want to inject values that are looked up during auth into the request context.

  5. scruz-denodo commented on Jul 3, 2024

    @scruz-denodo

    I've just added changes for having the RequestInfo available at authentication process with org.apache.arrow.flight.auth2.CallHeaderAuthenticator

    Maybe I add tests and create a PR, for checking if they are valid changes for contributing.

  6. transferred this issue fromapache/arrowon Nov 26, 2024
  7. jarohen commented on Oct 23, 2026

    @jarohen
    Contributor

    We'd use this too: XTDB applies address-based authentication rules to Flight SQL connections, as pg_hba.conf does for Postgres.

    We authenticate in a FlightServerMiddleware, so we'd need the address in FlightServerMiddleware.Factory.onCallStarted as well as in CallHeaderAuthenticator.authenticate — on CallInfo, say, or via the proposed RequestInfo. As of 19.0.0, onCallStarted gets a CallInfo carrying only the method.

    In the meantime we register a gRPC ServerStreamTracer through the grpc.builderConsumer transport hint, which stamps the peer address into a server-only header before middleware runs. That relies on the @ExperimentalApi ServerBuilder.addStreamTracerFactory.

    ^^ 🤖

    Here's our hack, if it helps.

    Cheers,

    James

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions