Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
wasm-ast-types
Advanced tools
edit ./scripts/fixture.ts
, for example:
// ./scripts/fixture.ts
export interface InstantiateMsg {
admin?: string | null;
members: Member[];
}
yarn test:ast
code ./scripts/test-output.json
We use the npm module ast-stringify
to strip out unneccesary props, and generate a JSON for reference.
You will see a File
and Program
... only concern yourself with the body[]
:
{
"type": "File",
"errors": [],
"program": {
"type": "Program",
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"exportKind": "type",
"specifiers": [],
"source": null,
"declaration": {
"type": "TSInterfaceDeclaration",
"id": {
"type": "Identifier",
"name": "InstantiateMsg"
},
"body": {
"type": "TSInterfaceBody",
"body": [
{
"type": "TSPropertySignature",
"key": {
"type": "Identifier",
"name": "admin"
},
"computed": false,
"optional": true,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"typeAnnotation": {
"type": "TSUnionType",
"types": [
{
"type": "TSStringKeyword"
},
{
"type": "TSNullKeyword"
}
]
}
}
},
{
"type": "TSPropertySignature",
"key": {
"type": "Identifier",
"name": "members"
},
"computed": false,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"typeAnnotation": {
"type": "TSArrayType",
"elementType": {
"type": "TSTypeReference",
"typeName": {
"type": "Identifier",
"name": "Member"
}
}
}
}
}
]
}
}
}
],
"directives": []
},
"comments": []
}
@babel/types
using the JSON as a referenceNOTE: 4 continued ideally you should be writing a test with your generator!
import * as t from '@babel/types';
export const createNewGenerator = () => {
return t.exportNamedDeclaration(
t.tsInterfaceDeclaration(
t.identifier('InstantiateMsg'),
null,
[],
t.tsInterfaceBody([
// ... more code ...
])
)
);
};
Checkout these related projects:
🛠 Built by Cosmology — if you like our tools, please consider delegating to our validator ⚛️
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
FAQs
CosmWasm TypeScript AST generation
The npm package wasm-ast-types receives a total of 18,557 weekly downloads. As such, wasm-ast-types popularity was classified as popular.
We found that wasm-ast-types 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.