New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

miniflare

Package Overview
Dependencies
Maintainers
2
Versions
842
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

miniflare - npm Package Compare versions

Comparing version 3.20231218.0 to 3.20231218.1

34

dist/src/workers/core/entry.worker.js

@@ -16,3 +16,3 @@ // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs

// src/workers/core/entry.worker.ts
import { LogLevel, SharedHeaders } from "miniflare:shared";
import { HttpError, LogLevel, SharedHeaders } from "miniflare:shared";

@@ -23,2 +23,3 @@ // src/workers/core/constants.ts

ORIGINAL_URL: "MF-Original-URL",
PROXY_SHARED_SECRET: "MF-Proxy-Shared-Secret",
DISABLE_PRETTY_ERROR: "MF-Disable-Pretty-Error",

@@ -46,3 +47,4 @@ ERROR_STACK: "MF-Experimental-Error-Stack",

DURABLE_OBJECT_NAMESPACE_PROXY: "MINIFLARE_PROXY",
DATA_PROXY_SECRET: "MINIFLARE_PROXY_SECRET"
DATA_PROXY_SECRET: "MINIFLARE_PROXY_SECRET",
DATA_PROXY_SHARED_SECRET: "MINIFLARE_PROXY_SHARED_SECRET"
}, ProxyOps = {

@@ -783,9 +785,23 @@ // Get the target or a property of the target

// src/workers/core/entry.worker.ts
var encoder = new TextEncoder();
function getUserRequest(request, env) {
let originalUrl = request.headers.get(CoreHeaders.ORIGINAL_URL), upstreamUrl = env[CoreBindings.TEXT_UPSTREAM_URL], url = new URL(originalUrl ?? request.url);
let originalUrl = request.headers.get(CoreHeaders.ORIGINAL_URL), url = new URL(originalUrl ?? request.url), upstreamHost, proxySharedSecret = request.headers.get(
CoreHeaders.PROXY_SHARED_SECRET
);
if (proxySharedSecret) {
let secretFromHeader = encoder.encode(proxySharedSecret), configuredSecret = env[CoreBindings.DATA_PROXY_SHARED_SECRET];
if (secretFromHeader.byteLength === configuredSecret?.byteLength && crypto.subtle.timingSafeEqual(secretFromHeader, configuredSecret))
upstreamHost = url.host;
else
throw new HttpError(
400,
`Disallowed header in request: ${CoreHeaders.PROXY_SHARED_SECRET}=${proxySharedSecret}`
);
}
let upstreamUrl = env[CoreBindings.TEXT_UPSTREAM_URL];
if (upstreamUrl !== void 0) {
let path = url.pathname + url.search;
path.startsWith("/") && (path = `./${path.substring(1)}`), url = new URL(path, upstreamUrl);
path.startsWith("/") && (path = `./${path.substring(1)}`), url = new URL(path, upstreamUrl), upstreamHost = url.host;
}
return request = new Request(url, request), request.cf === void 0 && (request = new Request(request, { cf: env[CoreBindings.JSON_CF_BLOB] })), request.headers.delete(CoreHeaders.ORIGINAL_URL), request.headers.delete(CoreHeaders.DISABLE_PRETTY_ERROR), request;
return request = new Request(url, request), request.cf === void 0 && (request = new Request(request, { cf: env[CoreBindings.JSON_CF_BLOB] })), upstreamHost !== void 0 && request.headers.set("Host", upstreamHost), request.headers.delete(CoreHeaders.PROXY_SHARED_SECRET), request.headers.delete(CoreHeaders.ORIGINAL_URL), request.headers.delete(CoreHeaders.DISABLE_PRETTY_ERROR), request;
}

@@ -869,3 +885,9 @@ function getTargetService(request, url, env) {

let disablePrettyErrorPage = request.headers.get(CoreHeaders.DISABLE_PRETTY_ERROR) !== null;
request = getUserRequest(request, env);
try {
request = getUserRequest(request, env);
} catch (e) {
if (e instanceof HttpError)
return e.toResponse();
throw e;
}
let url = new URL(request.url), service = getTargetService(request, url, env);

@@ -872,0 +894,0 @@ if (service === void 0)

4

package.json
{
"name": "miniflare",
"version": "3.20231218.0",
"version": "3.20231218.1",
"description": "Fun, full-featured, fully-local simulator for Cloudflare Workers",

@@ -99,5 +99,5 @@ "keywords": [

"check:lint": "eslint \"{src,test}/**/*.ts\" \"scripts/**/*.{js,mjs}\" \"types/**/*.ts\"",
"lint:fix": "pnpm run lint -- --fix",
"lint:fix": "pnpm run check:lint --fix",
"types:build": "node scripts/types.mjs tsconfig.json && node scripts/types.mjs src/workers/tsconfig.json"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc