argotorg / argotorg/fe

fe-language-server: Reachable panics (DoS) and backtrace leakage via LSP inputs

Open
#1,124 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.7k
Forks
218
Avg merge
1d 4h
Merged PRs (30d)
8

Description

The LSP server (fe-language-server) can be driven into panic by client-controlled inputs and certain workspace contents. Panics cause process termination (Exit 101) and detailed backtraces are sent to the client, leaking internal paths and symbols. The primary causes are UTF‑8 boundary mishandling, missing bounds checks, and pervasive unwrap/expect on untrusted data.

Impact
- DoS: Server crashes on crafted requests or files.
- Info leak: Panic hook sends full backtraces to the LSP client (file paths, internal function names).
- Network exposure: TCP mode binds 0.0.0.0 by default, allowing unauthenticated remote triggering if exposed.

Observed Evidence (high level)
- Server exits with code 101 after LSP interactions.
- LSP window/logMessage contains “Panic occurred at …” with a full “Backtrace: …”.
- Example panic site (from logs): crates/hir/src/hir_def/module_tree.rs:104: no entry found for key.

Likely Root Causes (by area)

- UTF‑8 boundary misuse: crates/language-server/src/functionality/item_info.rs uses byte offsets with chars().nth(...) and unwrap, risking
panics on multi‑byte text.
- Missing bounds checks: crates/language-server/src/util.rs::to_offset_from_position trusts LSP positions; out‑of‑range indices lead to panics
downstream.
- Unwraps on untrusted data: crates/language-server/src/functionality/goto.rs and others call unwrap/expect after file I/O and URL conversions.
- Backtrace leakage: crates/language-server/src/logging.rs panic hook forwards full backtraces to clients.
- Insecure default bind: crates/language-server/src/main.rs binds TCP to 0.0.0.0.

Severity
High (DoS + information disclosure), especially if TCP is exposed.

Suggested Fixes
- UTF‑8 safety: In item_info.rs, find line starts via byte slices (rfind('\n')), ensure is_char_boundary, and remove unwrap.
- Input validation: In to_offset_from_position, clamp/validate line and character against the document; return LSP errors on invalid positions.
- Error handling: Replace unwrap/expect on client/FS/env data (e.g., in goto.rs) with fallible paths and structured ResponseErrors.
- Logging hygiene: Gate or redact panic backtraces in logging.rs (debug‑only or opt‑in).
- Network hardening: Default TCP bind to 127.0.0.1; document risks and require explicit opt‑in for public binds.

Affected Components

- crates/language-server/src/functionality/item_info.rs
- crates/language-server/src/util.rs
- crates/language-server/src/functionality/goto.rs
- crates/language-server/src/logging.rs
- crates/language-server/src/main.rs
- Potentially additional unwrap/expect sites across LSP handlers.

I can share details privately or open follow‑up PRs with minimal, targeted fixes .

I have attached the full log below.
```txt
[1] 82835
[1]+ Exit 101 RUST_LOG=info target/debug/fe-language-server tcp --port 4242 --timeout 10
[client] initialize sent
Content-Length: 159

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO Building local executor on spawned thread\n","type":4}}Content-Length: 128

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989┐actor task{}\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Constructing actor state\n","type":4}}Content-Length: 148

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Starting actor run loop\n","type":4}}Content-Length: 147

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Actor run loop started\n","type":4}}Content-Length: 147

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"14:tokio-runtime-workerINFO New client connected. Total clients: 1\n","type":4}}Content-Length: 122

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"14:tokio-runtime-worker┐service_ready{}\n","type":4}}Content-Length: 107

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"14:tokio-runtime-worker┘\n","type":4}}Content-Length: 137

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"14:tokio-runtime-worker┐request{method=\"initialize\"}\n","type":4}}Content-Length: 140
[client] initialized sent
[client] didOpen sent
[client] hover sent — expecting server panic/close due to UTF-8 bug…
[client] received:

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"14:tokio-runtime-workerINFO got LSP request: \"initialize\"\n","type":4}}Content-Length: 156

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"14:tokio-runtime-workerINFO Prepared future for LSP request: \"initialize\"\n","type":4}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Actor got a new message...\n","type":4}}Content-Length: 181

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO Handling request with key: MessageKey(ByMethod(\"initialize\"))\n","type":4}}Content-Length: 147

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO initializing language server!\n","type":4}}Content-Length: 490

{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"definitionProvider":true,"hoverProvider":true,"textDocumentSync":1,"workspace":{"fileOperations":{"didCreate":{"filters":[{"pattern":{"glob":"**/*"},"scheme":"file"}]},"didDelete":{"filters":[{"pattern":{"glob":"**/*"},"scheme":"file"}]},"didRename":{"filters":[{"pattern":{"glob":"**/*"},"scheme":"file"}]}},"workspaceFolders":{"changeNotifications":true,"supported":true}}},"serverInfo":{"name":"fe-language-server","version":"0.26.0"}}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Actor got a new message...\n","type":4}}Content-Length: 187

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO Handling notification with key: MessageKey(ByMethod(\"initialized\"))\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO language server initialized! recieved notification!\n","type":4}}Content-Length: 107

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"language server initialized!","type":3}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Actor got a new message...\n","type":4}}Content-Length: 214

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO Handling notification with key: MessageKey(ByTypeId(TypeId(0x6deae94c5ed22d4cc10f3fec19a3c1fd)))\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(c00)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1000)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1001)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(c01)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1002)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1003)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(c02)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1004)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(c03)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1005)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(c04)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1006)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(c05)): executing query\n","type":4}}Content-Length: 169

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_config_(Id(1007)): executing query\n","type":4}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO files_(Id(1401)): executing query\n","type":4}}Content-Length: 159

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO items_at_base_(Id(1800)): executing query\n","type":4}}Content-Length: 164

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO map_file_to_mod_impl(Id(800)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO path_(Id(800)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(800)): executing query\n","type":4}}Content-Length: 163

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO get_relative_path_(Id(1c00)): executing query\n","type":4}}Content-Length: 182

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO DatabaseKeyIndex(IngredientIndex(23), Id(2400)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO scope_graph_impl(Id(2400)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO module_tree_impl(Id(1401)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO kind_(Id(800)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO kind_(Id(801)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO path_(Id(801)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(801)): executing query\n","type":4}}Content-Length: 163

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO get_relative_path_(Id(1c01)): executing query\n","type":4}}Content-Length: 164

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO map_file_to_mod_impl(Id(801)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO kind_(Id(802)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO path_(Id(802)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(802)): executing query\n","type":4}}Content-Length: 163

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO get_relative_path_(Id(1c02)): executing query\n","type":4}}Content-Length: 164

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO map_file_to_mod_impl(Id(802)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO kind_(Id(803)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO path_(Id(803)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(803)): executing query\n","type":4}}Content-Length: 163

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO get_relative_path_(Id(1c03)): executing query\n","type":4}}Content-Length: 164

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO map_file_to_mod_impl(Id(803)): executing query\n","type":4}}Content-Length: 5128

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989ERROR Panic occurred at crates/hir/src/hir_def/module_tree.rs:104: no entry found for key\n22:LSP actor for 127.0.0.1:56989Backtrace:\n22:LSP actor for 127.0.0.1:56989Backtrace [{ fn: \"fe_language_server::logging::setup_panic_hook::{{closure}}\" }, { fn: \"std::panicking::rust_panic_with_hook\" }, { fn: \"std::panicking::begin_panic_handler::{{closure}}\" }, { fn: \"std::sys::backtrace::__rust_end_short_backtrace\" }, { fn: \"__rustc::rust_begin_unwind\" }, { fn: \"core::panicking::panic_fmt\" }, { fn: \"core::option::expect_failed\" }, { fn: \"core::option::Option::expect\" }, { fn: \" as core::ops::index::Index<&Q>>::index\" }, { fn: \"fe_hir::hir_def::module_tree::ModuleTree::tree_node\" }, { fn: \"fe_hir::hir_def::module_tree::ModuleTree::tree_node_data\" }, { fn: \"fe_hir::hir_def::module_tree::ModuleTree::children\" }, { fn: \"fe_hir::hir_def::item::TopLevelMod::child_top_mods\" }, { fn: \"fe_hir::lower::scope_builder::ScopeGraphBuilder::leave_item_scope\" }, { fn: \"fe_hir::lower::FileLowerCtxt::leave_item_scope\" }, { fn: \"::execute::inner_\" }, { fn: \"::execute\" }, { fn: \"salsa::function::execute::>::execute\" }, { fn: \"salsa::function::fetch::>::fetch_cold\" }, { fn: \"salsa::function::fetch::>::refresh_memo::{{closure}}\" }, { fn: \"core::option::Option::or_else\" }, { fn: \"salsa::function::fetch::>::fetch\" }, { fn: \"fe_hir::lower::scope_graph_impl::{{closure}}\" }, { fn: \"salsa::attach::Attached::attach\" }, { fn: \"salsa::attach::attach::{{closure}}\" }, { fn: \"std::thread::local::LocalKey::try_with\" }, { fn: \"std::thread::local::LocalKey::with\" }, { fn: \"salsa::attach::attach\" }, { fn: \"fe_hir::lower::scope_graph_impl\" }, { fn: \"fe_hir::hir_def::item::TopLevelMod::scope_graph\" }, { fn: \"::run_on_module\" }, { fn: \"fe_hir_analysis::analysis_pass::AnalysisPassManager::run_on_module\" }, { fn: \"::diagnostics_for_ingot\" }, { fn: \"fe_language_server::functionality::handlers::handle_files_need_diagnostics::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \" as act_locally::handler::AsyncMessageHandler>::handle::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"act_locally::actor::Actor::run::{{closure}}::{{closure}}::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"async_task::raw::RawTask::run::{{closure}}\" }, { fn: \"core::ops::function::FnOnce::call_once\" }, { fn: \" as core::ops::function::FnOnce<()>>::call_once\" }, { fn: \"std::panicking::catch_unwind::do_call\" }, { fn: \"__rust_try\" }, { fn: \"std::panic::catch_unwind\" }, { fn: \"async_task::raw::RawTask::run\" }, { fn: \"async_task::runnable::Runnable::run\" }, { fn: \"async_executor::State::run::{{closure}}::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"async_executor::State::run::{{closure}}\" }, { fn: \"async_executor::Executor::run::{{closure}}\" }, { fn: \"async_executor::LocalExecutor::run::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"futures_lite::future::block_on::{{closure}}\" }, { fn: \"std::thread::local::LocalKey::try_with\" }, { fn: \"std::thread::local::LocalKey::with\" }, { fn: \"futures_lite::future::block_on\" }, { fn: \"act_locally::actor::Actor::spawn_builder::{{closure}}\" }, { fn: \"std::sys::backtrace::__rust_begin_short_backtrace\" }, { fn: \"std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}\" }, { fn: \" as core::ops::function::FnOnce<()>>::call_once\" }, { fn: \"std::panicking::catch_unwind::do_call\" }, { fn: \"__rust_try\" }, { fn: \"std::thread::Builder::spawn_unchecked_::{{closure}}\" }, { fn: \"core::ops::function::FnOnce::call_once{{vtable.shim}}\" }, { fn: \"std::sys::pal::unix::thread::Thread::new::thread_start\" }, { fn: \"start_thread\", file: \"./nptl/pthread_create.c\", line: 442 }, { fn: \"__GI___clone3\", file: \"./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S\", line: 81 }]\n","type":4}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Actor got a new message...\n","type":4}}Content-Length: 196

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO Handling notification with key: MessageKey(ByMethod(\"textDocument/didOpen\"))\n","type":4}}Content-Length: 322

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO file opened: Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/home/shiro/workspace/fe/poc_ingot/src/lib.fe\", query: None, fragment: None }\n","type":4}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Actor got a new message...\n","type":4}}Content-Length: 214

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO Handling notification with key: MessageKey(ByTypeId(TypeId(0x25d5c4277b9b1df3624fd8d66913e8aa)))\n","type":4}}Content-Length: 180

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO file opened: \"/home/shiro/workspace/fe/poc_ingot/src/lib.fe\"\n","type":4}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989├─ INFO Actor got a new message...\n","type":4}}Content-Length: 214

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO Handling notification with key: MessageKey(ByTypeId(TypeId(0x6deae94c5ed22d4cc10f3fec19a3c1fd)))\n","type":4}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO files_(Id(1400)): executing query\n","type":4}}Content-Length: 159

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO items_at_base_(Id(1801)): executing query\n","type":4}}Content-Length: 164

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO map_file_to_mod_impl(Id(804)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO path_(Id(804)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(804)): executing query\n","type":4}}Content-Length: 163

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO get_relative_path_(Id(1c04)): executing query\n","type":4}}Content-Length: 182

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO DatabaseKeyIndex(IngredientIndex(23), Id(2404)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO scope_graph_impl(Id(2404)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO module_tree_impl(Id(1400)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO kind_(Id(804)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO kind_(Id(805)): executing query\n","type":4}}Content-Length: 149

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO path_(Id(805)): executing query\n","type":4}}Content-Length: 161

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO containing_ingot_(Id(805)): executing query\n","type":4}}Content-Length: 163

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO get_relative_path_(Id(1c05)): executing query\n","type":4}}Content-Length: 164

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989INFO map_file_to_mod_impl(Id(805)): executing query\n","type":4}}Content-Length: 5128

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"22:LSP actor for 127.0.0.1:56989ERROR Panic occurred at crates/hir/src/hir_def/module_tree.rs:104: no entry found for key\n22:LSP actor for 127.0.0.1:56989Backtrace:\n22:LSP actor for 127.0.0.1:56989Backtrace [{ fn: \"fe_language_server::logging::setup_panic_hook::{{closure}}\" }, { fn: \"std::panicking::rust_panic_with_hook\" }, { fn: \"std::panicking::begin_panic_handler::{{closure}}\" }, { fn: \"std::sys::backtrace::__rust_end_short_backtrace\" }, { fn: \"__rustc::rust_begin_unwind\" }, { fn: \"core::panicking::panic_fmt\" }, { fn: \"core::option::expect_failed\" }, { fn: \"core::option::Option::expect\" }, { fn: \" as core::ops::index::Index<&Q>>::index\" }, { fn: \"fe_hir::hir_def::module_tree::ModuleTree::tree_node\" }, { fn: \"fe_hir::hir_def::module_tree::ModuleTree::tree_node_data\" }, { fn: \"fe_hir::hir_def::module_tree::ModuleTree::children\" }, { fn: \"fe_hir::hir_def::item::TopLevelMod::child_top_mods\" }, { fn: \"fe_hir::lower::scope_builder::ScopeGraphBuilder::leave_item_scope\" }, { fn: \"fe_hir::lower::FileLowerCtxt::leave_item_scope\" }, { fn: \"::execute::inner_\" }, { fn: \"::execute\" }, { fn: \"salsa::function::execute::>::execute\" }, { fn: \"salsa::function::fetch::>::fetch_cold\" }, { fn: \"salsa::function::fetch::>::refresh_memo::{{closure}}\" }, { fn: \"core::option::Option::or_else\" }, { fn: \"salsa::function::fetch::>::fetch\" }, { fn: \"fe_hir::lower::scope_graph_impl::{{closure}}\" }, { fn: \"salsa::attach::Attached::attach\" }, { fn: \"salsa::attach::attach::{{closure}}\" }, { fn: \"std::thread::local::LocalKey::try_with\" }, { fn: \"std::thread::local::LocalKey::with\" }, { fn: \"salsa::attach::attach\" }, { fn: \"fe_hir::lower::scope_graph_impl\" }, { fn: \"fe_hir::hir_def::item::TopLevelMod::scope_graph\" }, { fn: \"::run_on_module\" }, { fn: \"fe_hir_analysis::analysis_pass::AnalysisPassManager::run_on_module\" }, { fn: \"::diagnostics_for_ingot\" }, { fn: \"fe_language_server::functionality::handlers::handle_files_need_diagnostics::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \" as act_locally::handler::AsyncMessageHandler>::handle::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"act_locally::actor::Actor::run::{{closure}}::{{closure}}::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"async_task::raw::RawTask::run::{{closure}}\" }, { fn: \"core::ops::function::FnOnce::call_once\" }, { fn: \" as core::ops::function::FnOnce<()>>::call_once\" }, { fn: \"std::panicking::catch_unwind::do_call\" }, { fn: \"__rust_try\" }, { fn: \"std::panic::catch_unwind\" }, { fn: \"async_task::raw::RawTask::run\" }, { fn: \"async_task::runnable::Runnable::run\" }, { fn: \"async_executor::State::run::{{closure}}::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"async_executor::State::run::{{closure}}\" }, { fn: \"async_executor::Executor::run::{{closure}}\" }, { fn: \"async_executor::LocalExecutor::run::{{closure}}\" }, { fn: \" as core::future::future::Future>::poll\" }, { fn: \"futures_lite::future::block_on::{{closure}}\" }, { fn: \"std::thread::local::LocalKey::try_with\" }, { fn: \"std::thread::local::LocalKey::with\" }, { fn: \"futures_lite::future::block_on\" }, { fn: \"act_locally::actor::Actor::spawn_builder::{{closure}}\" }, { fn: \"std::sys::backtrace::__rust_begin_short_backtrace\" }, { fn: \"std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}\" }, { fn: \" as core::ops::function::FnOnce<()>>::call_once\" }, { fn: \"std::panicking::catch_unwind::do_call\" }, { fn: \"__rust_try\" }, { fn: \"std::thread::Builder::spawn_unchecked_::{{closure}}\" }, { fn: \"core::ops::function::FnOnce::call_once{{vtable.shim}}\" }, { fn: \"std::sys::pal::unix::thread::Thread::new::thread_start\" }, { fn: \"start_thread\", file: \"./nptl/pthread_create.c\", line: 442 }, { fn: \"__GI___clone3\", file: \"./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S\", line: 81 }]\n","type":4}}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the panic with fe-language-server tcp --port 4242 --timeout 10, then inspect the listed files: item_info.rs, util.rs, goto.rs, logging.rs, and main.rs. The work is done when crafted LSP inputs and workspace contents no longer terminate the server or expose full backtraces, and the default TCP bind is restricted as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, networking, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.