Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-2186

[3.0.4 Backport] Revocation of non-existent role causes replication panic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 3.0.4
    • 3.0.0, 3.0.3
    • SyncGateway
    • Security Level: Public
    • CBG Sprint 102
    • 1

    Description

      Originally reported on GitHub: https://github.com/couchbase/sync_gateway/issues/5610

      Attached unit test to reproduce this - seemingly, if a user's access to a document is revoked and they lose access to a role that doesn't exist (i.e. it's removed from their admin_roles without ever being created through PUT /db/_role/foo), replication can panic. Stack trace on release/3.0.3:

      2022/07/07 10:43:35 Unexpected panic: runtime error: invalid memory address or nil pointer dereference - stopping process
      goroutine 136 [running]:
      runtime/debug.Stack()
      	/Users/marks.polakovs@couchbase.com/sdk/go1.17.9/src/runtime/debug/stack.go:24 +0x65
      github.com/couchbase/sync_gateway/base.FatalPanicHandler()
      	/Users/marks.polakovs@couchbase.com/code/sync_gateway_3.0.1/godeps/src/github.com/couchbase/sync_gateway/base/util.go:1477 +0x39
      panic({0x4cc6900, 0x5945020})
      	/Users/marks.polakovs@couchbase.com/sdk/go1.17.9/src/runtime/panic.go:1038 +0x215
      github.com/couchbase/sync_gateway/auth.(*userImpl).ChannelGrantedPeriods(0xc0001a2100, {0xc0005407c0, 0x0})
      	/Users/marks.polakovs@couchbase.com/code/sync_gateway_3.0.1/godeps/src/github.com/couchbase/sync_gateway/auth/user.go:380 +0x29b
      github.com/couchbase/sync_gateway/db.(*Database).wasDocInChannelPriorToRevocation(0xc000a96390, {0xc0004f2b48, 0x4}, {0xc0005407c0, 0x37}, 0x0)
      	/Users/marks.polakovs@couchbase.com/code/sync_gateway_3.0.1/godeps/src/github.com/couchbase/sync_gateway/db/changes.go:331 +0x142
      github.com/couchbase/sync_gateway/db.(*Database).buildRevokedFeed.func1()
      	/Users/marks.polakovs@couchbase.com/code/sync_gateway_3.0.1/godeps/src/github.com/couchbase/sync_gateway/db/changes.go:244 +0x6f3
      created by github.com/couchbase/sync_gateway/db.(*Database).buildRevokedFeed
      	/Users/marks.polakovs@couchbase.com/code/sync_gateway_3.0.1/godeps/src/github.com/couchbase/sync_gateway/db/changes.go:200 +0x2e5
      
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              ben.brooks Ben Brooks
              marks.polakovs Marks Polakovs (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty