Skip to content

Commit fc8c9a2

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

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
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 & 5 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
@@ -375,9 +375,7 @@ Commands that support the `--store` flag:
375375

376376
### Directly edit structured secrets aka. YAML support
377377

378-
Warning: YAML support is deprecated.
379-
380-
gopass supports directly editing structured secrets (simple key-value maps or YAML).
378+
gopass supports directly editing structured secrets (simple key-value maps):
381379

382380
```bash
383381
$ gopass generate -n foo/bar 12
@@ -393,11 +391,30 @@ $ gopass foo/bar
393391
baz: zab
394392
```
395393

394+
Or even YAML:
395+
```bash
396+
secret1234
397+
---
398+
multi: |
399+
text
400+
more text
401+
octal: 0123
402+
date : 2001-01-23
403+
bill-to: &id001
404+
given : Bob
405+
family : Doe
406+
ship-to: *id001
407+
```
408+
409+
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.
410+
396411
Please note that gopass will try to leave your secret as is whenever possible,
397412
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
413+
it will employ a YAML marshaler that may alter the order and escaping of your
399414
entries.
400415

416+
See also [gopass show doc entry](/docs/commands/show.md#parsing-and-secrets) for more information about parsing and how to disable it.
417+
401418
### Edit the Config
402419

403420
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)