
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.
@gatewayapps/react-form-validation
Advanced tools
React components for validating field data and providing visual feedback to users
npm install @gatewayapps/react-form-validation
No need to install a separate @types/... package for react-form-validation. The package is written in Typescript and the type definitions as included in with package published to npm.
The main pieces are the FormValidation component and FormValidationRule class. These items do the heavy lifting of making sure your field data is valid according to your rules. Below is a simple example of both being used:
import React, {Component} from 'react
import { FormValidation, FormValidationMessage, FormValidationRule } from '@gatewayapps/react-form-validation'
default class MyComponent extends Component {
constructor(props) {
super(props)
this.state = {
name: ''
}
}
render() {
const validators = [new FormValidationRule('name', 'isEmpty', false, 'Name is required')]
return (
<FormValidation validations={validators} data={this.state} onValidated={(isValid) => console.log('valid?', isValid)}>
{({ validate, validationErrors }) => (
<>
<input
type="text"
className={`form-control ${validationErrors['name'] ? 'is-invalid' : 'is-valid'}`}
name="name"
onChange={(e) => {
this.setState({ name: e.target.value })
validate()
}}
value={this.state.name}
required
autoFocus
aria-describedby="nameErrorBlock"
/>
<FormValidationMessage id="nameErrorBlock" validationErrors={validationErrors['name']} />
</>
)}
</FormValidation>
)
}
}
react-form-validation leverages the validator library. Check out their documentation for a full list of supported functions and their usage. In addition to validator, it is possible to add your own custom function for validating data.
const emails = [
"bob@fake.com",
"sally@fake.com",
"joe@fake.com"
]
const checkEmailAvailable = (value, emails) => {
if(!value || emails.includes(value) {
return false
}
return true
}
const validators = [new FormValidationRule('name', 'isEmpty', false, 'Name is required'),
new FormValidationRule('emailAddress', checkEmailAvailable, true, [emails]]
The FormValidationRule class is what the FormValidation component uses to verify the data being entered into your forms is valid. Any number of FormValidationRule instances can be passed into FormValidation. The definition of the class constructor is as follows:
FormValidationRule(nameOfProp, evaluationFn|evaluationString, isValid, validationMessage, evaluationArguments)
FormValidation class accepts React state as a property. nameOfProp specifies which prop within the state should be evaluatedfalse so that the validator knows that this data is invalid. Any number of args can be passed.<FormValidation validations={validators} data={this.state} onValidated={(isValid) => console.log('valid?', isValid)}>
{({ isValid, validate, validationErrors }) => (
return ...
)}
</FormValidation>
The FormValidation component is a render prop that wraps other components. It provides an isValid boolean, validate method and a validationErrors object that can be used inside the render prop. The definition of the component is as follows:
FormValidationRule instances(isValid: boolean, validationErrors: IValidationErrors) => voidFormValidation. Calling this function kicks off the validation according to the rules specified.<FormValidationMessage id="nameErrorBlock" validationErrors={validationErrors['name']} />
The FormValidationMessage component is an optional component that can be used to render the validation error message to the user. The definition of the component is as follows:
FAQs
React components for form field validation
The npm package @gatewayapps/react-form-validation receives a total of 8 weekly downloads. As such, @gatewayapps/react-form-validation popularity was classified as not popular.
We found that @gatewayapps/react-form-validation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.