Skip to content

Discovery Decode accepts an orchestrator address with an empty fragment #99

Done

Description

@nehkee

Following up on #71 as discussed.

discovery/shared.Decode accepts an orchestrator address that ends in a bare #, such as https://orch.example/deployment#. The schema rejects it, and standalone discovery then serves it in a body the schema also rejects.

Cause: url.Parse drops an empty fragment. u.Fragment is "" and RawFragment isn't set, so ValidateURL can't tell that a # was there. This is the same gap as the ? case, which is already caught through ForceQuery.

Repro on main (889d0fa):

body := []byte(`[{"address":"https://orch.example/deployment#","runners":[{"url":"https://orch.example/app","app":"example","observed_at":"2026-10-22T18:05:00Z"}]}]`)
entries, err := shared.Decode[discoveryRunner](body, time.Now())
// err == nil; schema rejects body
// shared.Merge(entries) re-served as {"address","runners"} still has ".../deployment#"; schema rejects it

Possible fix: in Decode, skip an entry whose raw address contains #, the same as any other invalid address. Add a regression case for …/deployment# in TestDecodeValidation and the schema corpus.

I found this with a fuzz test that runs everything Decode accepts back through the discovery envelope and checks it against the schema.

Activity

  1. j0sh commented on Dec 5, 2026

    @j0sh
    Collaborator

    Fixed in #122 thanks for the report

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

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