bulwark
bulwark copied to clipboard
Switch permission checks to use a HashSet
trafficstars
Description
The function currently uses a Vec to store and check allowed HTTP domains. This approach allows domains to be duplicated. While not likely to lead to issues, it's inelegant.
Suggestion
Switch the data structure from a Vec to a HashSet. This change is expected to reduce the complexity of the domain check from O(n) to O(1).
Benefits
- Slightly improved lookup performance for allowed HTTP domains.
- Avoid duplicated domain entries
Considerations
- Ensure compatibility and minimal impact on existing functionality.
This issue was prompted by a pull request review discussion: https://github.com/bulwark-security/bulwark/pull/253#discussion_r1554504230