-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
1.5.0-stable
What version of Foundryup are you on?
1.4.0
What command(s) is the bug in?
forge test
Operating System
macOS (Apple Silicon)
Describe the bug
Running forge test in a sandboxed environment causes a panic when Foundry attempts to read macOS system proxy configuration.
Error message:
The application panicked (crashed).
Message: Attempted to create a NULL object.
Location: /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/system-configuration-0.6.1/src/dynamic_store.rs:154
This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry
Relevant backtrace:
8: system_configuration::dynamic_store::SCDynamicStoreBuilder<T>::build
9: hyper_util::client::proxy::matcher::mac::with_system
10: hyper_util::client::proxy::matcher::Builder::from_system
11: hyper_util::client::proxy::matcher::Matcher::from_system
12: reqwest::async_impl::client::ClientBuilder::build
13: foundry_common::provider::runtime_transport::RuntimeTransport::reqwest_client
14: foundry_common::selectors::OpenChainClient::new
15: foundry_evm_traces::identifier::signatures::SignaturesIdentifier::new_with
16: foundry_evm_traces::identifier::signatures::SignaturesIdentifier::from_config
17: forge::cmd::test::TestArgs::run_tests_inner
18: forge::cmd::test::TestArgs::run_tests
19: forge::cmd::test::TestArgs::compile_and_run
Root cause:
When creating the OpenChainClient for signature lookups, Foundry builds a reqwest HTTP client. On macOS, this triggers reading system proxy settings via SCDynamicStore. In sandboxed environments (e.g., Cursor IDE sandbox, App Sandbox, or restricted shells), the SCDynamicStore API returns NULL, which causes the system-configuration crate to panic.
Reproduction steps:
- Run
forge testin a sandboxed macOS environment (e.g., within an IDE that sandboxes terminal commands) - Observe the crash
Workarounds:
- Use
--offlineflag to disable signature lookups - Run outside the sandbox
Note: Lower verbosity does not help - the crash occurs during initialization regardless of verbosity level.
Suggested fix
The code should gracefully handle the case where SCDynamicStore returns NULL instead of panicking. This could be done by:
- Catching the NULL case in
foundry_commonbefore building the reqwest client - Falling back to no proxy when system proxy detection fails
- Or using
reqwest'sno_proxy()option when in environments where system proxy detection might fail
This would make Foundry more robust when running in sandboxed/restricted environments on macOS.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status