Skip to content

Commit 8af725a

Browse files
committed
Adding doc around parsing and YAML
RELEASE_NOTES=[DOCUMENTATION] Adding documentation about YAML entries and unsafe-keys Fixes #1940 Signed-off-by: Yolan Romailler <[email protected]>
1 parent 18bb5cc commit 8af725a

File tree

2 files changed

+42
-5
lines changed

2 files changed

+42
-5
lines changed

docs/commands/show.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ The secrets are split into 3 categories:
7878
will be parsed into (with `safecontent` enabled):
7979
```
8080
and: the keys are separated from their value by :
81-
password: ******
8281
where: the first line is the password
8382

8483

@@ -103,11 +102,30 @@ The secrets are split into 3 categories:
103102
bill-to: map[family:Doe given:Bob]
104103
date: 2001-01-23 00:00:00 +0000 UTC
105104
invoice: 83
106-
password: *****
107105
ship-to: map[family:Doe given:Bob]
108106
```
109107
Note how the `0123` is interpreted as octal for 83. If you want to store a string made of digits such as a numerical
110108
username, it should be enclosed in string delimiters: `username: "0123"` will always be parsed as the string `0123`
111109
and not as octal.
112110
111+
Both the key-value and the YAML format support so-called "unsafe-keys", which is a key-value that allows you to specify keys that should be hidden when using `gopass show` with `gopass config safecontent` set to true.
112+
E.g:
113+
```
114+
supersecret
115+
---
116+
age: 27
117+
secret: The rabbit outran the tortoise
118+
name: John Smith
119+
unsafe-keys: age,secret
120+
```
121+
will display (with safecontent enabled):
122+
```
123+
age: *****
124+
name: John Smith
125+
secret: *****
126+
unsafe-keys: age,secret
127+
128+
```
129+
unless it is called with `gopass show -n` that would disable parsing of the body, but still hide the password, or `gopass show -f` that would show everything that was hidden, including the password.
130+
113131
Notice that if the option `parsing` is disabled in the config, then all secrets are handled as plain secrets.

docs/features.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ secret1234
168168
otpauth://totp/golang.org:gopher?secret=ABC123
169169
```
170170

171-
Alternatively, you can use YAML (currently totp only):
171+
Alternatively, you can use YAML (notice the usage of the YAML separator to indicate it is a YAML secret):
172172

173173
```
174174
gopass show golang.org/gopher
@@ -377,7 +377,7 @@ Commands that support the `--store` flag:
377377

378378
Warning: YAML support is deprecated.
379379

380-
gopass supports directly editing structured secrets (simple key-value maps or YAML).
380+
gopass supports directly editing structured secrets (simple key-value maps):
381381

382382
```bash
383383
$ gopass generate -n foo/bar 12
@@ -393,11 +393,30 @@ $ gopass foo/bar
393393
baz: zab
394394
```
395395

396+
Or even YAML:
397+
```bash
398+
secret1234
399+
---
400+
multi: |
401+
text
402+
more text
403+
octal: 0123
404+
date : 2001-01-23
405+
bill-to: &id001
406+
given : Bob
407+
family : Doe
408+
ship-to: *id001
409+
```
410+
411+
Note that YAML entries currently support only one YAML block and **must start with the separator** `---` after the password and body text, if any. We do not support comments directly after the separator.
412+
396413
Please note that gopass will try to leave your secret as is whenever possible,
397414
but as soon as you mutate the YAML content through gopass, i.e. `gopass insert secret key`,
398-
it will employ an YAML marshaler that may alter the order and escaping of your
415+
it will employ a YAML marshaler that may alter the order and escaping of your
399416
entries.
400417

418+
See also [this doc entry](/docs/commands/show.md#parsing-and-secrets) for more information about parsing and how to disable it.
419+
401420
### Edit the Config
402421

403422
gopass allows editing the config from the command-line. This is similar to how git handles config changes through the command-line. Any change will be written to the configured gopass config file.

0 commit comments

Comments
 (0)