- Notifications
You must be signed in to change notification settings - Fork906
feat: add API key scope to restrict access to user data#17692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -802,6 +802,11 @@ func New(options *Options) *API { | ||
PostAuthAdditionalHeadersFunc:options.PostAuthAdditionalHeadersFunc, | ||
}) | ||
workspaceAgentInfo:=httpmw.ExtractWorkspaceAgentAndLatestBuild(httpmw.ExtractWorkspaceAgentAndLatestBuildConfig{ | ||
DB:options.Database, | ||
Optional:false, | ||
}) | ||
Comment on lines +805 to +808 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. If this is only used once, we can probably go back to doing it inline, rather than declaring it up here. Just a nit | ||
// API rate limit middleware. The counter is local and not shared between | ||
// replicas or instances of this middleware. | ||
apiRateLimiter:=httpmw.RateLimit(options.APIRateLimit,time.Minute) | ||
@@ -1289,10 +1294,7 @@ func New(options *Options) *API { | ||
httpmw.RequireAPIKeyOrWorkspaceProxyAuth(), | ||
).Get("/connection",api.workspaceAgentConnectionGeneric) | ||
r.Route("/me",func(r chi.Router) { | ||
r.Use(workspaceAgentInfo) | ||
r.Get("/rpc",api.workspaceAgentRPC) | ||
r.Patch("/logs",api.patchWorkspaceAgentLogs) | ||
r.Patch("/app-status",api.patchWorkspaceAgentAppStatus) | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- Remove the api_key_scope column from the workspace_agents table | ||
ALTERTABLE workspace_agents | ||
DROP COLUMN IF EXISTS api_key_scope; | ||
-- Drop the enum type for API key scope | ||
DROPTYPE IF EXISTS agent_key_scope_enum; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Create the enum type for API key scope | ||
CREATETYPEagent_key_scope_enumAS ENUM ('all','no_user_data'); | ||
-- Add the api_key_scope column to the workspace_agents table | ||
-- It defaults to 'all' to maintain existing behavior for current agents. | ||
ALTERTABLE workspace_agents | ||
ADD COLUMN api_key_scope agent_key_scope_enumNOT NULL DEFAULT'all'; | ||
-- Add a comment explaining the purpose of the column | ||
COMMENT ON COLUMN workspace_agents.api_key_scope IS'Defines the scope of the API key associated with the agent.''all'' allows access to everything,''no_user_data'' restricts it to exclude user data.'; |
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.