Skip to content

fix(docs): use service origins and verify Swagger asset integrity - #135

Merged
csnitker-godaddy merged 5 commits into
mainfrom
fix/swagger-service-origin
Nov 5, 2026
Merged

csnitker-godaddy merged 5 commits into
mainfrom
fix/swagger-service-origin

Conversation

@csnitker-godaddy

@csnitker-godaddy csnitker-godaddy commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Fix Swagger parsing and requests on deployed RA/TL hosts: remove the duplicate
Problem schema, use /v2 for RA operations and / for TL and the V1 events
feed, and keep canonical/embedded documents synchronized.

Pin the existing Swagger UI 5.17.14 CSS and JavaScript with SHA-384 Subresource
Integrity and anonymous CORS. Hashes were checked against the npm tarball's
verified distribution and the actual CDN responses. Generated clients should
receive an explicit deployment base URL.

Validation: static analysis, duplicate-key-aware YAML parsing, matching
canonical/embedded documents, and served Swagger attributes on Ubuntu.

Fixes #132.

AI assistance

Assisted-by: Codex (GPT-6), under Connor Snitker's direction.

Signed-off-by: Connor Snitker <csnitker@godaddy.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Replace the RA event-path server overrides with a single / server in both canonical and embedded documents.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Updates RA and TL OpenAPI documents for valid Swagger parsing and same-origin requests.

Changes:

  • Removes the duplicate RA Problem schema.
  • Uses /v2 for RA and / for TL server URLs.
  • Synchronizes canonical and embedded documents.
  • Two moderate findings remain, each with 3 votes: the RA event-path override still exposes localhost and example-host URLs in both RA documents.
File Summary
spec/​api-spec-v2.yaml Canonical RA specification; event-path server override remains unresolved.
spec/​api-spec-tl-v2.yaml Canonical TL specification.
internal/​adapter/​docsui/​openapi/​tl.yaml Embedded TL specification.
internal/​adapter/​docsui/​openapi/​ra.yaml Embedded RA specification; event-path server override remains unresolved.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/adapter/docsui/openapi/ra.yaml Resolved
Comment thread spec/api-spec-v2.yaml Resolved
Signed-off-by: Connor Snitker <csnitker@godaddy.com>

@kperry-godaddy kperry-godaddy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relative servers entries are the right call, and I checked the mechanics rather than trusting them: swagger-js resolves a relative server URL against the document URL and strips the trailing slash before it appends the operation path, so the TL's url: / produces clean https://host/v1/... requests. Removing the second Problem also kept the accurate copy: the generic 500 path in errors.go emits no code, so the deleted definition's required: code was the wrong one. Both documents now pass a duplicate-key-strict YAML parse, and the embedded copies are byte-identical to spec/.

One thing I'd settle before this merges, inline on the servers block. Two small notes below.

Not blocking, worth a look

  • 97 $refs still point at ErrorResponse and 15 at Problem, while every RA failure path emits Problem Details. The deleted duplicate carried the only note that this migration is tracked separately, and I couldn't find an issue for it. Opening one would keep the work item from disappearing with the comment.
  • Dropping the named hosts changes what a code generator seeds as its default base URL from servers[0].url. If any SDK build reads this document directly, it will want an explicit base URL now.

Comment thread spec/api-spec-v2.yaml Resolved
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
@csnitker-godaddy csnitker-godaddy changed the title fix(docs): make Swagger work on the deployed service origin fix(docs): use service origins and verify Swagger asset integrity Oct 2, 2026
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
@csnitker-godaddy

Copy link
Copy Markdown
Member Author

The event-feed fix is present in the current branch: /v1/agents/events uses a path-level / server in both RA documents; RA management uses /v2 and TL uses /. The canonical and embedded copies match.

The two nonblocking notes are addressed as well:

I also verified the issue #132 report: the duplicate Problem schema remains on main, but this unmerged PR retains only the definition requiring type, title, and status; code remains optional. The community report is consistent with the PR not having landed yet.

Validation: duplicate-key-aware YAML parsing, canonical/embedded parity, the existing go test ./internal/adapter/docsui -count=1, formatting, and go vet ./... pass. The full local make check stops on existing trailing-blank-line lint errors in internal/ra/handler/v1certificates_test.go:125 and internal/ra/handler/v1renewal_test.go:159. No new tests or runtime changes were added in this follow-up.

@kperry-godaddy kperry-godaddy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified at f4ddd7a. The /v1/agents/events override is now url: / in both the canonical and embedded RA documents, so the feed resolves against the serving origin alongside the /v2 root and the TL's /. Both documents pass a duplicate-key-strict YAML parse and the embedded copies are byte-identical to spec/.

#153 covers the ErrorResponse migration, and the README note on explicit base URLs for generated clients settles the other question. I checked the SDK repos: none of the Go or Rust clients read this document's server list, and the Java SDK carries its own copy of the spec.

The Subresource Integrity pins on the Swagger UI assets are a good addition. A mismatched hash fails loudly (the browser refuses the asset and the page renders blank), so the risk of a bad pin going unnoticed is low. If you touch this file again, a test asserting the integrity attributes are present would keep a future edit from dropping them.

The two whitespace lint hits you saw locally are pre-existing on main and outside this change; CI lints only new issues, so they do not affect this PR.

@csnitker-godaddy
csnitker-godaddy merged commit 568f445 into main Nov 5, 2026
7 checks passed
@csnitker-godaddy
csnitker-godaddy deleted the fix/swagger-service-origin branch November 5, 2026 15:50
@github-project-automation github-project-automation Bot moved this from Triage to Done in Agent Name Service Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Swagger UI fails to parse RA spec and targets incorrect service URLs

3 participants