moss.feature (6993B)
1 Feature: command-line password management 2 3 Scenario: secrets are encrypted using age 4 Given I am using the example password store 5 Then "home/ebay.age" plaintext is "horsebattery" 6 7 Scenario: I can create a specified secret 8 Given I am using a temporary password store 9 When I store a secret for "home/ebay" with content "horsebattery" 10 Then "home/ebay.age" plaintext is "horsebattery" 11 12 Scenario: I can create a generated secret 13 Given I am using a temporary password store 14 When I generate a secret for "home/ebay" with length 20 15 Then I see a 20 character string 16 And "home/ebay.age" plaintext matches ^[a-zA-Z0-9]{20}$ 17 When I generate a secret for "home/fastmail" with length 12 18 And "home/fastmail.age" plaintext matches ^[a-zA-Z0-9]{12}$ 19 20 Scenario: it doesn't overwrite secrets without asking 21 Given I am using a temporary password store 22 When I store a secret for "home/ebay" with content "first" 23 Then I cannot store a secret for "home/ebay" with content "second" 24 And "home/ebay.age" plaintext is "first" 25 26 Scenario: it overwrites secrets when forced 27 Given I am using a temporary password store 28 And there is a secret for "home/ebay" with content "first" 29 And I force store a secret for "home/ebay" with content "second" 30 Then "home/ebay.age" plaintext is "second" 31 32 Scenario: I can view a secret 33 Given I am using the example password store 34 When I view the secret "home/ebay" 35 Then I see the string "horsebattery" 36 37 Scenario: I can view a secret as a QR code 38 Given I am using the example password store 39 When I view the secret "home/ebay" as QR code 40 Then I see a QR code for "horsebattery" 41 42 Scenario: I can list secrets 43 Given I am using the example password store 44 When I list the secrets 45 Then I see the string "work/gmail" 46 And I see the string "home/yahoomail" 47 And I see the string "home/ebay" 48 49 Scenario: I can delete a secret 50 Given I am using a temporary password store 51 And there is a secret for "home/ebay" 52 When I delete the secret for "home/ebay" 53 Then "home/ebay.age" does not exist 54 55 Scenario: I can delete a secret in a git-managed store 56 Given I am using a temporary password store 57 And the store is version-controlled 58 And there is a secret for "home/ebay" 59 When I delete the secret for "home/ebay" 60 Then "home/ebay.age" does not exist 61 And the removal of "home/ebay.age" is committed to version control 62 63 Scenario: I can search for a secret 64 Given I am using the example password store 65 When I search for "mail" 66 Then I see the string "work/gmail" 67 And I see the string "home/yahoomail" 68 69 Scenario: I can edit a secret 70 Given I am using a temporary password store 71 When I store a secret for "work/gmail" with content "staple correct" 72 When I edit "work/gmail" 73 Then the editor opens a temporary file containing "staple correct" 74 75 Scenario Outline: It encrypts to multiple recipients 76 Given I am using a temporary password store 77 And there are recipient files in different subtrees 78 | pathname | identity | 79 | family | me.key,partner.key,child.key | 80 | work | me.key,work.key | 81 | private | me.key | 82 83 When I store a secret for "private/medical" with content "120/70" 84 Then I can decrypt it with key "me.key" to "120/70" 85 And I cannot decrypt it with key "work.key" 86 87 When I store a secret for "work/report" with content "persevere" 88 Then I can decrypt it with key "me.key" to "persevere" 89 And I can decrypt it with key "work.key" to "persevere" 90 And I cannot decrypt it with key "child.key" 91 92 When I store a secret for "family/holiday" with content "isle of wight" 93 Then I can decrypt it with key "me.key" to "isle of wight" 94 And I can decrypt it with key "child.key" to "isle of wight" 95 And I cannot decrypt it with key "work.key" 96 97 Scenario: Secrets are stored in a git repo 98 Given I am using a temporary password store 99 And the store is version-controlled 100 When I store a secret for "home/ebay" with content "horsebattery" 101 Then the change to "home/ebay.age" is committed to version control 102 103 Scenario: I can do git operations on the store 104 Given I am using a temporary password store 105 And the store is version-controlled 106 When I store a secret for "home/ebay" with content "horsebattery" 107 Then I can run git "config --local -l" 108 And I see the string "core.bare=false" 109 110 Scenario: Sensible path to the store 111 Given I do not specify a store 112 Then the store directory is under XDG_DATA_HOME 113 114 Scenario: I can create a new store 115 Given I set MOSS_HOME to a unique temporary pathname 116 When I create a moss instance with identity "me.key" 117 Then the instance store exists 118 And the instance identity is "me.key" 119 And the store root has .recipients for the identity "me.key" 120 121 Scenario: I can create a new store with an encrypted key 122 Given I set MOSS_HOME to a unique temporary pathname 123 When I interactively create a moss instance with identity "encrypted.key" and passphrase "hello foo" 124 Then the instance store exists 125 And the instance identity is "encrypted.key" 126 And the store root has recipient "age1qqawnse9rfxjun2xmklk3r2pudlfjx0z4utjuwlmq7t9l60z9e2sap9vc8" 127 128 Scenario: Files in the store are not readable by other users 129 Given I set MOSS_HOME to a unique temporary pathname 130 When I create a moss instance with identity "me.key" 131 When I generate a secret for "home/ebay" with length 20 132 Then the store file "home/ebay.age" is readable only by me 133 And the store file "home/" is readable only by me 134 And my identity file is readable only by me 135 136 Scenario: I can create files with funny characters 137 Given I am using a temporary password store 138 When I store a secret for "home/with space" with content "horsebattery" 139 Then "home/with space.age" plaintext is "horsebattery" 140 141 When I store a secret for "silly/two\nlines" with content "horsebattery" 142 Then "silly/two\nlines.age" plaintext is "horsebattery" 143 144 Scenario: I can see usage information 145 When I run "moss help" 146 Then I see the string "Store and retrieve encrypted secrets" 147 And I see the string "Usage: moss \[command\] \[parameters\]" 148 And I see the string "add a secret to the store" 149 150 When I run "moss kxdcjghlsdkjfhgslkdjg" 151 Then I see the string "unrecognised command. See \"moss help\"" 152 153 Scenario: argument checking 154 When I run "moss show" 155 Then it shows a usage message for "show" 156 157 When I run "moss cat" 158 Then it shows a usage message for "cat" 159 160 Scenario: I can re-encrypt files 161 Given I am using a temporary password store 162 And there is a secret for "home/ebay" with content "horsebattery" 163 And there is a secret for "home/catfish" with content "chocolate" 164 When I add a recipient for the identity "partner.key" 165 And I re-encrypt the store 166 Then I can decrypt "home/catfish" with key "partner.key" to "chocolate"