
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
ctx-hook
is a TypeScript library that uses Node.js's asynchronous context tracking to enable property hooking that activates only within the asynchronous contexts of wrapper functions created by its API.
import { useGlobalCtxHook, useCtxHook } from 'ctx-hook'
// Create a context hook for `global.Date` to travel to 1 day ago.
const { wrap, dispose } = useGlobalCtxHook('Date', Date0 => {
const getTravelledNow = () => Date0.now() - 864e5
const getTravelledDate = () => new Date0(getTravelledNow())
const Date1 = new Proxy(Date0, {
construct(_, args) {
if (! args.length) return getTravelledDate()
return new Date0(...args as [])
},
apply() {
return getTravelledDate().toString()
},
get(_, prop: keyof DateConstructor) {
if (prop === 'now') return getTravelledNow
return Date0[prop]
}
})
return Date1
})
// Define a function that outputs the current time twice.
const fn = async () => {
console.log(Date.now())
await new Promise(resolve => setTimeout(resolve, 0))
console.log(Date.now())
}
// Wrap the function so that all access (sync or async) to `Date` will be hooked.
const fnTravelled = wrap(fn)
fnTravelled()
// Dispose the context hook to restore the original `Date`.
dispose()
FAQs
A TypeScript library for property hooking within functions.
The npm package ctx-hook receives a total of 2 weekly downloads. As such, ctx-hook popularity was classified as not popular.
We found that ctx-hook demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.