Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@envelop/validation-cache
Advanced tools
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
@envelop/validation-cache is a plugin for GraphQL that provides caching for validation results. This can significantly improve the performance of GraphQL servers by avoiding redundant validation of the same queries.
Validation Caching
This feature allows you to cache the results of GraphQL query validations. By using the `useValidationCache` plugin, you can avoid re-validating the same queries, thus improving performance.
const { envelop } = require('@envelop/core');
const { useValidationCache } = require('@envelop/validation-cache');
const getEnveloped = envelop({
plugins: [
useValidationCache(),
],
});
graphql-query-complexity is a package that helps in limiting the complexity of GraphQL queries to prevent abuse. While it doesn't cache validation results, it provides a way to control the resource usage of queries, which can complement the functionality of @envelop/validation-cache.
graphql-cost-analysis is another package that helps in analyzing and limiting the cost of GraphQL queries. It focuses on preventing expensive queries from being executed, which can be used alongside @envelop/validation-cache to ensure both performance and security.
graphql-depth-limit is a package that restricts the depth of GraphQL queries to prevent overly complex queries. This can be used in conjunction with @envelop/validation-cache to ensure that only queries of acceptable complexity are cached and executed.
@envelop/validation-cache
This plugins adds simple LRU caching to your validate
, to improve performance by caching the
validation result.
This plugins improves performance of validating by ~50% (based on benchmarks).
yarn add @envelop/validation-cache
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useValidationCache } from '@envelop/validation-cache'
const getEnveloped = envelop({
plugins: [
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
// ... other plugins ...
useValidationCache({
// options goes here
})
]
})
cache
Set this to pass in a cache instance. By default a new LRU cache is created using default max
and
ttl
.
FAQs
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
The npm package @envelop/validation-cache receives a total of 64,773 weekly downloads. As such, @envelop/validation-cache popularity was classified as popular.
We found that @envelop/validation-cache 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.