bulwark icon indicating copy to clipboard operation
bulwark copied to clipboard

Switch permission checks to use a HashSet

Open coderabbitai[bot] opened this issue 1 year ago • 0 comments
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

coderabbitai[bot] avatar Apr 06 '24 03:04 coderabbitai[bot]