Title: improvement(api): declare OAuth scopes in OpenAPI, JSON 404s for unknown API paths, and root MCP resource metadata by waleedlatif1 · Pull Request #9026 · simstudioai/sim · GitHub
Open Graph Title: improvement(api): declare OAuth scopes in OpenAPI, JSON 404s for unknown API paths, and root MCP resource metadata by waleedlatif1 · Pull Request #9026 · simstudioai/sim
X Title: improvement(api): declare OAuth scopes in OpenAPI, JSON 404s for unknown API paths, and root MCP resource metadata by waleedlatif1 · Pull Request #9026 · simstudioai/sim
Description: Summary OpenAPI oauthBearer is now a standard oauth2 authorization-code scheme (authorize/token/refresh URLs, api:read / api:write / offline_access scopes) instead of http bearer with scopes only in prose Every generated operation's security names its least-privilege scope (oauthBearer: ["api:read"]), derived from the application operation's oauthScope — the same single source as x-oauth-scope Generator validation keys on scheme type oauth2 (not the oauthBearer name) and fails if an operation's scope isn't declared by the scheme's flow Docs code samples render an oauth2 scheme as Authorization: Bearer; the playground keeps its manual token field Dedicated MCP host serves its RFC 9728 metadata at the root /.well-known/oauth-protected-resource too — the fallback MCP clients try after the path-inserted URL (MCP authorization spec, Protected Resource Metadata Discovery). resource stays the MCP URL; the app host still has no root document New app/api/[[...segments]] returns a JSON 404 for unknown /api/* paths instead of the HTML not-found page, mirroring the existing /api/v2 fallback Compatibility Wire behavior is unchanged: OAuth tokens still go in Authorization: Bearer, x-oauth-scope and the document-level security are kept, the anonymous alternative on workflow execute is kept The declared OAuth flow matches what the authorization server issues today: authorization code + PKCE S256, unbound tokens (no resource), which is what /api/v2 accepts Docs: the API playground is disabled, so the oauth2 type adds no Authorize UI; code samples still lead with the API key Unknown /api/* paths stay 404, now as JSON; every existing route, the /api/v2 and /api/auth catch-alls, and next.config /api header rules are unaffected (Next only routes here when nothing more specific matches) Root metadata exists only on the dedicated MCP host, where that path was a 404; its resource is the MCP URL, same document as the path-inserted one Type of Change Improvement Testing scripts/openapi tests (generator + documents), host-routing.test.ts; confirmed the per-operation scope assertion fails with the derivation removed, and generation fails with a scope dropped from the scheme generate:openapi --check, check:api-validation:strict, check-api-contract-routes, docs tsc, lint Extended test-mcp-host-e2e.ts (CI cli group): no root metadata on the app host, JSON 404 for unknown /api GET/POST. The MCP-host metadata mapping is covered by host-routing.test.ts, not E2E: that group runs next dev, where proxy rewrites on the dedicated host 404 for every rewritten path (the existing /mcp → /api/mcp included; reproduced locally). Production serves the existing path-inserted URL through the same rewrite target check-openapi-specs, generate:cli-api --check (CLI client unchanged), check-unused-exports Full type-check, check:audits, and test suites left to CI Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing (new tests pass the test-audit authoring gate) No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary OpenAPI oauthBearer is now a standard oauth2 authorization-code scheme (authorize/token/refresh URLs, api:read / api:write / offline_access scopes) instead of http bearer with scopes only ...
X Description: Summary OpenAPI oauthBearer is now a standard oauth2 authorization-code scheme (authorize/token/refresh URLs, api:read / api:write / offline_access scopes) instead of http bearer with scopes only ...
Opengraph URL: https://github.com/simstudioai/sim/pull/9026
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:90add173-4a91-967b-716c-7309487d797c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E782:C876F:AB9F4D:ECE4DA:6AFB522C |
| html-safe-nonce | 61db9fee9aa543b6face11352574f1dda13d99a4a2a81ef3378a1ed3752d8f02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzgyOkM4NzZGOkFCOUY0RDpFQ0U0REE6NkFGQjUyMkMiLCJ2aXNpdG9yX2lkIjoiMzM5Mzg2MjkzODM4ODAyNTkwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d7e03cff488e7c1fcd08000b65289b04a1e209903a4228b9daa3f06a112da722 |
| hovercard-subject-tag | pull_request:4860830313 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/9026/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary OpenAPI oauthBearer is now a standard oauth2 authorization-code scheme (authorize/token/refresh URLs, api:read / api:write / offline_access scopes) instead of http bearer with scopes only ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width