Skip to content

Security audit 7368610658854629919 - #17

Merged
Tcode-Motion merged 2 commits into
mainfrom
security-audit-7368610658854629919
Aug 18, 2026
Merged

Security audit 7368610658854629919#17
Tcode-Motion merged 2 commits into
mainfrom
security-audit-7368610658854629919

Conversation

@Tcode-Motion

Copy link
Copy Markdown
Owner

Description

Please include a summary of the change, the motivation behind it, and which issue it fixes. Include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of Change

Please delete options that are not relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or compiler errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

google-labs-jules Bot and others added 2 commits August 18, 2026 07:35
- Replaced multiple unwraps that could cause panics with proper error mapping or grace handling, including: Zip extraction, Lexer EOF during escapes, XML parser element lookup, Web module server initialization/recv loop.
- Added null checks before un-wrapping C strings from FFI pointers in native_runtime APIs (structs, enums, models).
- Addressed Unsafe C-String manipulation panics in LLVM backend codegen.
- Replaced dangerous raw pointer dereferencing for `rusqlite::Connection` with a thread-local static `HashMap` approach, returning `i64` mapping IDs instead of pointers back to the runtime to avoid "use-after-free" vulnerabilities from untrusted user scripts.
- Removed manual extraction-directory bounding check in `untar_archive` which was causing functional extraction regression, as the `tar` library unpack handles slip traversal protections inherently.

Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>
- Revert manual directory traversal checks in `untar_archive` which incorrectly broke valid relative extraction paths (tar-rs already handles slip traversal checks internally via `unpack`).
- Refactor SQLite connection passing: Replaced highly insecure raw `Box::into_raw`/`Box::from_raw` pointer casts mapping connection handles as script integers, which allowed malicious or buggy scripts to perform arbitrary memory manipulation or use-after-frees. Now safely maintained via a `thread_local` `RefCell<HashMap>` mapped by `AtomicI64` IDs.
- Ensure all native API memory allocation functions (`ts_alloc_struct`, `ts_alloc_model`, `ts_alloc_enum`) check for null before converting C pointers back into strings, avoiding possible null dereference panics.
- Address unwraps when handling escape characters during compilation to correctly propagate the error on EOF.

Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>
@Tcode-Motion
Tcode-Motion merged commit e2f8aec into main Aug 18, 2026
6 checks passed
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.

1 participant