Project version
master (unreleased)
Project
driver
What happened?
Currently, because users can interact directly with the DependencyMap API in SimplicityHL, they can manually set the crate keyword to any path they want. This happens because the insert method allows adding the crate alias without throwing any validation errors.
Fix Suggestion
There are two potential ways to solve this problem:
- Add validation checks inside the
insert method to explicitly forbid using the crate keyword.
- Make the
insert method inside the DependencyMap struct private to external crates. Instead, implement the From<Vec<Remapping>> trait to handle conversions and perform all necessary validations at that stage.
Minimal reproduction steps
Using SDK, if you insert a mapping like the one below, it will be accepted by the compiler without any errors:
DependencyMap {
inner: [
Remapping {
context_prefix: CanonPath(
"/home/user/SimplicityHL/program",
),
drp_name: "crate",
target: CanonPath(
"/home/user/another-dir/",
),
},
],
}
Project version
master (unreleased)
Project
driver
What happened?
Currently, because users can interact directly with the
DependencyMapAPI in SimplicityHL, they can manually set thecratekeyword to any path they want. This happens because theinsertmethod allows adding thecratealias without throwing any validation errors.Fix Suggestion
There are two potential ways to solve this problem:
insertmethod to explicitly forbid using thecratekeyword.insertmethod inside theDependencyMapstruct private to external crates. Instead, implement theFrom<Vec<Remapping>>trait to handle conversions and perform all necessary validations at that stage.Minimal reproduction steps
Using SDK, if you insert a mapping like the one below, it will be accepted by the compiler without any errors: