0.1.1-nightly.0 • Published 2 years ago

@autosec/fetchhole v0.1.1-nightly.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

License TypeScript npm npm OpenSSF Scorecard Socket Badge

FetchHole

Elevate your Function as a Service (FaaS) development with enhanced security at the edge using @autosec/fetchhole. This package acts as a sophisticated drop-in replacement for the native fetch() function, tailored for developers who emphasize security in their web applications.

Features

  • Drop-in Replacement: Seamlessly integrates with existing code, replacing the native fetch() function.
  • Advanced Logging: Comprehensive logging capabilities for effective debugging.
  • Redirect Intercept: Customize redirect limits with a default of 20, as per the WHATWG Fetch specification.
  • Header Computation: Automatically computes and adds missing Content-Length and ETag headers. Choose your preferred ETag hash algorithm, with sha256 as the default.
  • Cache Support: Utilizes memory or disk caching via the Cache Web API. Compatible with Cloudflare's cache API for Cloudflare users.
  • Intercept for Alternate Routing: Ideal for scenarios like Cloudflare Workers Binding, allowing for alternate request routing.
  • Custom DNS Resolver Support: Designed for DNS level security applications like Zero Trust services. Compatible with any DoH resolver that uses 0.0.0.0 for blocking.
    • Direct IP Address Handling: Offers three modes for handling direct IP address access:
      • Full Block
      • Fail if No PTR Record (conducts a PTR record check, followed by a standard DNS check)
      • Allow

Installation

npm install @autosec/fetchhole

Usage

Simply import fetchhole and use it as a replacement for the native fetch() function.

import fetch from '@autosec/fetchhole';

// Use fetch as you normally would
fetch('https://example.com').then((response) => {
	// Your code here
});

Configuration

You can customize fetchhole with various options to suit your needs. Settings can be applied at the class instance level or as an fetch init property:

{
	cache: {
		type: CacheType.Default, // Defines cache type
		hashAlgorithm: 'sha256', // Choose a different ETag hash algorithm
		ignoreMethod: false,
		ignoreSearch: false,
		ignoreVary: false,
	},
	hardFail: true, // Determines failure handling
	logLevel: LoggingLevel.INFO, // Sets the level of logging
	redirectCount: 20, // Set custom redirect limit
}
0.1.1-nightly.17

2 years ago

0.1.1-nightly.16

2 years ago

0.1.1-nightly.15

2 years ago

0.1.1-nightly.14

2 years ago

0.1.1-nightly.13

2 years ago

0.1.1-nightly.12

2 years ago

0.1.1-nightly.11

2 years ago

0.1.1-nightly.10

2 years ago

0.1.1-nightly.9

2 years ago

0.1.1-nightly.8

2 years ago

0.1.1-nightly.7

2 years ago

0.1.1-beta.1

2 years ago

0.1.1-beta.0

2 years ago

0.1.1-nightly.6

2 years ago

0.1.1-nightly.4

2 years ago

0.1.1-nightly.3

2 years ago

0.1.1-nightly.2

2 years ago

0.1.1-nightly.1

2 years ago

0.1.1-nightly.0

2 years ago

0.0.1-nightly.33

2 years ago

0.0.1-nightly.32

2 years ago

0.0.1-nightly.31

2 years ago

0.0.1-nightly.30

2 years ago

0.0.1-nightly.29

2 years ago

0.0.1-nightly.28

2 years ago

0.0.1-nightly.27

2 years ago

0.0.1-nightly.26

2 years ago

0.0.1-nightly.25

2 years ago

0.0.1-nightly.24

2 years ago

0.0.1-nightly.23

2 years ago

0.0.1-nightly.22

2 years ago

0.0.1-nightly.21

2 years ago

0.0.1-nightly.20

2 years ago

0.0.1-nightly.19

2 years ago

0.0.1-nightly.18

2 years ago

0.0.1-nightly.17

2 years ago

0.0.1-nightly.16

2 years ago

0.0.1-nightly.15

2 years ago

0.0.1-nightly.14

2 years ago

0.0.1-nightly.13

2 years ago

0.0.1-nightly.12

2 years ago

0.0.1-nightly.10

2 years ago

0.0.1-nightly.9

2 years ago

0.0.1-nightly.8

2 years ago

0.0.1-nightly.7

2 years ago

0.0.1-nightly.6

2 years ago

0.0.1-nightly.5

2 years ago

0.0.1-nightly.4

2 years ago

0.0.1-nightly.3

2 years ago

0.0.1-nightly.0

2 years ago

0.0.1-beta.0

2 years ago