Skip to content

[ENGINEERING] FFI boundary needs validation improvements #74

Description

@developerfred

Problem

The FFI module (src/ffi.rs) handles external calls but has limited input validation.

Security Concerns

  1. No bounds checking on pointer offsets
  2. No validation of call parameters from external sources
  3. 79 unwrap/expect calls that could panic

Current Issues

// src/ffi.rs - needs more validation
pub fn call_external(&mut self, contract: &[u8], fn_name: &str, args: &[u8]) {
    // No validation of contract bytecode
    // No validation of function name
    // No validation of args encoding
}

Recommendations

  1. Add validation layer for all FFI inputs
  2. Use Result<T, FfiError> instead of panicking
  3. Add integration tests with fuzzing
  4. Document safety requirements

Priority

High - Security vulnerability potential

Labels

  • engineering
  • security
  • ffi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions