
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
cy-jsonnet plugin is designed to auto generate cypress test definition and payload using jsonnet templates.
Core Ideas :
Dynamic test case generation can be advantageous and must have native support for randomizing specific properties for the test payload. Jsonnet offers a solution to this by providing support for native methods extension, allowing for customization according to individual requirements.
Jsonnet is a configuration language for application and tool developers developed by Google.
| Core ideas | ... |
|---|---|
| Generate config data | Open source (Apache 2.0) |
| Side-effect free | Familiar syntax |
| Organize, simplify, unify | Reformatter, linter |
| Manage sprawling config | Editor & IDE integrations |
| simple extension of JSON | Formally specified |
Pre-requisite : Make sure you have these softwares
go install github.com/google/go-jsonnet/cmd/jsonnet@latestCreate folder where you like to test this plugin.
Open your favorite terminal window and cd to the folder
Init Node project npm init -y
Install Cypress npm install cypress
Install TypeScript npm install -g typescript
Install this plugin npm install cy-jsonnet
Open Cypress npx cypress open
Add tsconfig.json to project tsc --init
Open VS Code code .
cypress.config.tsimport { interpretJsonnet } from "cy-jsonnet";
import { defineConfig } from "cypress";
import * as path from 'path';
const jsonnetFolder: string = "jsonnet";
const testDefinitionFolder: string = "testDefinition";
const testDataFolder: string = "testData";
let jsonnetPath = path.join('./cypress/support/', jsonnetFolder);
let testDefinitionPath = path.join('./cypress/fixtures/', testDefinitionFolder);
let testDataPath = path.join('./cypress/fixtures/', testDataFolder);
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
on("before:run", (details) => {
interpretJsonnet(jsonnetPath, '**/*.jsonnet', testDefinitionPath, false);
});
on("before:spec", (spec) => {
interpretJsonnet(jsonnetPath, `**/*${spec.fileName}*.jsonnet`, testDataPath, true);
});
return config;
},
experimentalRunAllSpecs: true,
experimentalInteractiveRunEvents: true
},
});
tsconfig.json{
"compilerOptions": {
"target": "es2021",
"lib": ["es2021", "dom"],
"moduleResolution": "node",
"resolveJsonModule": true,
"types": ["cypress", "node", "@cypress/grep"],
"strictNullChecks": true,
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"paths": {
"@fixtures/*": ["cypress/fixtures/*"],
"@support/*": ["cypress/support/*"]
}
},
"include": ["**/*.ts", "**/*.js"],
}
import * as testInfo from "@fixtures/testDefinition/person.json";
before(() => {
cy.fixture("testData/person.json").as("testData");
});
describe("Cypress Dynamic Tests Positive Scenario Examples", () => {
testInfo.positiveScenarios.forEach((testMetaData, index) => {
it(testMetaData.testDefinition.scenario, { tags: testMetaData.testDefinition.tags }, function (data: any = this.testData.positiveScenarios[index].testData) {
expect(true).equals(true);
// Add your test logic here
console.log(data.person);
});
});
});
describe("Cypress Dynamic Tests Negative Scenario Examples", () => {
testInfo.negativeScenarios.forEach((testMetaData, index) => {
it(testMetaData.testDefinition.scenario, { tags: testMetaData.testDefinition.tags }, function (data: any = this.testData.negativeScenarios[index].testData) {
expect(true).equals(true);
// Add your test logic here
console.log(data.person);
});
});
});
{
testDefinition(fileName, scenario, tags=[])::
{
scenario: scenario,
testIdentifier: std.md5(fileName+scenario),
tags: tags + [self.testIdentifier],
},
}
{
Person(firstName=std.native("fake")("{firstname}"),lastName=std.native("fake")("{lastname}"), ssn=std.native("fake")("{ssn}"), address={})::
{
person: {
firstName: firstName,
lastName: lastName,
ssn:ssn,
address: address,
},
},
Address(city='bellevue', state=std.native('fake')('{state}'))::
{
city: city,
state: state,
},
}
local model = import './lib/models.libsonnet';
local utils = import './lib/utils.libsonnet';
local DynamicTest(definition={}, data={}) = {
testDefinition: definition,
testData: if std.extVar('generateTestData') == 'true' then data else {},
};
{
positiveScenarios: [
// Person
DynamicTest(
definition=utils.testDefinition(fileName=std.thisFile,scenario='Verify person entity can be created with empty address', tags=['sanity', 'person']),
data=model.Person()
),
DynamicTest(
definition=utils.testDefinition(fileName=std.thisFile,scenario='Verify person is created with name=joe', tags=['sanity', 'regression']),
data=model.Person(firstName='joe')
)
],
negativeScenarios: [
DynamicTest(
definition=utils.testDefinition(fileName=std.thisFile,scenario='Verify person failed with empty firstname', tags=['regression', 'sanity']),
data=model.Person(firstName="",address=model.Address(city=std.native("fake")("{city}")))
),
DynamicTest(
definition=utils.testDefinition(fileName=std.thisFile,scenario='Verify person failed when ssn in null or empty', tags=['regression']),
data=model.Person(ssn="")
),
],
}
npx cypress open --e2eperson.cy.tsnpm install @cypress/grepcypress\support\e2e.tsimport registerCypressGrep from '@cypress/grep'
registerCypressGrep()
npx cypress run --env grepTags="sanity"
Contributions, issues and feature requests are welcome. Please email your ideas to us.
👤 Sumit Agarwal BD :email: Personal :email:
👤 Anoop Sasi BD :email: Personal :email:
This project exists thanks to all the people who contributed.
If you find this useful please spread the words :thumbsup:
This project is [MIT] licensed.
FAQs
Cypress plugin to generate json data from JSONNET files
We found that cy-jsonnet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.