DopplerHQ / cli

The official CLI for interacting with your Doppler secrets and configuration.
https://docs.doppler.com
Apache License 2.0
221 stars 44 forks source link

Add support for secret visibility types #383

Closed apazzolini closed 1 year ago

apazzolini commented 1 year ago

This PR adds CLI support for secret visibility types. It:

Note that this should only be merged after visibility types has been released as the code expects the new properties from the API.

» doppler secrets
┌──────────────────────┬─────────────────────────────────────┬──────┐
│ NAME                 │ VALUE                               │ NOTE │
├──────────────────────┼─────────────────────────────────────┼──────┤
│ S1                   │ [RESTRICTED]                        │      │
│ S2                   │ v2                                  │      │
│ S3                   │ v3                                  │      │
└──────────────────────┴─────────────────────────────────────┴──────┘

» doppler secrets --visibility
┌──────────────────────┬────────────┬─────────────────────────────────────┬──────┐
│ NAME                 │ VISIBILITY │ VALUE                               │ NOTE │
├──────────────────────┼────────────┼─────────────────────────────────────┼──────┤
│ S1                   │ restricted │ [RESTRICTED]                        │      │
│ S2                   │ masked     │ v2                                  │      │
│ S3                   │ masked     │ v3                                  │      │
└──────────────────────┴────────────┴─────────────────────────────────────┴──────┘

» doppler secrets --visibility --raw
┌──────────────────────┬────────────┬──────────────┬────────────────┬──────────────────────────┬──────┐
│ NAME                 │ VISIBILITY │ VALUE        │ RAW VISIBILITY │ RAW VALUE                │ NOTE │
├──────────────────────┼────────────┼──────────────┼────────────────┼──────────────────────────┼──────┤
│ S1                   │ restricted │ [RESTRICTED] │ unmasked       │ ${stg.RESTRICTED_SECRET} │      │
│ S2                   │ masked     │ v2           │ masked         │ v2                       │      │
│ S3                   │ masked     │ v3           │ masked         │ v3                       │      │
└──────────────────────┴────────────┴──────────────┴────────────────┴──────────────────────────┴──────┘

» doppler secrets --json --raw | jq
{
  "S1": {
    "computed": null,
    "computedVisibility": "restricted",
    "note": "",
    "raw": "${stg.RESTRICTED_SECRET}",
    "rawVisibility": "unmasked"
  },
  "S2": {
    "computed": "v2",
    "computedVisibility": "masked",
    "note": "",
    "raw": "v2",
    "rawVisibility": "masked"
  },
  "S3": {
    "computed": "v3",
    "computedVisibility": "masked",
    "note": "",
    "raw": "v3",
    "rawVisibility": "masked"
  }
}

Closes ENG-6140