[CLI] Rest client initialiser doesn't handle cases where authentication is optional

Description

What's the issue?
In 7.1.0 we introduced the ability to authenticate with the cluster using client certificate authentication (mTLS).

Part of this change, was that users could now either supply a username/password pair, or mTLS related flags (e.g. client cert/key).

Given these flags are all used when we create a REST client, the natural home for this validation was our rest_initiliser decorator (source).

We missed the case where it's valid to not supply any credentials at all; this results in the false positive where flag validation kicks in, requiring the user to supply a username/password when it's not necessary.

What's the fix?

  1. We should add a condition to the initializer that allows certain sub-commands to not have any authentication flags provided.

  2. We should verify that we haven't made any new assumptions that at least one of these authentication methods will be provided.

  3. We should go through the supported commands and make sure that - where required - authentication flags are made optional.

Is there a workaround?
Prior to the cluster being initialized, you can use placeholders for the username/password.

After the cluster has been initialized, the actual username/password must be supplied.

Affected sub-commands

  1. node-init

Components

Fix versions

Labels

Environment

None

Link to Log File, atop/blg, CBCollectInfo, Core dump

None

Release Notes Description

None

Activity

Show:

CB robot July 5, 2023 at 8:22 PM

Build couchbase-server-8.0.0-1341 contains couchbase-cli commit e0478f0 with commit message:
Don't require creds when not necessary

CB robot July 5, 2023 at 11:49 AM

Build couchbase-server-7.5.0-4573 contains couchbase-cli commit e0478f0 with commit message:
Don't require creds when not necessary

CB robot July 5, 2023 at 10:46 AM

Build couchbase-server-7.6.0-1192 contains couchbase-cli commit e0478f0 with commit message:
Don't require creds when not necessary

CB robot June 22, 2023 at 1:51 PM

Build couchbase-server-7.2.1-5810 contains couchbase-cli commit e0478f0 with commit message:
Don't require creds when not necessary

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Is this a Regression?

Yes

Triage

Untriaged

Due date

Story Points

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created April 5, 2023 at 3:55 PM
Updated December 9, 2024 at 2:58 PM
Resolved June 22, 2023 at 12:43 PM
Instabug