
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Embed a reverse HTTP proxy into an existing ES6 application.
Features:
Does not yet support:
This is alpha-quality software and is not yet ready for use in production environments.
import Petra from 'petra';
const petra = new Petra();
petra.fetch('http://api.upstream.com/resource', (err, filename, created, expires) => {
// filename is the path to the local file containing the response
// created is the Date when the response was originally cached
// expires is the Date when the response will become stale
});
Where options is an Object containing:
The directory in which to store cached items, defaulting to /tmp/petra.
A function to generate cache keys, defaults to SHA-256.
The minimum TTL for cached items in seconds, defaults to 7 days.
The TTL for each response will be the minimum of this value or the max age of the upstream HTTP Cache-Control response header.
The interval in seconds between purges of stale content in the cache, defaults to 1 hour.
An array of accepted Content-Type upstream response headers, defaulting to the empty list and therefore allowing any.
The length of time to wait to connect to an upstream source, defaulting to 10000ms.
The length of time to wait, after connecting, for an upstream source to provide data, defaulting to 10000ms.
The User-Agent header for upstream requests, defaulting to lovell/petra.
Enable debug to help trace peer/upstream problems, defaults to false.
The function to call with debug messages, defaults to console.log.
Fetches a remote url, first checking with the local filesystem cache.
The callback function is passed (err, filename, created, expires) where:
err is the error, if any.filename is the path to the cached file containing the response.created is the Date when the response was originally cached.expires is the Date when the response will become stale.Removes cached copy of the URL, if any, from the local filesystem only.
Copyright 2015, 2016, 2017, 2018, 2019 Lovell Fuller.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
FAQs
ES6 reverse HTTP proxy with dogpile locking and filesystem-backed cache
We found that petra 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.