Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@ovotech/avro-mock-generator
Advanced tools
Create mock messages from Avro schemas.
Call the generator with the schema:
import generateMsg from '@ovotech/avro-mock-generator'
const schema = {
type: 'record',
fields: [{ name: 'nbChickens', type: 'int' }],
}
console.log(generateData(schema));
// { nbChickens: 25672672 }
All fields will contain randomly generated data that respects their type.
An options
object can optionnaly be provide as the second argument.
Supported Options:
generators
: An key
/value
object of generator functions.
key
: the type
(or logicalType
)value
: should be a generator function (type, context) => value
where - type
: the content of the type
field in the schema, either a string
for simple type, or the type configuration for complex types - context
: an object with contextual data, including the generators
It is possible to override the default generators, and add support for extra types/logicalTypes by providingpickUnion
: Array of strings to drive which member of union type to choose. Can be the short name of fully namespaced names. When this option is not provided, the first element in the union will be chosenUse the Seeded
factory to create a version of the generator that will use deterministic randomness.
The factory will return a function with the same signature as the default generator.
Based on the Avro 1.9.0 specification.
options
parameter. If a logicalType
is missing a generator, data will be generated matching the underlying type
.enum
types, the first element of the array will always be chosen.Partial support for namespaces. Only union types are namespaced, unconditionally.
All contributions are welcome, just fork the repository then create a PR. Once merged we will release a new version.
Simply create a new release on master, with the tag being the new version (eg: 1.0.0).
FAQs
Generate mock messages from an avro schema
The npm package @ovotech/avro-mock-generator receives a total of 1,535 weekly downloads. As such, @ovotech/avro-mock-generator popularity was classified as popular.
We found that @ovotech/avro-mock-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 354 open source maintainers 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.