Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function/stdlib: ZipmapFunc precise mark handling #96

Merged
merged 3 commits into from Apr 19, 2021

Conversation

apparentlymart
Copy link
Collaborator

ZipmapFunc can now handle marks on an element-by-element basis, to the extent that the cty type system is able to do so.

Since map keys can't be individually sensitive, any sensitive values in the keys list will aggregate on the map as a whole, but the individual value elements will have their marks preserved individually.

We previously didn't have unit tests for ZipmapFunc so this also includes some additional tests not related to marks, in order to cover the other interesting cases this function must handle.


Writing the tests for this also exposed some bugs in the cty package's handling of marks, and so I've fixed them as additional commits here.

Previously we were correctly pulling all of the inner marks up to the top
level but _not_ discarding the existing "marker", and so we ended up with
a marker with another marker nested inside it.

That's confusing and violates assumptions elsewhere, so now we'll also
discard the existing marker and retain only what it was wrapping, so that
there can only ever be one level of marker wrapper.
ZipmapFunc can now handle marks on an element-by-element basis, to the
extent that the cty type system is able to do so.

Since map keys can't be individually sensitive, any sensitive values in
the keys list will aggregate on the map as a whole, but the individual
value elements will have their marks preserved individually.

We previously didn't have unit tests for ZipmapFunc so this also includes
some additional tests not related to marks, in order to cover the other
interesting cases this function must handle.
@apparentlymart apparentlymart merged commit 35a1a3a into main Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant