RFC-0006: Extension Server Authentication #3238
Replies: 1 comment
-
|
📝 RFC Document Updated View changes: Commit History |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
📄 RFC Doc: 0006-extension-server-authentication.md
Extension Server Authentication
Authors: @LalitMaganti
Status: Adopted
Problem
RFC-0005 (Perfetto UI Server Extensions) defines a system where users can
configure HTTP(S) endpoints to serve Perfetto UI extensions (macros, SQL
modules, proto descriptors). These extension servers may require authentication
to access:
The authentication system needs to:
Decision
Implement authentication as part of the server configuration itself, using
per-server-type discriminated unions for auth options. Credentials are stored
inline with the server settings in localStorage, with secret fields annotated
via Zod metadata so they can be stripped when sharing server configurations.
Design
Authentication Per Server Type
Authentication is configured when adding or editing a server in Settings. Each
server type (GitHub, HTTPS) has its own set of supported auth mechanisms,
modeled as discriminated unions.
GitHub servers:
nonegithub_patHTTPS servers:
nonehttps_basichttps_apikeyhttps_ssoStorage
Credentials are stored inline with the server configuration in the Perfetto
settings system (localStorage). There is no separate credential store.
Secret fields (PAT, passwords, API keys) are annotated with
.meta({secret: true})in the Zod schema. This metadata is used to stripsecrets when generating shareable server URLs.
Request Construction
All URL construction and auth header injection happens in a single
buildFetchRequest()function that takes a server configuration and a resourcepath, producing a URL and
RequestInit:GitHub PAT:
api.github.com/repos/.../contents/...) instead ofraw.githubusercontent.comAuthorization: token {pat}headerAccept: application/vnd.github.raw+jsonheaderGitHub (no auth):
raw.githubusercontent.comdirectly (avoids GitHub API rate limits)HTTPS Basic:
Authorization: Basic {base64(username:password)}headerHTTPS API Key:
bearer→Authorization: Bearer {key}x_api_key→X-API-Key: {key}custom→{customHeaderName}: {key}HTTPS SSO:
credentials: 'include'to the fetch request to send cookiesSSO Cookie Refresh
For SSO-authenticated servers, a 403 response may indicate an expired session
cookie. The UI handles this automatically:
onload, the browser has fresh cookiesThe iframe has a 10-second timeout. This flow is transparent to the user.
Server Addition Flow
Auth configuration happens upfront during server addition, not on-demand after
a 401/403. This is simpler and avoids the complexity of detecting auth
requirements at runtime.
Sharing Servers
Servers can be shared via URL (
?addServer=<base64>). When generating theshare URL, the
stripSecrets()function removes all fields annotated with.meta({secret: true}), replacing the auth with{type: 'none'}. Therecipient must configure their own credentials after importing.
Locked (Embedder-Configured) Servers
Embedder-configured servers (e.g., Google's internal server auto-added for
Googlers) are marked as
locked: true. Locked servers:Security Considerations
Credential Storage:
Browser's same-origin protection is the security boundary. This follows
industry practice (GitHub, VS Code, etc.).
User controls:
CORS requirements:
All HTTPS extension servers must set CORS headers:
SSO servers additionally need
Access-Control-Allow-Credentials: true.Future Work
UX (no manual token creation). Requires registering a Perfetto GitHub App.
on Google Cloud Storage or AWS S3.
💬 Discussion Guidelines:
Beta Was this translation helpful? Give feedback.
All reactions