Skip to content

Check the callback URL as the specification's six rules say - #77

Draft
jwrosewell wants to merge 5 commits into
rcfrom
callback-url-rules
Draft

jwrosewell wants to merge 5 commits into
rcfrom
callback-url-rules

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The JavaScript builder's callback URL check does not follow the merged callback URL rules (specifications#74). This brings pipeline/pipeline.javascriptbuilder/src/main/java/fiftyone/pipeline/javascriptbuilder/flowelements/CallbackUrl.java into line with the page, tests first. The page is the authority.

The rules and what changed

  1. Protocol is http or https, ASCII case only. Already held.
  2. The host value holds no ? or #. Before, example.com?x and example.com#x were accepted and written into the script.
  3. The host value holds no @ anywhere. Before, user information such as user:pw@example.com, u%41@example.com, @example.com and :@example.com was accepted and encoded. example.com/a@b and user:12/ss@example.com (read as host user, port 12) were accepted too.
  4. The host is a bracketed IPv6 address with nothing else inside, or a name of ASCII labels. A % inside the brackets is refused, so [fe80::1%25eth0], [fe80::1%25eth0]:8080 and the other zone identifiers were accepted before. A name whose last label is digits, or 0x and hex digits, must be an IPv4 address in RFC 3986 form. Before, example.123, example.0x1f, example.0X, 1.2.3.999, 1.2.3, 127.1, 0x7f.0.0.1, 01.2.3.4, example.123., 1.2.3.4., 1.2.3.4.5, 1, 300.1.1.1 and 0x7f.1 were accepted.
  5. Port, where present, is : then digits up to 65535. A port that is present but empty is refused. RFC 3986 section 3.2.3 allows an empty port, so the rule refuses one deliberately (see also section 6.2.3), as specifications#112, merged, adds to rule 5. So example.com:, example.com:/path and [::1]: fail, and so do https://example.com and http://example.com. Before, https://example.com read as the host https with an empty port and gave https://https://example.com/51dpipeline/json with nothing logged.
  6. A refused URL is not passed to the template and is logged once per element instance. The logged text now shows *** in place of everything in the host value before its last @, so user:secret@example.com, a@b@example.com, u@[::1]:80x, user:pa/ss@example.com and user:pa?ss@example.com never write the password to the log. Before, the whole built URL was logged.

Rules 7 and 8 are unchanged apart from the user information, which no longer exists. The encoding case is now example.com/"^{|}with endpoint/j"^{|}.

Tests

CallbackUrlTests.java holds every refuse, accept and log case from the page and from the shared case list, with the newly refused hosts removed from the accepted list. JavaScriptUrlTests.java renders the script through the element and checks the logged text, each case with its own element because a refusal is logged once per instance. Also added: configured protocols of white space only are refused.

  • Red, tests alone, ubuntu-latest and windows-latest: run 42579351114 failed 61 of 185 tests (54 in CallbackUrlTests, 7 in JavaScriptUrlTests). The failures are refused hosts accepted, and the logged URL carrying the password. An earlier run, 42579134449, failed only because the temporary workflow did not quote a Maven option.
  • Green, with the change: run 42579610570 passed on both.

Empty port, added after the first runs: red run 42584863653 (new cases only fail), green run 42584954823 passed.

Full build

Run 42620856814 at head b20b4e2, where Setting 'PullRequestSha' equals the head. All Windows and Ubuntu jobs and MacOS_Java_11 passed. The remaining macOS jobs were still queued or running for runners when this was written.

The documentation links in the code comments point at the specifications main branch, as the other repositories' do, and the callback URL section reaches main with the next specifications release.

Release note

The callback URL check now follows RFC 3986 and the JavaScript builder specification.

Outstanding

Nothing known. No version change and no +semver directive.

Adds the refused, accepted and logged cases from the JavaScript builder
specification's callback URL section, and removes from the accepted hosts
every host the section now refuses. The new cases fail until the check
follows the rules.
The host value is checked as written. A host holding '?', '#' or '@' is
refused, as is an IPv6 zone identifier and a name whose last label is a
number but which is not an IPv4 address in RFC 3986 form. The URL kept
for the log shows *** in place of everything before the host value's
last '@'.
Adds example.com:, example.com:/path, [::1]:, https://example.com and
http://example.com to the refused hosts, and the log case for the last
protocol-in-host mistake, and removes example.com: from the accepted
hosts.
A host such as https://example.com otherwise reads as the host https
with an empty port, and gives https://https://example.com/... with
nothing logged. RFC 3986 section 3.2.3 allows an empty port in the
syntax, and section 6.2.3 notes that a URI with an empty port is
equivalent to one with none, so the host is written without the colon.
A trailing line break after a host, a port or a bracketed address is
refused, and 1:2:3:4:5:6:7:8 and ::1.2.3.4 are accepted whilst 1::2::3
and 12345::1 are refused.
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.

1 participant