hashicorp / sentinel-sdk

This SDK allows developers to extend Sentinel to source external information for use in their policies.
Mozilla Public License 2.0
51 stars 13 forks source link

framework: ensure result reflection is thread safe and immutable #45

Closed vancluever closed 4 years ago

vancluever commented 4 years ago

Concurrency scenarios that involve deep reflection of import namespaces with deep maps and slices can create problems during reflection of a Get result that ultimately create two problems:

This updates the internal reflectMap and reflectSlice methods to ensure that results of data transformation are being written to new maps and slices, instead of the existing ones. This corrects both issues - map writes are no longer happening concurrently to the same map, and original values are not being modified.