Repository navigation
test: hold end user talk links to an https host allow-list - #1406
Conversation
Fold the URL gate proposed in cncf#1375 into tests/end-user-talks-data.test.mjs so the snapshot has one integrity contract rather than two files. Reuse checkUrl() from scripts/lib/validate-utils.mjs (landed in cncf#1381) instead of adding another copy of the scheme/userinfo/host check; sourceUrl and every talk.url must resolve to events.linuxfoundation.org and stay on the schedule page's pathname, apiUrl to sessionize.com. Closes cncf#1374 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
There was a problem hiding this comment.
Verified against the tree and ran the test file on this head (node --test tests/end-user-talks-data.test.mjs): all pass.
checkUrl()inscripts/lib/validate-utils.mjsdoes what these assertions rely on: protocol allow-list defaults to https (line 79), userinfo rejection at line 118, and the host-suffix check (lines 127-131) useshost === domain || host.endsWith('.' + domain), so the look-alike caseevents.linuxfoundation.org.evil.examplein the non-vacuity test is genuinely rejected, not coincidentally.- The pathname pin (
new URL(talk.url).pathname === new URL(schedule.sourceUrl).pathname) closes the "elsewhere on the real host" gap the comment names, which host checking alone would miss. - The non-vacuity test is the right guard here: without it, an empty
talksarray or a silently-permissivecheckUrloption change would leave the loops green while asserting nothing. - Body matches the diff: this is exactly the #1375 scope reimplemented on the shared
checkUrl()rather than a local copy, appended to the file #1383 created.
One note for the maintainer: the body says this supersedes #1375 — if that PR is still open, it should be closed in favour of this one when this merges. Looks correct to me.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Independently verified at
Reusing One adjacent note, filed separately as #1412 and not a change request on this PR: the No concerns with the change as it stands. 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88 |
Test Improvement
Consolidates #1375 into the integrity test #1383 landed, so
data/kubecon-na-2026-end-user-talks.jsonhas one contract file instead of two. Supersedes #1375.Appended to
tests/end-user-talks-data.test.mjs:sourceUrland everytalk.urlmust be https, carry no userinfo, resolve toevents.linuxfoundation.org, and stay on the schedule page's pathname;apiUrlmust resolve tosessionize.com.javascript:, userinfo, look-alike suffix host, unrelated host, relative path) is rejected.Uses
checkUrl()fromscripts/lib/validate-utils.mjs(#1381) rather than the localpublishableUrl()copy in #1375, so this does not add a seventh instance of the pattern #1388 tracks. The assertions #1375 also carried forgeneratedAtvalidity andday.idslug/uniqueness were already covered by #1383 and are not duplicated.Verification
talk.urltohttps://events.linuxfoundation.org@evil.example/...fails the suite (1 fail); restored file passes 16/16.npm run test:unit:coverage:check: 2565 pass, coverage gate green.Closes #1374