Repository navigation
Commit d7dbfe6
committed
feat: 2-arg access errors on header_enabled=True configurations
Per design decision 2026-05-17, the two-argument access(value, name)
is for header_enabled=False configurations only — it treats the input
as raw headerless ciphertext. For headered configurations, the header
itself identifies the configuration, so access(value) is the right call.
Previously access(value, name) silently skipped header stripping on the
explicit-configuration path, which made the API ambiguous (callers
couldn't tell whether the value they passed had a header or not) and
returned garbage when called on a headered config. Now it errors out
cleanly with a ValueError so callers can fix the call site instead of
seeing wrong decrypts.
Implementation: access(value, name) now checks header_enabled on the
named configuration and raises ValueError if true. The header-based
access(value) path strips the header itself before delegating to
_access_fpe, so _access_fpe always assumes raw headerless input and
the explicit_configuration flag is gone.
Added one error-condition test; existing 2-arg tests already used
header_enabled=False configs so no test rewrites were needed.
42 tests pass.1 parent e36a148 commit d7dbfe6
2 files changed
Lines changed: 24 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
152 | 158 | | |
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
157 | | - | |
| 163 | + | |
| 164 | + | |
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
| |||
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
188 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
189 | 201 | | |
190 | 202 | | |
191 | 203 | | |
192 | 204 | | |
193 | 205 | | |
194 | 206 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | 207 | | |
201 | | - | |
| 208 | + | |
202 | 209 | | |
203 | 210 | | |
204 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
| |||
0 commit comments