Skip to content

http_client: don't panic on invalid block regex; use RwLock#7243

Open
nghiphaam wants to merge 1 commit into
dani-garcia:mainfrom
nghiphaam:fix/http-block-regex-no-panic
Open

http_client: don't panic on invalid block regex; use RwLock#7243
nghiphaam wants to merge 1 commit into
dani-garcia:mainfrom
nghiphaam:fix/http-block-regex-no-panic

Conversation

@nghiphaam

Copy link
Copy Markdown

should_block_address_regex called Regex::new(&block_regex).unwrap() on every miss. Config validation (config.rs) already rejects invalid patterns, but a slip-through (e.g. test path or a race) would crash the server mid-request. Swap the unwrap() for a logged warning + skip-block fallback.

Also switched the cache from Mutex to RwLock so concurrent outbound HTTP checks don't serialise on the same lock when the regex is unchanged.

@BlackDex

Copy link
Copy Markdown
Collaborator

Is this AI generated? Since the claim is invalid. The regex is checked during startup and config update, so this never fails.

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.

2 participants