Conversation
Greptile SummaryThis PR implements a plugin system for Steel using Key Changes:
Critical Issues Found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Main as steel/main.rs
participant PM as PluginManager
participant Lib as Plugin .so/.dll
participant API as Plugin API
participant Server as SteelServer
participant World as World
participant ChunkMap as ChunkMap
participant Wrapper as PluginChunkGeneratorWrapper
participant Plugin as Plugin Generator
Main->>PM: new()
Main->>PM: load_plugins_from_directory("plugins/")
PM->>Lib: load_from_file()
Lib-->>PM: PluginModule_Ref
PM->>Lib: get_metadata()
Lib-->>PM: PluginMetadata
PM->>Lib: get_chunk_generators()
Lib-->>PM: RVec<PluginChunkGenerator_TO>
PM->>PM: store in LoadedPlugin
Main->>PM: take_first_generator()
PM->>PM: Arc::try_unwrap()
PM-->>Main: Option<ChunkGeneratorType::Plugin>
Main->>Server: new_with_generator(generator)
Server->>World: new_with_generator(generator)
World->>ChunkMap: new_with_generator(generator)
ChunkMap->>ChunkMap: store in WorldGenContext
Note over ChunkMap: During chunk generation
ChunkMap->>Wrapper: fill_from_noise(chunk)
Wrapper->>Wrapper: create_ffi_chunk_access()
Wrapper->>Plugin: fill_from_noise(ffi_chunk)
Plugin->>API: set_relative_block(x, y, z, block)
API->>Wrapper: ChunkAccessWrapper::set_relative_block()
Wrapper->>ChunkMap: internal set_relative_block()
|
There was a problem hiding this comment.
Additional Comments (5)
-
steel-plugin-example/src/lib.rs, line 47 (link)logic:
assert!will panic and crash the server if the calculation producesy >= 16, which could happen due to floating point precision -
steel/src/plugin/mod.rs, line 118-132 (link)logic: consuming generators with
std::mem::takeandArc::try_unwrapmeans plugins can only be used once - if this is called multiple times, subsequent calls get empty generatorsis the intent to consume the generators so they can only be used once, or should plugins remain usable after initialization?
-
steel/src/plugin/mod.rs, line 79-80 (link)logic: loading plugins from untrusted
.so/.dll/.dylibfiles allows arbitrary code execution with full server privileges - plugins should be sandboxed or require explicit trust -
steel-core/src/chunk/plugin_chunk_generator.rs, line 45-62 (link)logic: no bounds checking on
x,y,z- plugins can write outside chunk boundaries, causing memory corruption or panics -
steel-plugin-example/src/lib.rs, line 20 (link)style: hardcoded block ID
1may not match actual stone ID in the registry - should query from registry or make configurable
18 files reviewed, 5 comments
|
This pull request has conflicts with the base branch "master". Please resolve those so we can test out your changes. |
have generate a basic implementation of plugin with abi_stable
things who are needed to discuss