Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/rollout.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,16 @@ and no provider request, release,
tag or consumer pin change was performed for this correction. The failed
capture remains retained evidence; a future authorized hosted capture must
prove recovery against the real complete deployment.

## Recovery API operation diagnostics: source preparation

Hosted capture 38168366416 verified the v0.1.9 executor checksum, then failed
with HTTP 403 before retaining a recovery record. The denied endpoint is
unknown from that run; no permission requirement can be inferred from it.
The next source patch adds fixed operation labels to HTTP failures for the six
existing capture reads and three restore writes, with an `unknown` fallback.
It prints no raw method, URL, query, identifier, header, body or binding value.
Request order, response guards, pagination and capture/restore/CAS behavior are
unchanged. Static checks do not establish provider acceptance. No tests were
added or manually run, and no retry, permission change or provider request was
performed for this source preparation. Release and hosted diagnosis are pending.
25 changes: 24 additions & 1 deletion studio/websites.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ def redirect_request(self, req, fp, code, msg, headers, newurl):
raise ValueError('Cloudflare recovery API redirects are not allowed')


def _recovery_operation(method, path):
"""Identify a fixed operation without exposing path identifiers or queries."""
operations = (
('GET', r'/accounts/[^/]+/workers/scripts/[^/]+/deployments', 'deployments.read'),
('GET', r'/accounts/[^/]+/workers/scripts/[^/]+/versions/[^/]+', 'version.read'),
('GET', r'/accounts/[^/]+/workers/services/[^/]+', 'service.read'),
('GET', r'/accounts/[^/]+/workers/services/[^/]+/environments/[^/]+/routes',
'routes.read'),
('GET', r'/accounts/[^/]+/workers/domains/records', 'custom-domains.read'),
('GET', r'/accounts/[^/]+/workers/services/[^/]+/environments/[^/]+/subdomain',
'subdomain.read'),
('PUT', r'/accounts/[^/]+/workers/services/[^/]+/environments/[^/]+/routes',
'routes.write'),
('PUT', r'/accounts/[^/]+/workers/scripts/[^/]+/domains/records',
'custom-domains.write'),
('POST', r'/accounts/[^/]+/workers/scripts/[^/]+/subdomain', 'subdomain.write'),
)
endpoint = path.partition('?')[0]
return next((label for verb, pattern, label in operations
if method == verb and re.fullmatch(pattern, endpoint)), 'unknown')


class CloudflareWorkersAPI:
"""Small bounded transport for the scoped Workers recovery endpoints."""

Expand Down Expand Up @@ -79,7 +101,8 @@ def request(self, method, path, data=None, headers=None):
raw = response.read(2_000_001)
except HTTPError as error:
error.close()
raise ValueError(f'Cloudflare recovery API request failed (HTTP {error.code})') from None
operation = _recovery_operation(method, path)
raise ValueError(f'Cloudflare recovery API request failed (operation={operation}, HTTP {error.code})') from None
except (URLError, OSError):
raise ValueError('Cloudflare recovery API request did not complete') from None
if len(raw) > 2_000_000:
Expand Down
Loading