
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@formily-editor/extensions
Advanced tools
```javascript const fs = require('fs'); const path = require('path') const pick = require('lodash.pick')
const fs = require('fs');
const path = require('path')
const pick = require('lodash.pick')
const config = require('./config.json')
const supportedTypes = ["bool", "node", "enum", "string", "number"];
const getSchemaPropertyType = (name) => {
if (!supportedTypes.includes(name) || !name) return '';
let type = name;
switch (name) {
case "bool":
type = "boolean"
break
case "node":
type = "string"
break
case "enum":
type = "string"
break
default:
type = name
}
return type
};
const getXComponentType = (schemaProperty) => {
const { type } = schemaProperty;
if (type === 'number') return 'numberPicker'
if (type === 'boolean') return 'switch'
if (type === "string" ){
if(!Array.isArray(schemaProperty.enum))return 'input'
return schemaProperty.enum.length <=3 ? 'radio': 'select'
}
return ''
}
const buildSchemaProperty = (prop, defaultProp = {}) => {
const { type, description, required, defaultValue } = prop
const schemaPropertytype = getSchemaPropertyType(type.name)
let schemaProperty = {
type: schemaPropertytype,
title: description,
required,
};
if (defaultValue) {
schemaProperty.default = eval(`(${defaultValue.value})`)
}
if (type.name === "enum") {
const { value = [] } = prop.type;
schemaProperty.enum = value.map(item => ({
label: item.description || eval(`(${item.value})`),
value: eval(`(${item.value})`)
}));
}
schemaProperty["x-component"] = getXComponentType(schemaProperty)
return Object.assign(schemaProperty, defaultProp)
};
const template = content => {
return `
const extensionConfigs = ${content}
export default extensionConfigs
`
}
const transform = (apiSchema, supportedProps) => {
let schema = { type: "object", properties: {} }
if(apiSchema == undefined|| Object.keys(apiSchema).length === 0)return schema;
const props = pick(apiSchema, Object.keys(supportedProps))
Object.keys(props).forEach(propKey => {
const schemaProperty = buildSchemaProperty(props[propKey], supportedProps[propKey]);
if (schemaProperty) schema.properties[propKey] = schemaProperty
})
return schema
}
try {
const packagePath = require.resolve("@alifd/next")
const dirPath = path.join(path.dirname(packagePath), 'lib')
fs.readdir(dirPath, (err, files) => {
if(err){
throw new Error('read next error')
}
files.forEach(fileName => {
const fielPath = path.join(dirPath, fileName, 'api-schema.json')
if(fs.existsSync(fielPath)) {
const jsonStr = fs.readFileSync(fielPath, { encoding: 'utf-8' })
const jsonObj = JSON.parse(jsonStr)
if(!config[jsonObj.name])return
config[jsonObj.name].schema = transform(jsonObj.props, config[jsonObj.name])
}
})
fs.writeFileSync(path.join(path.dirname(__filename), 'config.ts'), template(JSON.stringify(config, null, 4)))
})
} catch (error) {
console.error(error)
}
FAQs
```javascript const fs = require('fs'); const path = require('path') const pick = require('lodash.pick')
The npm package @formily-editor/extensions receives a total of 7 weekly downloads. As such, @formily-editor/extensions popularity was classified as not popular.
We found that @formily-editor/extensions demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.