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

[v23.1.x] schema_registry: Improve sanitization of Avro namespaces #12425

Merged

Commits on Jul 24, 2023

  1. schema_registry/avro: Refactor Sanitize

    Pass a context instead of just a memoryt allocator.
    
    Signed-off-by: Ben Pope <[email protected]>
    (cherry picked from commit 312817c)
    BenPope authored and vbotbuildovich committed Jul 24, 2023
    Configuration menu
    Copy the full SHA
    676655c View commit details
    Browse the repository at this point in the history
  2. schema_registry/avro: Replace namespace iff fullname

    If the name field is a fullname, then an existing namespace is ignored.
    
    Sanitize splits the fullname into name and namespace, so rewrite the
    namespace rather than returning an error.
    
    Reference: https://avro.apache.org/docs/1.11.1/specification/#names
    
    Signed-off-by: Ben Pope <[email protected]>
    (cherry picked from commit 29af7c8)
    BenPope authored and vbotbuildovich committed Jul 24, 2023
    Configuration menu
    Copy the full SHA
    29f5888 View commit details
    Browse the repository at this point in the history
  3. schema_registry/avro: Test more namespace behaviour

    Check that simple namespace cases are left alone.
    
    Signed-off-by: Ben Pope <[email protected]>
    (cherry picked from commit 6e7c061)
    BenPope authored and vbotbuildovich committed Jul 24, 2023
    Configuration menu
    Copy the full SHA
    cc684d2 View commit details
    Browse the repository at this point in the history
  4. schema_registry/avro: Remove redundant namespaces

    This PR keeps track of the current namespace in a stack, starting with
    the implicitly null "empty" namespace.
    
    If the namespace changes, push it to the stack.
    
    If a namespace is redundant (the same as outer scope), remove it.
    
    Fixes redpanda-data#11912
    
    Signed-off-by: Ben Pope <[email protected]>
    (cherry picked from commit 9cfd7bd)
    BenPope committed Jul 24, 2023
    Configuration menu
    Copy the full SHA
    f5384f1 View commit details
    Browse the repository at this point in the history
  5. schema_registry/avro: Document the name & namespace sanitization

    Signed-off-by: Ben Pope <[email protected]>
    (cherry picked from commit d73b2c8)
    BenPope committed Jul 24, 2023
    Configuration menu
    Copy the full SHA
    344efb1 View commit details
    Browse the repository at this point in the history