
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
SpectraGet is a powerful Node.js library designed for validating request parameters for APIs. It provides an easy-to-use interface for validating various types of parameters, including strings, numbers, arrays, dates, emails, and more. SpectraGet helps you ensure that your API endpoints are robust and secure by validating request data against pre-defined rules.
Install the library using npm:
npm install spectraget
To use SpectraGet, simply import the library and define your API endpoints with the necessary validation rules.
const spectraget = require('spectraget');
// Define an endpoint with parameter validation rules
const params = [
{ name: 'key', type: 'string', mandatory: true, length: 32 },
{ name: 'id', type: 'int', mandatory: true, range: [17, 18] },
{ name: 'email', isEmail: true, mandatory: true },
{ name: 'password', isStrongPassword: true, mandatory: true },
{ name: 'date_of_birth', type: 'date', dateRange: ['2000-01-01', '2023-12-31'] }
]
// Request data to be validated
const requestData = {
key: '12345678901234567890123456789012',
id: 17,
email: 'example@example.com',
password: 'StrongP@ssword123',
date_of_birth: '2001-05-15'
};
// Validate the request data against the params rules
const validationResult = spectraget.validate(params, requestData);
if (validationResult) {
console.error(`Validation Error: ${validationResult.error}`);
} else {
console.log('Validation passed. Proceed with the request.');
}
validate(params, requestData)Validates the request data against the defined params rules.
params (Object): The params definition object with validation rules.requestData (Object): The request data object to be validated.null if validation passes.error and status_code if validation fails.You can easily add custom validation rules by extending the SpectraGet class and adding new methods. The validation rules can be applied dynamically based on your needs.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or additions.
FAQs
A simple library to check URL parameters for your APIs.
We found that spectraget demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

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.