Skip to content

Audit log: log request host more robustly #8812

@david-crespo

Description

@david-crespo

Followup to #7339.

// A note on the handling of request URI: request.request.uri() is a
// http::Uri, which contains the scheme and host only if they are in the
// HTTP request line itself, i.e., only for HTTP/2 requests. So for HTTP/1.1
// requests, all we'll have is a path. We are truncating it because it can
// be arbitrarily long in theory, and we don't want to let people jam very
// long strings into the DB.
//
// We could use the authority_for_request helper defined elsewhere to pull
// the authority out of either the URI or the host header as appropriate
// and log that in a dedicated column. In that case I think we would want
// to log uri().path_and_query() instead of the full URI -- the only problem
// is that path_and_query() returns an option, so we'd need to decide what
// to fall back to, though in practice I don't think it's possible for it to
// come back as `None` because every operation we audit log has a path.
//
// We should also consider redacting query strings or at least building in
// some tooling to help us make sure we're not logging anything sensitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions