digitalocean / doctl

The official command line interface for the DigitalOcean API.
https://docs.digitalocean.com/reference/doctl/
Apache License 2.0
3.26k stars 396 forks source link

Update DOCTL to include new OpenSearch acl changes #1575

Closed bhardwajRahul closed 2 months ago

bhardwajRahul commented 2 months ago

This PR aims at adding support for OpenSearch acl option to database user

Command Details

Creates a new user for a database. New users are given a role of `normal` and are given an automatically-generated password.

To retrieve a list of your databases and their IDs, call `doctl databases list`.

Usage:
  doctl databases user create <database-cluster-id> <user-name> [flags]

Aliases:
  create, c

Examples:
The following example creates a new user with the username `example-user` for a database cluster with the ID `ca9f591d-f38h-5555-a0ef-1c02d1d1e35`: doctl databases user create ca9f591d-f38h-5555-a0ef-1c02d1d1e35 example-user

Flags:
      --acl topic:permission                      A comma-separated list of kafka ACL rules, in topic:permission format.
  -h, --help                                      help for create
      --mysql-auth-plugin caching_sha2_password   Sets authorization plugin for a MySQL user. Possible values: caching_sha2_password or `mysql_native_password`
      --opensearch-acl index:permission           A comma-separated list of OpenSearch ACL rules, in index:permission format.

Global Flags:
  -t, --access-token string   API V2 access token
  -u, --api-url string        Override default API endpoint
  -c, --config string         Specify a custom config file (default "/home/user/.config/doctl/config.yaml")
      --context string        Specify a custom authentication context name
      --http-retry-max int    Set maximum number of retries for requests that fail with a 429 or 500-level error (default 5)
      --interactive           Enable interactive behavior. Defaults to true if the terminal supports it (default true)
  -o, --output string         Desired output format [text|json] (default "text")
      --trace                 Show a log of network activity while performing a command
  -v, --verbose               Enable verbose output

Command Usage

doctl -t $token databases user create 70c35b01-6f6d-40e6-92ec-2bdssdca61a test-user --opensearch-acl log-*:read

Ouput

Name         Role      Password
test-user    normal    AsdnXXXXXXnkRv1
gitguardian[bot] commented 2 months ago

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | | | -------------- | ------------------ | ------------------------------ | ---------------- | --------------- | -------------------- | | [9440733](https://dashboard.gitguardian.com/workspace/501906/incidents/9440733) | Triggered | Generic Password | f4f5430dc03e23a877548799152b678ac4616cd1 | integration/database_user_create_test.go | [View secret](https://github.com/digitalocean/doctl/commit/f4f5430dc03e23a877548799152b678ac4616cd1#diff-e71f75657b55e2af4fc2e1e338bd4f414de19042df31f71fc0112df88f50b97bR120) |
🛠 Guidelines to remediate hardcoded secrets
1. Understand the implications of revoking this secret by investigating where it is used in your code. 2. Replace and store your secret safely. [Learn here](https://blog.gitguardian.com/secrets-api-management) the best practices. 3. Revoke and [rotate this secret](https://docs.gitguardian.com/secrets-detection/secrets-detection-engine/detectors/specifics/private_key_openssh#revoke-the-secret). 4. If possible, [rewrite git history](https://blog.gitguardian.com/rewriting-git-history-cheatsheet). Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data. To avoid such incidents in the future consider - following these [best practices](https://blog.gitguardian.com/secrets-api-management/) for managing and storing secrets including API keys and other credentials - install [secret detection on pre-commit](https://docs.gitguardian.com/ggshield-docs/integrations/git-hooks/pre-commit) to catch secret before it leaves your machine and ease remediation.

🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.