
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.
detailed-xml-validator
Advanced tools
Validate for XML schema and returns all the possible failures
Validate for XML schema and returns all the possible failures
This module uses it's own rule file which is different than XSD and looks more like XML data file. More features would be added in future versions. Currently, it just ensures frequency, type, range, value length, value pattern and null validations only on top of syntax check done by FXP.
If there is no syntax error, then this module reports all failures and don't exit on first faliure. So you can report all the issues in one go.
Sample Rules file
<?xml version = "1.0"?>
<students nillable="false">
<student repeatable minOccurs="1">
<:a>
<id length="6"></id>
</:a>
<firstname minLength="3" maxLength="10" nillable="false"></firstname>
<lastname minLength="3" maxLength="10" nillable="false"></lastname>
<nickname minLength="3" maxLength="10"></nickname>
<email pattern="[a-z0-9]+@schoolname.org" nillable="false"></email>
<age type="positiveInteger" min="9" max="19"></age>
<contact>
<phone length="10"></phone>
</contact>
<gender nillable="false" ></gender>
<marks>
<subject repeatable minOccurs="5" maxOccurs="6" checkBy="subjectValidator">
<name pattern="math|hindi|english|science|history"></name>
<!-- <name in="math,hindi,english,science,history"></name> -->
<score type="positiveDecimal"></score>
</subject>
</marks>
</student>
</students>
false
to mark an element mandatory. For lists, if minOccurs
is set to 1
, it means it can't be nillable.positiveInteger
can't have negative values. Following types are supported
Sample code
const Validator = require("detailed-xml-validator");
const options = {
unknownAllow: true,
boolean: ["true", "false"],
};
const validator = new Validator(rules, options);
validator.register("subjectValidator", (obj, path) => { //From v1.0.0
//return; //if no error
//return {} //return an error msg object
})
const failures = validator.validate(xmlStringData);
const originalXmlJsObj = validator.data;
console.log(`Found ${failures.length} issues`);
Sample Response
[
{ code: 'missing', path: 'root.d'} ,
{ code: 'unknown', path: 'root.f'}
{ code: 'minLength', path: 'root.a[0]', actual: '0', expected: 15 },
{
code: 'pattern',
path: 'root.a[0]',
actual: '0',
expected: '[a-z]+@gmail.com'
},
{ code: 'not a boolean', path: 'root.a[0]', value: 'yes' },
{ code: 'not a integer', path: 'root.f[2]', value: 'acbc' },
{ code: 'max', path: 'root.d', actual: 3.2, expected: 1.5 },
{ code: 'unexpected value in a map', path: 'root.b[1]', value: 'amit' }
]
FAQs
Validate for XML schema and returns all the possible failures
The npm package detailed-xml-validator receives a total of 1 weekly downloads. As such, detailed-xml-validator popularity was classified as not popular.
We found that detailed-xml-validator 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.
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.