fix(ci): the cleanup script forced TLS onto a plaintext endpoint (#324) #339

Merged
bermudalamb merged 2 commits from fix/324-cleanup-honours-scheme into main 2026-09-10 07:19:47 -05:00
Owner

Refs #324. Fixes the failure on the first real run of cleanup-actions.

What the error was

write EPROTO ... ssl3_get_record:wrong version number

That reads like a TLS misconfiguration and sends you looking at certificates and protocol versions. It is neither. The server answered in cleartext, and OpenSSL tried to parse that as a TLS record.

Why

scripts/cleanup-workflow-runs.js required node's https module and always used it, defaulting to port 443:

const req = https.request({ hostname: origin.hostname, port: origin.port || 443, ... })

That was fine while GITEA_HOST was typed by hand as a public https:// URL. It stopped being fine the moment the workflow started supplying it from github.server_url, which inside the runner is the address act_runner reaches Gitea on rather than the public one — plain HTTP on a container port here.

So the script sent a TLS handshake to a plaintext port. The scheme in the URL was being ignored entirely.

The fix

Honour the scheme, and let the default port follow from it. A URL naming neither http nor https is refused up front with a message naming the value, because this script speaks nothing else and a bad input is worth reporting as one.

The endpoint is also printed before the first request rather than after one succeeds. That is what made this cost more than it should have: the failure named a symptom inside OpenSSL and said nothing about where the script had been pointed.

endpoint   : http://127.0.0.1:58123
repository : bermudalamb/redefined-designs
total runs : 1

Testing

Run end to end against a plaintext HTTP stub: listing, age selection and the dry-run report all work over http. A bad scheme exits 1 with a message naming the value it was given.

Worth running with apply left at false once this is merged, to confirm the endpoint line and the counts look right before deleting anything.

🤖 Generated with Claude Code

Refs #324. Fixes the failure on the first real run of `cleanup-actions`. ## What the error was ``` write EPROTO ... ssl3_get_record:wrong version number ``` That reads like a TLS misconfiguration and sends you looking at certificates and protocol versions. It is neither. The server answered in **cleartext**, and OpenSSL tried to parse that as a TLS record. ## Why `scripts/cleanup-workflow-runs.js` required node's `https` module and always used it, defaulting to port 443: ```js const req = https.request({ hostname: origin.hostname, port: origin.port || 443, ... }) ``` That was fine while `GITEA_HOST` was typed by hand as a public `https://` URL. It stopped being fine the moment the workflow started supplying it from `github.server_url`, which inside the runner is the address `act_runner` reaches Gitea on rather than the public one — plain HTTP on a container port here. So the script sent a TLS handshake to a plaintext port. The scheme in the URL was being ignored entirely. ## The fix Honour the scheme, and let the default port follow from it. A URL naming neither `http` nor `https` is refused up front with a message naming the value, because this script speaks nothing else and a bad input is worth reporting as one. The endpoint is also printed **before** the first request rather than after one succeeds. That is what made this cost more than it should have: the failure named a symptom inside OpenSSL and said nothing about where the script had been pointed. ``` endpoint : http://127.0.0.1:58123 repository : bermudalamb/redefined-designs total runs : 1 ``` ## Testing Run end to end against a plaintext HTTP stub: listing, age selection and the dry-run report all work over `http`. A bad scheme exits 1 with a message naming the value it was given. Worth running with `apply` left at `false` once this is merged, to confirm the endpoint line and the counts look right before deleting anything. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bermudalamb added 1 commit 2026-09-10 07:18:43 -05:00
fix(ci): the cleanup script forced TLS onto a plaintext endpoint (#324)
SonarQube Analysis / sonarqube (pull_request) Failing after 27m40s
Linting / lint (pull_request) Successful in 3m0s
6b08330690
The workflow failed on its first real run with:

    write EPROTO ... ssl3_get_record:wrong version number

which reads like a TLS misconfiguration and sends you looking at certificates and protocol versions. It is neither. The server answered in cleartext and OpenSSL tried to parse that as a TLS record.

The script required node's https module and always used it, defaulting to port 443. That was fine while the host was typed by hand, and it stopped being fine the moment the workflow started supplying it from github.server_url. Inside the runner that is the address act_runner reaches Gitea on, not the public one, and here it is plain HTTP on a container port.

So the scheme in GITEA_HOST is honoured rather than assumed, and the default port follows from it. A URL naming neither http nor https is refused up front, because this script speaks nothing else and reporting that as a bad input beats failing later inside a request.

The endpoint is now printed before the first request rather than after one succeeds. That is the part that made this cost more than it should have: a transport failure said nothing about where it had been pointed, so the message named a symptom in OpenSSL and nothing about the run at all.

Verified against a plaintext HTTP stub end to end: the listing, the age selection and the dry-run report all work over http, and a bad scheme exits 1 with a message naming the value it was given.

Refs #324

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bermudalamb added 1 commit 2026-09-10 07:19:40 -05:00
Merge branch 'main' into fix/324-cleanup-honours-scheme
SonarQube Analysis / sonarqube (pull_request) Failing after 27m16s
Linting / lint (pull_request) Successful in 3m14s
f31d3117d1
bermudalamb merged commit d69091d5ad into main 2026-09-10 07:19:47 -05:00
bermudalamb deleted branch fix/324-cleanup-honours-scheme 2026-09-10 07:19:48 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bermudalamb/redefined-designs#339