Skip to content

Add Hardhat · viem download and align download menus - #829

Open
ericglau wants to merge 4 commits into
OpenZeppelin:masterfrom
ericglau:feature/hardhat-viem-download
Open

Add Hardhat · viem download and align download menus#829
ericglau wants to merge 4 commits into
OpenZeppelin:masterfrom
ericglau:feature/hardhat-viem-download

Conversation

@ericglau

@ericglau ericglau commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a Hardhat project · viem download next to Hardhat project · ethers.js, for upgradeable and non-upgradeable contracts (viem uses @nomicfoundation/hardhat-viem / Ignition viem, or @openzeppelin/hardhat-upgrades/viem when upgradeable).
  • Keep the existing ethers Hardhat download action as download-hardhat; add download-hardhat-viem. Polkadot omits the viem option.
  • Bump the ethers upgradeable sample to @openzeppelin/hardhat-upgrades@^4.1.0.
  • Align Download menus across ecosystems with a shared DownloadOption component and flatter labels (e.g. Hardhat project · ethers.js / · viem, Foundry project, Stellar … package), dropping redundant “Simple to receive updates” copy while preserving load-bearing dependency notes. Other ecosystems get the same row layout and similar simplifications where appropriate.

Solidity Download menu example

image

Test plan

  • zip-hardhat-viem integration tests: unzip generated projects, npm ci + npm test (10/10), including upgradeable deployProxy via @openzeppelin/hardhat-upgrades/viem
  • zip-hardhat (ethers) integration tests still pass after upgrades ^4.1.0 bump (10/10)
  • Visibility gating checked in code: Governor/Stablecoin/RWA hide Hardhat options; Polkadot sets omitZipHardhatViem
  • UI build succeeds; Solidity Download menu shows Single file / Hardhat project · ethers.js / Hardhat project · viem / Foundry project in the shared row layout

@ericglau
ericglau requested review from a team as code owners July 30, 2026 19:41
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ae9a6f96-77b1-428d-8869-bf231a72042c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds Hardhat 3 + viem ZIP generation for standard and upgradeable contracts, validates generated projects, exposes a Solidity UI download option, and standardizes download menu rendering through a shared Svelte component.

Changes

Hardhat viem project generation

Layer / File(s) Summary
Viem project generator and environments
packages/core/solidity/src/zip-hardhat-viem.ts, packages/core/solidity/src/environments/..., packages/core/solidity/zip-env-hardhat-viem.*
Generates Hardhat configuration, viem deployments, upgradeable scripts, AVA tests, package metadata, and ZIP output for both project modes.
Generated project validation
packages/core/solidity/src/zip-hardhat-viem.test.ts, packages/core/solidity/src/zip-hardhat-viem.test.ts.md, packages/core/solidity/src/zip-hardhat.test.ts.md
Runs generated projects for multiple contract types and layouts, checks ZIP contents, snapshots generated files, and covers quoted string values.
Release metadata
.changeset/hardhat-viem-download.md
Documents the Hardhat + ethers and Hardhat + viem download options and generated dependencies.

Download UI

Layer / File(s) Summary
Shared download option UI
packages/ui/src/common/DownloadOption.svelte, packages/ui/src/common/styles/shared.css, packages/ui/src/{cairo,cairo_alpha,confidential,stellar,stylus,uniswap-hooks}/App.svelte
Adds a shared styled download option component and migrates existing download menus to it.
Solidity viem download control
packages/ui/src/solidity/App.svelte, packages/ui/src/solidity/overrides.ts, packages/ui/src/common/post-config.ts, packages/ui/src/polkadot/App.svelte
Adds conditional Hardhat + viem download generation, override support, post-configuration tracking, and Polkadot omission behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SolidityApp
  participant zipHardhatViem
  participant Hardhat3ViemZipGenerator
  User->>SolidityApp: Select Hardhat project · viem
  SolidityApp->>zipHardhatViem: Generate contract ZIP
  zipHardhatViem->>Hardhat3ViemZipGenerator: Build project files
  Hardhat3ViemZipGenerator-->>zipHardhatViem: Return ZIP archive
  zipHardhatViem-->>SolidityApp: Return project.zip
  SolidityApp-->>User: Download project.zip
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main changes: a new Hardhat viem download and updated download menus.
Description check ✅ Passed The description is directly aligned with the pull request and accurately describes the added viem download, UI changes, and test updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@socket-security

socket-security Bot commented Jul 30, 2026

Copy link
Copy Markdown

@socket-security

socket-security Bot commented Jul 30, 2026

Copy link
Copy Markdown

Caution

Review the following alerts detected in dependencies.

According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. It is recommended to resolve "Warn" alerts too. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Block Medium
Potential security risk (AI signal): npm @nomicfoundation/hardhat-ignition is 75.0% likely risky

Notes: This module is not overtly malicious, but it creates a high-impact security risk by using execSync with a shell command string that directly interpolates a caller-provided filePath without sanitization or safe argument handling. If filePath can be influenced by an attacker, this can enable arbitrary command execution (command injection). Refactor to use non-shell execution (e.g., spawn with args) and validate/quote inputs appropriately.

Confidence: 0.75

Severity: 0.70

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/@nomicfoundation/hardhat-ignition@3.1.8

ℹ Read more on: This package | This alert | What are AI-detected potential security risks?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system identified potential security problems in this package. It is advised to review the package thoroughly and assess the potential risks before installation. You may also consider reporting the issue to the package maintainer or seeking alternative solutions with a stronger security posture.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@nomicfoundation/hardhat-ignition@3.1.8. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Potential security risk (AI signal): npm hardhat is 85.0% likely risky

Notes: This module is straightforward telemetry logic but presents notable supply-chain/privacy risk: it takes arbitrary JSON from the command line and transmits it to a third-party analytics endpoint, while also embedding a hardcoded analytics API secret. In test/subprocess mode it avoids network exfiltration but still writes the untrusted payload to an environment-controlled file path. There is no clear evidence of covert malware (e.g., backdoor, reverse shell), but the embedded secret and unconditional handling of arbitrary payload content make it suspicious and should be reviewed for data minimization and secret management.

Confidence: 0.85

Severity: 0.72

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/hardhat@3.11.1

ℹ Read more on: This package | This alert | What are AI-detected potential security risks?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system identified potential security problems in this package. It is advised to review the package thoroughly and assess the potential risks before installation. You may also consider reporting the issue to the package maintainer or seeking alternative solutions with a stronger security posture.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/hardhat@3.11.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm @smithy/core is 65.0% likely to have a medium risk anomaly

Notes: The code implements a conventional, well-structured event-stream unmarshalling pipeline with explicit handling for error, exception, and event message types. The primary security considerations are: potential exposure of header/body content through thrown errors, reliance on the deserializer contract (notably the $unknown flag), and ensuring that downstream consumers appropriately trust the deserialized payloads. In a supply-chain context, ensure that eventStreamCodec, deserializer implementations, and error handling are trusted and audited to avoid leaking sensitive metadata, and consider sanitizing error messages in production.

Confidence: 0.65

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/upgradeable/package-lock.jsonnpm/@openzeppelin/hardhat-upgrades@4.1.0npm/@smithy/core@3.31.1

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@smithy/core@3.31.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm esbuild is 90.0% likely to have a medium risk anomaly

Notes: The esbuild package uses a postinstall install.js script to download platform-specific binaries from registry sources and verify them via hashes. While hash verification reduces risk, the elevated postinstall action creates a potential code-execution surface if the script is tampered with. Audit install.js and its endpoints, ensure artifacts are strictly verified against known hashes, and test in controlled environments before deployment.

Confidence: 0.90

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/tsx@4.23.1npm/esbuild@0.28.1

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/esbuild@0.28.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm js-yaml is 65.0% likely to have a medium risk anomaly

Notes: The script functions as a straightforward JSON↔YAML translator CLI with standard error handling. The primary security concern is the use of yaml.loadAll without a safeLoad alternative, which could enable YAML deserialization risks if inputs contain crafted tags. To improve security, switch to a safe loader (e.g., yaml.safeLoadAll or equivalent) or ensure the library is configured to restrict risky constructors. Overall, no malware indicators were observed; the risk is confined to YAML deserialization semantics.

Confidence: 0.65

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/ava@6.4.1npm/js-yaml@3.15.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/js-yaml@3.15.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm ox is 62.0% likely to have a medium risk anomaly

Notes: This fragment is primarily a CPU-intensive proof-of-work/salt-mining implementation using worker-thread parallelism plus an async fallback. It includes input validation, structured error propagation, and abort handling, and it does not show classic malware behaviors (no network/file/process/persistence or dynamic execution in the snippet). The dominant security concern is potential resource-exhaustion/DoS if untrusted callers can control workerCount/count/chunkSize, and secondary concern is leakage of progress/rate metrics into application callbacks/logging. Overall: likely intended PoW functionality but potentially abuse-prone in the wrong threat model.

Confidence: 0.62

Severity: 0.50

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/viem@2.55.10npm/ox@0.14.33

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/ox@0.14.33. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm ox is 60.0% likely to have a medium risk anomaly

Notes: This module implements parallel WebAssembly computation using Node worker_threads and browser Web Workers, including dynamic worker script execution (Node eval:true and browser Blob URL). It communicates only via postMessage and does not show network exfiltration, credential theft, or persistence within this snippet. The main risks are supply-chain/execution boundary concerns from dynamic worker code and potential CPU/DoS impact if the mining parameters are attacker-influenced. Overall: likely intended for compute work, but should be reviewed and guarded with strict input controls and hardened worker creation.

Confidence: 0.60

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/viem@2.55.10npm/ox@0.14.33

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/ox@0.14.33. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm ox is 70.0% likely to have a medium risk anomaly

Notes: This dependency is a cross-platform worker harness that executes embedded WebAssembly to perform a “salt mining” computation and returns progress/results to the caller via message passing. In this file, there is no clear evidence of classic malware behaviors such as network exfiltration, credential theft, or filesystem/system sabotage. The most notable supply-chain/security concerns are dynamic code execution patterns (Node Worker with eval:true and browser Blob URL worker scripts) and the potential for CPU-intensive abuse (computational mining-like workload) if invoked in an unauthorized context or with adversarial parameters. Overall: moderate security risk driven by execution surface and availability impact rather than direct data-stealing.

Confidence: 0.70

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/viem@2.55.10npm/ox@0.14.33

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/ox@0.14.33. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm ox is 66.0% likely to have a medium risk anomaly

Notes: This dependency is a worker-based “salt mining”/proof-of-work compute engine that loads an embedded WebAssembly payload and runs a CPU-intensive loop in Node worker_threads or browser Web Workers, communicating progress and results via postMessage. There is no direct evidence in this fragment of network exfiltration, credential access, persistence, or system modification. The main security concerns are (1) dynamic worker code execution (Node worker eval:true and browser Blob URL execution) and (2) cryptomining-like resource consumption that can be abused for CPU exhaustion. The embedded WASM module itself should be reviewed to confirm it contains only the expected computation and no hidden side effects.

Confidence: 0.66

Severity: 0.55

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/viem@2.55.10npm/ox@0.14.33

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/ox@0.14.33. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm tar is 66.0% likely to have a medium risk anomaly

Notes: This module acts as a standard tar extraction wrapper using synchronous and asynchronous code paths. There is no evident malicious activity within this fragment. Security risk hinges on the behavior of the Unpack/UnpackSync implementation and how tar entries are written to disk (e.g., path traversal). No hardcoded secrets or network calls are present here. Recommend ensuring tar extraction handles path traversal and destination path sanitization in Unpack, and consider validating opt.file presence and type before streaming.

Confidence: 0.66

Severity: 0.56

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/ava@6.4.1npm/tar@7.5.22

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tar@7.5.22. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm undici is 75.0% likely to have a medium risk anomaly

Notes: The analyzed code appears to implement a standard in-memory cache batch operation flow (put/delete) with careful handling of response bodies by buffering and storing bytes for caching. No signs of malware, data exfiltration, backdoors, or obfuscated behavior were found. The primary security considerations relate to memory usage from buffering potentially large response bodies and ensuring robust validation within batch operations to prevent cache state corruption. Overall risk is moderate, driven by in-memory data handling rather than external communication.

Confidence: 0.75

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/@nomicfoundation/hardhat-viem@3.0.9npm/@nomicfoundation/hardhat-ignition-viem@3.1.6npm/@nomicfoundation/hardhat-ignition-ethers@3.1.6npm/@nomicfoundation/hardhat-ignition@3.1.8npm/@nomicfoundation/hardhat-ethers@4.0.15npm/hardhat@3.11.1npm/@openzeppelin/hardhat-upgrades@4.1.0npm/undici@6.28.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/undici@6.28.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm undici is 68.0% likely to have a medium risk anomaly

Notes: The analyzed code implements a conventional HTTP/WebSocket-like upgrade handler with proper input validation, abort signal integration, and asynchronous callback management. It does not exhibit malicious activity such as data exfiltration or backdoors. The deliberate onHeaders error path is consistent with protocol expectations to reject non-upgrade responses. Overall security risk remains low to moderate, contingent on integration context, but no indicators of malware or obfuscation are detected in this fragment.

Confidence: 0.68

Severity: 0.50

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/@nomicfoundation/hardhat-viem@3.0.9npm/@nomicfoundation/hardhat-ignition-viem@3.1.6npm/@nomicfoundation/hardhat-ignition-ethers@3.1.6npm/@nomicfoundation/hardhat-ignition@3.1.8npm/@nomicfoundation/hardhat-ethers@4.0.15npm/hardhat@3.11.1npm/@openzeppelin/hardhat-upgrades@4.1.0npm/undici@6.28.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/undici@6.28.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm undici is 65.0% likely to have a medium risk anomaly

Notes: The code is a focused error-handling helper for HTTP responses that safely parses small payloads to include in an error object. It includes protective measures (chunk limits, controlled parsing, microtask-based callbacks) but uses unusual, brittle content-type checks and suppresses stack traces for debugging concealment. There is no evidence of malicious activity, data exfiltration, or backdoors within this fragment. The main risk is potential silent data loss if payloads exceed the chunk limit or mismatched content-type handling leads to missing payloads, but this is a functional trade-off rather than malicious. Suggested improvements include robust content-type parsing, clearer error signaling when payload is truncated, and optional logging to aid debugging without exposing stack traces in production.

Confidence: 0.65

Severity: 0.58

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/@nomicfoundation/hardhat-viem@3.0.9npm/@nomicfoundation/hardhat-ignition-viem@3.1.6npm/@nomicfoundation/hardhat-ignition-ethers@3.1.6npm/@nomicfoundation/hardhat-ignition@3.1.8npm/@nomicfoundation/hardhat-ethers@4.0.15npm/hardhat@3.11.1npm/@openzeppelin/hardhat-upgrades@4.1.0npm/undici@6.28.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/undici@6.28.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm undici is 77.0% likely to have a medium risk anomaly

Notes: The script performs an in-place, lossy re-encoding of a local file from UTF-8 to Latin-1 and rewrites it without backups or validation. This is unsafe due to potential data loss and code corruption, and could be exploited to tamper with source files in a supply chain. It does not exhibit active malware behavior, but its destructive nature warrants removal or strict safeguards (backups, explicit intent, error handling).

Confidence: 0.77

Severity: 0.65

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/@nomicfoundation/hardhat-viem@3.0.9npm/@nomicfoundation/hardhat-ignition-viem@3.1.6npm/@nomicfoundation/hardhat-ignition-ethers@3.1.6npm/@nomicfoundation/hardhat-ignition@3.1.8npm/@nomicfoundation/hardhat-ethers@4.0.15npm/hardhat@3.11.1npm/@openzeppelin/hardhat-upgrades@4.1.0npm/undici@6.28.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/undici@6.28.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm undici is 63.0% likely to have a medium risk anomaly

Notes: The file package/lib/llhttp/llhttp-wasm.js functions as a wrapper around an embedded WASM payload responsible for HTTP parsing, with obfuscated/low-level operations and lazy decoding that defers real behavior to the embedded binary. The lack of integrity checks and the embedded executable raise risk, and the true malicious intent cannot be confirmed without extracting and inspecting the WASM payload and how downstream code instantiates it.

Confidence: 0.63

Severity: 0.55

From: packages/core/solidity/src/environments/hardhat-viem/upgradeable/package-lock.jsonnpm/@openzeppelin/hardhat-upgrades@4.1.0npm/undici@8.9.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/undici@8.9.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm undici is 68.0% likely to have a medium risk anomaly

Notes: The code performs an in-place re-encoding of a local file (undici-fetch.js) and overwrites it with latin1-encoded data. There is no evidence of exfiltration, backdoors, or network activity. However, the lack of validation, error handling, and the fact that it can corrupt or permanently alter a source file constitutes a nontrivial risk. In a supply-chain or extension context, such a script could be misused to tamper with code. It is not inherently malicious by itself but is risky and should be restricted or audited before typical usage in a build or runtime environment.

Confidence: 0.68

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/upgradeable/package-lock.jsonnpm/@openzeppelin/hardhat-upgrades@4.1.0npm/undici@8.9.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/undici@8.9.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm viem is 75.0% likely to have a medium risk anomaly

Notes: The code implements a cross-chain deposit flow with proper validations, artifact reads, and on-chain interactions. There is no evidence of hidden backdoors, data exfiltration, or malware. The main security considerations relate to token approval logic and correct configuration of flags to avoid granting excessive allowances. Overall, the module appears legitimate for a bridge deposit flow, with moderate risk primarily around configuration of approvals and correct handling of gas/fees.

Confidence: 0.75

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/viem@2.55.10

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/viem@2.55.10. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm ws is 75.0% likely to have a medium risk anomaly

Notes: The code implements a standard EventTarget-like mixin for wrapping event listeners and dispatching events to user callbacks. There are no suspicious patterns such as dynamic code execution, hardcoded secrets, or network activity. The risk is contingent on what the consumer does inside their handlers; the snippet itself does not introduce malware or data leakage mechanisms beyond normal event dispatch. Overall security risk is low in isolation.

Confidence: 0.75

Severity: 0.50

From: packages/core/solidity/src/environments/hardhat-viem/upgradeable/package-lock.jsonnpm/hardhat@3.11.1npm/viem@2.55.10npm/ws@8.21.1

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/ws@8.21.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Low
Potential code anomaly (AI signal): npm yargs is 65.0% likely to have a medium risk anomaly

Notes: The code fragment serves as a standard CLI command-definition utility with a notable security consideration: if an untrusted builder function is supplied, it can execute arbitrary code via the builder callback. There is no evidence of malware, exfiltration, or obfuscated techniques in this fragment. In trusted use, risk remains low; in contexts allowing untrusted inputs, this fragment requires strict input validation or sandboxing to mitigate arbitrary code execution. The recommended security posture is to avoid invoking untrusted builder callbacks or to constrain them to benign shapes and to sanitize or restrict what those builders can access.

Confidence: 0.65

Severity: 0.60

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/ava@6.4.1npm/yargs@17.7.3

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/yargs@17.7.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm yargs is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: packages/core/solidity/src/environments/hardhat-viem/package-lock.jsonnpm/ava@6.4.1npm/yargs@17.7.3

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/yargs@17.7.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/solidity/src/zip-hardhat-viem.test.ts`:
- Around line 214-225: Update the deployment-validation conditions in the test
around makeDeployCommand(c) and the subsequent “deployed to” assertion to check
c.constructorArgs.length === 0 instead of c.constructorArgs === undefined, so
zero-argument contracts represented by [] execute and validate deployment.

In `@packages/core/solidity/src/zip-hardhat-viem.ts`:
- Around line 199-213: Clone the imported JSON templates in getPackageJson and
getPackageLock before assigning c.license, then mutate and return the clone so
cached module objects remain unchanged across concurrent ZIP generations.
- Line 50: Run the configured formatter on the affected code in
zip-hardhat-viem.ts, including the line containing
spaceBetween(this.declareVariables(...)) and the additional reported range, and
commit the resulting Prettier-compliant formatting without changing behavior.
- Around line 207-210: Add the generated package-lock.json files for both
hardhat-viem environments referenced by getPackageLock: the standard package and
the upgradeable package. Generate them through the existing update-env flow and
include them in the template set so TypeScript compilation and runtime ZIP
generation can resolve both dynamic imports.
- Around line 163-165: Update the deployProxy generation in the relevant
proxy-kind generator to preserve the selected upgradeable mode, passing `{ kind:
"uups" }` when the selected mode is UUPS while retaining the existing
`unsafeAllow` option. Ensure non-UUPS deployments continue using the current
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d703a4df-faa5-4bba-9260-751d65e10d72

📥 Commits

Reviewing files that changed from the base of the PR and between 90100ee and 76d5ea7.

⛔ Files ignored due to path filters (6)
  • packages/core/solidity/src/environments/hardhat-viem/package-lock.json is excluded by !**/package-lock.json
  • packages/core/solidity/src/environments/hardhat-viem/upgradeable/package-lock.json is excluded by !**/package-lock.json
  • packages/core/solidity/src/environments/hardhat/package-lock.json is excluded by !**/package-lock.json
  • packages/core/solidity/src/environments/hardhat/upgradeable/package-lock.json is excluded by !**/package-lock.json
  • packages/core/solidity/src/zip-hardhat-viem.test.ts.snap is excluded by !**/*.snap
  • packages/core/solidity/src/zip-hardhat.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (23)
  • .changeset/hardhat-viem-download.md
  • packages/core/solidity/package.json
  • packages/core/solidity/src/environments/hardhat-viem/package.json
  • packages/core/solidity/src/environments/hardhat-viem/upgradeable/package.json
  • packages/core/solidity/src/environments/hardhat/upgradeable/package.json
  • packages/core/solidity/src/zip-hardhat-viem.test.ts
  • packages/core/solidity/src/zip-hardhat-viem.test.ts.md
  • packages/core/solidity/src/zip-hardhat-viem.ts
  • packages/core/solidity/src/zip-hardhat.test.ts.md
  • packages/core/solidity/zip-env-hardhat-viem.js
  • packages/core/solidity/zip-env-hardhat-viem.ts
  • packages/ui/src/cairo/App.svelte
  • packages/ui/src/cairo_alpha/App.svelte
  • packages/ui/src/common/DownloadOption.svelte
  • packages/ui/src/common/post-config.ts
  • packages/ui/src/common/styles/shared.css
  • packages/ui/src/confidential/App.svelte
  • packages/ui/src/polkadot/App.svelte
  • packages/ui/src/solidity/App.svelte
  • packages/ui/src/solidity/overrides.ts
  • packages/ui/src/stellar/App.svelte
  • packages/ui/src/stylus/App.svelte
  • packages/ui/src/uniswap-hooks/App.svelte
💤 Files with no reviewable changes (1)
  • packages/ui/src/common/styles/shared.css

Comment on lines +214 to +225
let command = `cd "${tempFolder}" && npm ci && npm test`;
if (c.constructorArgs === undefined) {
// only test deploying the contract if there are no constructor args needed
command += ` && ${makeDeployCommand(c)}`;
}

const exec = util.promisify(child.exec);
const result = await exec(command);

t.regex(result.stdout, /1 test passed/);
if (c.constructorArgs === undefined) {
t.regex(result.stdout, /deployed to/);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Execute deployment validation for zero-argument contracts.

constructorArgs is an array, including [] for MyContract, so === undefined is always false. The generated deploy scripts and Ignition modules are never run. Check c.constructorArgs.length === 0 instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/solidity/src/zip-hardhat-viem.test.ts` around lines 214 - 225,
Update the deployment-validation conditions in the test around
makeDeployCommand(c) and the subsequent “deployed to” assertion to check
c.constructorArgs.length === 0 instead of c.constructorArgs === undefined, so
zero-argument contracts represented by [] execute and validate deployment.

const argNames = c.constructorArgs.map(a => a.name);
return [
`test("${c.name}", async t => {`,
spaceBetween(this.declareVariables(c.constructorArgs), this.getDeployLines(c, argNames), this.getAssertions(c, opts)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Run the formatter before merging.

These ranges fail the configured Prettier ESLint rule.

Also applies to: 158-160

🧰 Tools
🪛 ESLint

[error] 50-50: Replace this.declareVariables(c.constructorArgs),·this.getDeployLines(c,·argNames),·this.getAssertions(c,·opts) with ⏎········this.declareVariables(c.constructorArgs),⏎········this.getDeployLines(c,·argNames),⏎········this.getAssertions(c,·opts),⏎······

(prettier/prettier)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/solidity/src/zip-hardhat-viem.ts` at line 50, Run the
configured formatter on the affected code in zip-hardhat-viem.ts, including the
line containing spaceBetween(this.declareVariables(...)) and the additional
reported range, and commit the resulting Prettier-compliant formatting without
changing behavior.

Source: Linters/SAST tools

Comment on lines +163 to +165
return unsafeAllowConstructor
? `upgradesApi.deployProxy("${c.name}", [${argsList}], { unsafeAllow: ['constructor'] })`
: `upgradesApi.deployProxy("${c.name}", [${argsList}])`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

ast-grep outline packages/core/solidity/src/zip-hardhat-viem.ts --view expanded
rg -n "deployProxy|upgradeable|kind: \"uups\"|kind:'uups'|kind: 'uups'" packages/core/solidity/src packages/core -g '*.ts' -g '*.js' -g '*.mjs' -g '*.cjs'
sed -n '130,200p' packages/core/solidity/src/zip-hardhat-viem.ts

Repository: OpenZeppelin/contracts-wizard

Length of output: 50386


🏁 Script executed:

sed -n '1,240p' packages/core/solidity/src/zip-hardhat-viem.ts
printf '\n--- TESTS ---\n'
sed -n '1,220p' packages/core/solidity/src/zip-hardhat-viem.test.ts
printf '\n--- SET UPGRADEABLE ---\n'
sed -n '1,120p' packages/core/solidity/src/set-upgradeable.ts

Repository: OpenZeppelin/contracts-wizard

Length of output: 16029


Preserve the selected proxy kind. UUPS examples currently emit deployProxy() without kind, so they fall back to the plugin’s default transparent proxy mode. Thread the selected upgradeable mode through the generator and pass { kind: "uups" } for UUPS deployments.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/solidity/src/zip-hardhat-viem.ts` around lines 163 - 165,
Update the deployProxy generation in the relevant proxy-kind generator to
preserve the selected upgradeable mode, passing `{ kind: "uups" }` when the
selected mode is UUPS while retaining the existing `unsafeAllow` option. Ensure
non-UUPS deployments continue using the current behavior.

Comment on lines +199 to +213
protected async getPackageJson(c: Contract): Promise<unknown> {
const { default: packageJson } = c.upgradeable
? await import('./environments/hardhat-viem/upgradeable/package.json')
: await import('./environments/hardhat-viem/package.json');
packageJson.license = c.license;
return packageJson;
}

protected async getPackageLock(c: Contract): Promise<unknown> {
const { default: packageLock } = c.upgradeable
? await import('./environments/hardhat-viem/upgradeable/package-lock.json')
: await import('./environments/hardhat-viem/package-lock.json');
packageLock.packages[''].license = c.license;
return packageLock;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Clone imported JSON templates before setting the license.

ESM caches these JSON imports. Mutating them lets concurrent ZIP generations overwrite one another’s license before serialization, producing archives with the wrong license. Deep-clone each template, then mutate the clone.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/solidity/src/zip-hardhat-viem.ts` around lines 199 - 213, Clone
the imported JSON templates in getPackageJson and getPackageLock before
assigning c.license, then mutate and return the clone so cached module objects
remain unchanged across concurrent ZIP generations.

Comment on lines +207 to +210
protected async getPackageLock(c: Contract): Promise<unknown> {
const { default: packageLock } = c.upgradeable
? await import('./environments/hardhat-viem/upgradeable/package-lock.json')
: await import('./environments/hardhat-viem/package-lock.json');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Commit the generated viem package-lock files.

This generator imports hardhat-viem/package-lock.json and hardhat-viem/upgradeable/package-lock.json, but neither file is included in this new template set. tsc/runtime ZIP generation cannot resolve these imports until the lockfiles produced by update-env are added.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/solidity/src/zip-hardhat-viem.ts` around lines 207 - 210, Add
the generated package-lock.json files for both hardhat-viem environments
referenced by getPackageLock: the standard package and the upgradeable package.
Generate them through the existing update-env flow and include them in the
template set so TypeScript compilation and runtime ZIP generation can resolve
both dynamic imports.

@ericglau

Copy link
Copy Markdown
Member Author

@SocketSecurity ignore-all
AI-heuristic alerts on established dependencies used by the generated sample projects; no known vulnerabilities.

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.

2 participants