
Research
Malicious npm Package Brand-Squats TanStack to Exfiltrate Environment Variables
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.
directory-schema-validator
Advanced tools
Validate file system structure with an extension of JSON schema.
Validate directory structure and file contents with an extension of JSON schema.
Install using NPM or similar.
npm i directory-schema-validator
import {Validator, shorthandToJSONSchema} from 'directory-schema-validator';
// Helper function to generate JSON Schema from shorthand notation
const schema = shorthandToJSONSchema(['README.md']);
// the schema is the following object
{
"type": "object",
"properties": {
"files": {
"properties": {
"README.md": {
"type": "object"
}
},
"type": "object",
"required": [
"README.md"
]
}
}
}
// instantiate validator and validate schema against a path
const validator = new Validator();
const valid = validator.validate(schema, '.');
if (!valid) {
console.log(validator.errors);
}
This works by operating on a JSON object parsed from the file structure.
import { parse } from 'directory-schema-validator';
parse('.');
{
"path": "/workspaces/directory-schema-validator",
"name": "directory-schema-validator",
"size": 873,
"type": "directory",
"directories": {},
"files": {
"README.md": {
"path": "/workspaces/directory-schema-validator/README.md",
"name": "README.md",
"size": 873,
"type": "file",
"extension": ".md"
}
}
}
See the reference documentation for more information about the structure of the JSON and signatures of each method.
Note: Because this is JSONSchema, composition is allowed through keywords such as
allOforoneOf.
This library makes the keyword contents available. This keyword validates the contents of a file against an array of regex patterns.
{
"type": "object",
"properties": {
"files": {
"properties": {
"README.md": {
// START CUSTOM KEYWORD
"contents": [
{
"pattern": "directory-schema-validator",
"flags": "i"
}
],
// END CUSTOM KEYWORD
"type": "object"
}
},
"type": "object",
"required": [
"README.md"
]
}
}
}
Command line usage is available with the following commands: validate, shorthand, and parse. These commands correspond to the underlying interface.
npm install -g directory-schema-validator
directory-schema-validator --help
Note: The shorthand command uses glob and looks for actual files unlike the programmatic interface which only uses the strings.
FAQs
Validate file system structure with an extension of JSON schema.
The npm package directory-schema-validator receives a total of 215 weekly downloads. As such, directory-schema-validator popularity was classified as not popular.
We found that directory-schema-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
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.