Repository navigation
feat(behavioral): safe tarballs, install scripts, obfuscation and network detection - #236
Merged
ALLEN-AYODEJI merged 3 commits intoOct 21, 2026
Conversation
Closes DepRadarOrg#100, closes DepRadarOrg#99, closes DepRadarOrg#101, closes DepRadarOrg#102
|
@ushpraise Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the four behavioral-analysis issues in one scoped change.
src/behavioral/tarball.rs): downloadsdist.tarballthrough the polite client, verifiesdist.integrityas SHA-512 SRI, and unpacks in memory. 50 MB body/unpacked caps, 10k file cap, path-length cap; rejects absolute paths,.., backslashes, drive prefixes, NUL/non-UTF-8 paths, duplicates, symlinks, hard links and all other non-file entries. Nothing is executed.package.json#99 — install scripts (src/behavioral/scripts.rs):install_scripts(package_json) -> Vec<(String, String)>returnspreinstall,install,postinstallandprepare; each is wrapped as a medium-severityInstallScriptfinding onpackage.json.src/behavioral/obfuscation.rs): scores base64/hex blobs >200 chars,eval(/new Function(/atob(, high-entropy long literals and very long lines. Threshold is 4 (documented), so a minified-but-benign file is not flagged. Addsscan_treefor.js/.mjs/.cjs.src/behavioral/network.rs): flags curl/wget piped to a shell, HTTP(S) requests to raw IPv4s, and reads of npm/AWS/GitHub tokens,~/.sshand~/.npmrc. Includes a truncated snippet and follows local files invoked by lifecycle scripts without escaping the package root.behavioralintolib.rs, updatedPROGRESS.md, and documented the new severities indocs/severity.md.Tests
cargo test -p deprader --lib --locked— 224 passed, 0 failed (63 of them inbehavioral, including crafted malicious tar.gz archives: traversal, absolute/Windows paths, symlink, hard link, size bomb, file-count cap, duplicates; tarball integrity; install-script combinations; minified-benign vs obfuscated JS; one network test per pattern plus a benign build script).cargo clippy -p deprader --lib --locked -- -D warnings— pass.cargo fmt -p deprader -- --check— pass.git diff --check— pass.Pre-existing workspace blockers
cargo test --workspaceandcargo clippy --workspace --all-targetsdo not compile on the base commitd50acb2(whose CI is already red). The failures are outside this change and were left untouched to keep the PR scoped:contracts/deprader_router/src/lib.rscallsSelf::is_paused/Error::Pausedwithout definitions (merged pause feature lost its helpers), and the contract test imports a wasm file CI has not built.src/bin/depradar.rsreferenceswatch_packages/FakeCrawlerwithout imports and lacks aCommand::Watchmatch arm.These need a separate fix on
main; this PR's library target builds and tests cleanly.Closes #100
Closes #99
Closes #101
Closes #102