Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(coderd/database/dbauthz): update RBAC for InsertWorkspaceApp#18223

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

Merged
DanielleMaywood merged 2 commits intomainfromdm-dbauthz-workspace-apps
Jun 4, 2025

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywoodDanielleMaywood commentedJun 4, 2025
edited
Loading

Closes#18210

Instead of usingResourceSystem as the resource for
InsertWorkspaceApp, we instead use the associated workspace (if it
exists), with the actionActionUpdate.

Instead of using `ResourceSystem` as the resource for`InsertWorkspaceApp`, we instead use the associated workspace (if itexists), with the action `ActionCreateAgent`. The decision to use thisaction is because everywhere where `InsertWorkspaceApp` is called isalso where `InsertWorkspaceAgent` is called. I don't think adding anextra action makes sense, and adding an extra resource also doesn't makesense.
Comment on lines +3858 to +3861
workspace, err := q.db.GetWorkspaceByAgentID(ctx, arg.AgentID)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
return database.WorkspaceApp{}, err
}
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this mean you can insert a workspace app for a non-existent agent ID?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

If you used a non-existent Agent ID, you would get past this check, correct. However, theagent_id field on the app is bothNOT NULL and has a foreign key mapping to a workspace agent so the insertion would always fail.

If you think we should tweak the logic slightly to ensure there is a valid agent then I'm happy to make that change 👍.

https://github.com/coder/coder/blob/9995a098d5f0816128d00f5ec01767bba0b76164/coderd/database/dump.sql#L2035
https://github.com/coder/coder/blob/9995a098d5f0816128d00f5ec01767bba0b76164/coderd/database/dump.sql#L3060-L3061

Copy link
Member

Choose a reason for hiding this comment

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

That's fair 👍 We could add an extra check for an agent with the given ID, but it does introduce an extra DB lookup. I'm not sure the extra round-trip gives us anything here.

@DanielleMaywoodDanielleMaywoodenabled auto-merge (squash)June 4, 2025 11:12
@DanielleMaywoodDanielleMaywood merged commit4d0fe20 intomainJun 4, 2025
38 checks passed
@DanielleMaywoodDanielleMaywood deleted the dm-dbauthz-workspace-apps branchJune 4, 2025 11:22
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJun 4, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@EmyrkEmyrkAwaiting requested review from Emyrk

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Replacerbac.ResourceSystem usage indbauthz.InsertWorkspaceApp
2 participants
@DanielleMaywood@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp