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

Commit9bdf31d

Browse files
committed
more comments
1 parenta891b43 commit9bdf31d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎coderd/idpsync/organization.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,13 @@ func (s AGPLIDPSync) SyncOrganizations(ctx context.Context, tx database.Store, u
115115
// Deleted orgs are omitted from this set.
116116
finalExpected:=expectedOrgIDs
117117
iflen(expectedOrgIDs)>0 {
118+
// If you pass in an empty slice to the db arg, you get all orgs. So the slice
119+
// has to be non-empty to get the expected set. Logically it also does not make
120+
// sense to fetch an empty set from the db.
118121
expectedOrganizations,err:=tx.GetOrganizations(ctx, database.GetOrganizationsParams{
119122
IDs:expectedOrgIDs,
120-
// Do not include deleted organizations
123+
// Do not include deleted organizations. Omitting deleted orgs will remove the
124+
// user from any deleted organizations they are a member of.
121125
Deleted:false,
122126
})
123127
iferr!=nil {
@@ -158,6 +162,10 @@ func (s AGPLIDPSync) SyncOrganizations(ctx context.Context, tx database.Store, u
158162
// Instead of failing the function, an error will be logged. This is to not bring
159163
// down the entire syncing behavior from a single failed org. Failing this can
160164
// prevent user logins, so only fatal non-recoverable errors should be returned.
165+
//
166+
// Inserting a user is privilege escalation. So skipping this instead of failing
167+
// leaves the user with fewer permissions. So this is safe from a security
168+
// perspective to continue.
161169
s.Logger.Error(ctx,"syncing user to organization failed as they are already a member, please report this failure to Coder",
162170
slog.F("user_id",user.ID),
163171
slog.F("username",user.Username),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp