Skip to content

CBG-4737: Remove basic auth command line flags #7679

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 13, 2025
Merged

CBG-4737: Remove basic auth command line flags #7679

merged 3 commits into from
Aug 13, 2025

Conversation

bbrks
Copy link
Member

@bbrks bbrks commented Aug 12, 2025

CBG-4737

Disable bootstrap.password, and remove username/password from bucket_credentials and db_credentials command line flags.

Actual output

$ ./sync_gateway --bootstrap.password abc sg_config.json                            
2025-08-12T21:22:04.582+01:00 ==== Couchbase Sync Gateway/() CE ====
2025-08-12T21:22:04.582+01:00 [ERR] Couldn't start Sync Gateway: error merging flags on to config: 1 errors:
command line flag "bootstrap.password" is no longer supported and must be removed Use config file to specify bootstrap password, or use X.509 cert/key path flags instead. -- base.FatalfCtx() at logging.go:151

$ ./sync_gateway --bucket_credentials '{"b1":{"password":"abc"}}'
2025-08-12T20:59:56.990+01:00 ==== Couchbase Sync Gateway/() CE ====
2025-08-12T20:59:56.990+01:00 [ERR] Couldn't start Sync Gateway: error merging flags on to config: 1 errors:
flag bucket_credentials for value "{\"b1\":{\"password\":\"abc\"}}" error: only X.509 cert/key paths are supported (fields: x509_cert_path, x509_key_path); username/password are not allowed: json: unknown field "password" -- base.FatalfCtx() at logging.go:151

Integration Tests

@Copilot Copilot AI review requested due to automatic review settings August 12, 2025 20:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes support for basic authentication command line flags to enhance security by forcing users to use X.509 certificate authentication or configuration files. The bootstrap.password flag is completely disabled and will error when used, while username/password fields are no longer accepted in bucket_credentials and database_credentials command line flags.

Key Changes:

  • Disables the bootstrap.password command line flag with helpful error messaging
  • Restricts bucket_credentials and database_credentials flags to only accept X.509 certificate paths
  • Updates test cases to use X.509 authentication instead of username/password combinations

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rest/config_flags.go Implements flag disabling mechanism and X.509-only credential parsing for command line flags
rest/config_flags_test.go Adds comprehensive tests for disabled flags and X.509-only credential validation
rest/config_test.go Updates test cases to use new X.509 credential structure
rest/main_test.go Removes unnecessary return statement in test case
base/bootstrap.go Refactors credential configuration to separate X.509 fields into dedicated struct

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Collaborator

@torcolvin torcolvin left a comment

Choose a reason for hiding this comment

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

@bbrks
Copy link
Member Author

bbrks commented Aug 13, 2025

This looks fine, note docs.couchbase.com/sync-gateway/current/deploy/command-line-options.html#available-options will need to be updated.

I filed a DOC ticket to update this page with 4.0

@bbrks bbrks merged commit 60d9909 into main Aug 13, 2025
42 checks passed
@bbrks bbrks deleted the CBG-4737 branch August 13, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants