Skip to content

Commit 0e3b9ff

Browse files
committed
lock more things
1 parent ad6ff52 commit 0e3b9ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

coderd/coderdtest/authorize.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ func (r *RecordingAuthorizer) Authorize(ctx context.Context, subject rbac.Subjec
661661
}
662662

663663
func (r *RecordingAuthorizer) Prepare(_ context.Context, subject rbac.Subject, action rbac.Action, _ string) (rbac.PreparedAuthorized, error) {
664+
r.RLock()
665+
defer r.RUnlock()
664666
if r.Wrapped == nil {
665667
panic("Developer error: RecordingAuthorizer.Wrapped is nil")
666668
}
@@ -673,6 +675,8 @@ func (r *RecordingAuthorizer) Prepare(_ context.Context, subject rbac.Subject, a
673675
}
674676

675677
func (r *RecordingAuthorizer) reset() {
678+
r.Lock()
679+
defer r.Unlock()
676680
r.Called = nil
677681
}
678682

@@ -706,6 +710,8 @@ func (f *fakePreparedAuthorizer) CompileToSQL(_ context.Context, _ regosql.Conve
706710
// LastCall is implemented to support legacy tests.
707711
// Deprecated
708712
func (r *RecordingAuthorizer) LastCall() *authCall {
713+
r.RLock()
714+
defer r.RUnlock()
709715
if len(r.Called) == 0 {
710716
return nil
711717
}

0 commit comments

Comments
 (0)