Coverage / crates/hub/src/secrets.rs 90.1%
91 of 101 lines run, 23 of 39 functions · run #537 on main · run missed
| 1 | //! Secrets for OxygenFlow jobs (hub spec §13.2, oxygenhub#107): named | |
| 2 | //! values kept per site, organisation and repository, sealed at rest | |
| 3 | //! under `keys/secrets.key`. A job gets only the secrets its pipeline | |
| 4 | //! declares with `secret "name" { mount-path … }`, as files Flow mounts | |
| 5 | //! (OxygenFlow spec §9), never in the environment; the hub masks each | |
| 6 | //! value in the job's log as it arrives. Inner levels override outer by | |
| 7 | //! name, as variables do. | |
| 8 | | |
| 9 | use crate; | |
| 10 | use crate; | |
| 11 | use crateShared; | |
| 12 | use FromRow; | |
| 13 | ||
| 14 | /// How many a level may hold. | |
| 15 | pub const MAX_PER_LEVEL: usize = 100; | |
| 16 | /// The longest value, in bytes. | |
| 17 | pub const MAX_VALUE: usize = 64 * 1024; | |
| 18 | /// Values shorter than this are not masked in logs: too many false hits. | |
| 19 | const MIN_MASKED: usize = 4; | |
| 20 | ||
| 21 | | |
| 22 | | |
| 23 | | |
| 24 | | |
| 25 | | |
| 26 | | |
| 27 | | |
| 28 | | |
| 29 | | |
| 30 | ||
| 31 | /// A secret's name, as a pipeline names it: 1 to 64 of `A-Z a-z 0-9 . _ -`. | |
| 32 | 8× | |
| 33 | 51× | |
| 34 | 8× | |
| 35 | ||
| 36 | 759× | pub async |
| 37 | 759× | |
| 38 | 759× | |
| 39 | 759× | |
| 40 | 759× | |
| 41 | 759× | |
| 42 | 759× | |
| 43 | ||
| 44 | /// Set a secret at a level, new or changed; `sealed` is the value sealed. | |
| 45 | 2× | pub async |
| 46 | 2× | |
| 47 | 2× | |
| 48 | 2× | |
| 49 | 2× | |
| 50 | 2× | |
| 51 | 2× | |
| 52 | 2× | |
| 53 | 2× | |
| 54 | 2× | |
| 55 | 2× | |
| 56 | 2× | |
| 57 | 2× | |
| 58 | 2× | |
| 59 | ||
| 60 | /// Remove a secret from a level; false when it was not there. | |
| 61 | 0× | pub async |
| 62 | 0× | |
| 63 | 0× | |
| 64 | 0× | |
| 65 | 0× | |
| 66 | 0× | |
| 67 | 0× | |
| 68 | 0× | |
| 69 | 0× | |
| 70 | ||
| 71 | /// Forget a level's secrets, when the organisation or repository goes. | |
| 72 | 1× | pub async |
| 73 | 1× | |
| 74 | 1× | |
| 75 | 1× | |
| 76 | ||
| 77 | /// A secret as a level sees it: where from, and whether an inner level | |
| 78 | /// sets the same name. The value stays sealed. | |
| 79 | | |
| 80 | | |
| 81 | | |
| 82 | | |
| 83 | | |
| 84 | | |
| 85 | | |
| 86 | ||
| 87 | /// Every secret a level sees, outermost first. | |
| 88 | 420× | pub async |
| 89 | 420× | |
| 90 | 420× | |
| 91 | 420× | |
| 92 | 756× | |
| 93 | 756× | |
| 94 | 11× | |
| 95 | 4× | |
| 96 | 4× | |
| 97 | 11× | |
| 98 | | |
| 99 | | |
| 100 | 420× | |
| 101 | 420× | |
| 102 | ||
| 103 | /// The values of the named secrets as a repository's jobs get them: | |
| 104 | /// `(name, value)` for each that is set and opens; names not set are | |
| 105 | /// left out, as are values sealed under another key. | |
| 106 | 160× | pub async |
| 107 | 160× | |
| 108 | 160× | |
| 109 | 160× | |
| 110 | 8× | |
| 111 | 2× | |
| 112 | 2× | |
| 113 | 2× | |
| 114 | 2× | |
| 115 | | |
| 116 | 160× | |
| 117 | 160× | |
| 118 | ||
| 119 | /// `text` with every secret value (and its standard base64) replaced by | |
| 120 | /// `***`, for a job's log. | |
| 121 | 3× | |
| 122 | 3× | |
| 123 | 4× | |
| 124 | 4× | |
| 125 | 1× | |
| 126 | 3× | |
| 127 | 3× | |
| 128 | 3× | |
| 129 | 3× | |
| 130 | 3× | |
| 131 | 3× | |
| 132 | | |
| 133 | 3× | |
| 134 | 3× | |
| 135 | ||
| 136 | 4× | |
| 137 | | |
| 138 | 4× | |
| 139 | 20× | |
| 140 | 54× | |
| 141 | 80× | |
| 142 | 80× | |
| 143 | 74× | |
| 144 | 74× | |
| 145 | 6× | |
| 146 | 6× | |
| 147 | | |
| 148 | | |
| 149 | 4× | |
| 150 | 4× | |
| 151 | ||
| 152 | | |
| 153 | | |
| 154 | | |
| 155 | | |
| 156 | | |
| 157 | 1× | |
| 158 | 1× | |
| 159 | 1× | |
| 160 | 1× | |
| 161 | 1× | |
| 162 | 1× | |
| 163 | |