Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@hadoku/worker-utils

Latest version: v2.0.1

Overview

Last scanned
23 Nov 2026
Published
23 Nov 2026
npm package Publisher: hadoku-user
33 Versions
7.0K Downloads

Scan summary

@hadoku/worker-utils was last scanned on 23 Nov 2026 at version 2.0.1. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 33 versions; the latest 5 were published within 5 days (19–23 Nov 2026).
  • Findings: No rules fired in version 2.0.1.
  • Downloads: 7,046 downloads.

Versions

33 versions published
Versions and the rules that fired in each
VersionPublishedStatus
2.0.1 LATEST 23 Nov 2026 No rules fired
2.0.0 22 Nov 2026 No rules fired
1.7.32 19 Nov 2026 No rules fired
1.7.31 19 Nov 2026 Not shown
1.7.30 19 Nov 2026 Not shown

No rules fired in 2.0.1

Findings

Findings for v2.0.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 2.0.1; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Worker Utilities - Quick Reference

Shared utilities for Cloudflare Workers. Generic, reusable patterns extracted from production workers.

Import: import { ... } from '@wolffm/worker-utils'


Files

workers/shared/
├── types.ts        # TypeScript type definitions
├── auth.ts         # Authentication middleware
├── context.ts      # Request context extraction
├── validation.ts   # Input validation
├── cors.ts         # CORS configuration
├── logging.ts      # Structured logging
├── masking.ts      # Data masking for safe logging
├── responses.ts    # HTTP response helpers
└── index.ts        # Barrel export

auth.ts

Edge-verified authentication:

A worker does NOT resolve keys. edge-router resolves the caller against its KV key registry, then stamps X-Hadoku-Tier alongside an X-Edge-Auth provenance header; createEdgeAuth verifies the provenance against EDGE_AUTH_SECRET before trusting the tier, and degrades to public when it doesn't verify. Tier priority: admin > service > friend > public. service is for worker-to-worker / sibling-app traffic.

Removed in 1.3.0: createHadokuAuth, HadokuAuthEnv, parseKeysFromEnv, parseKeysWithNames, validateKeyAndGetType. They read the ADMIN_KEYS / SERVICE_KEYS / FRIEND_KEYS env arrays, which were retired 2026-07-26 — so they had already stopped authenticating anyone. createEdgeAuth is a drop-in (same context shape, same extend option).

// Standard hadoku ecosystem auth:
import { createEdgeAuth } from '@wolffm/worker-utils';

app.use('*', createEdgeAuth());
//          ↑ verifies X-Edge-Auth, then trusts the edge-stamped X-Hadoku-Tier

// Generic helper (single-key-per-tier case only):
app.use(
  '*',
  createKeyAuth((env) => ({
    [env.SOME_SINGLE_KEY]: 'admin',
  }))
);

Functions:

  • createKeyAuth(keyMap, options?) - Simple key → userType mapping
  • createAuthMiddleware(config) - Custom auth logic
  • validateKeyAndGetType(key, adminKeys, friendKeys, serviceKeys?) - Validate key & return userType (4-arg form opts into the 'service' tier)
  • parseKeysFromEnv(jsonString) - Parse key config from env vars
  • getAuthContext(c) - Get auth from context
  • requireMinTier('friend') - Gate a route at a MINIMUM tier (public < guest < member < friend < service < wife < admin); every higher tier is admitted by rank
  • tierAtLeast(auth, 'admin') - Same rank check for an already-resolved auth context, for in-handler branching. Never compare auth.userType to a string
  • TIER_RANK / Tier - The rank table and tier union, shared by the edge gate and the in-worker gate
  • requireUserType([...]) - Removed 2026-07-25. Translate to requireMinTier(<lowest tier in the list>)

Adds to context: c.get('authContext') → { userType, isAdmin, isFriend, isPublic }


masking.ts

Mask sensitive data for logging:

logRequest('POST', '/session/create', {
  sessionId: maskSessionId(sessionId), // "1a2b3c4d5e6f7g8h"
  key: maskKey(authKey), // "admin-secre" (50%)
});

Functions:

  • maskKey(key, percentage?) - Mask key (show first 50% by default, no suffix)
  • maskSessionId(id) - Mask session ID (show first 16 chars, no suffix)
  • maskEmail(email) - Mask email (show first char + domain)
  • redactFields(obj, fields) - Redact sensitive fields from objects

Constants:

  • MASKING.KEY_PERCENTAGE - Percentage of key to show (0.5 = 50%)
  • MASKING.KEY_MIN_LENGTH - Minimum characters to show (4)
  • MASKING.SESSION_ID_PREFIX_LENGTH - Default session ID prefix (16)
  • SENSITIVE_FIELDS - Common sensitive field names

Examples:

maskKey('admin-secret-key-123'); // "admin-secre"
maskSessionId('1a2b3c4d5e6f7g8h9i0j'); // "1a2b3c4d5e6f7g8h"
maskEmail('john@example.com'); // "j***@example.com"

redactFields({ username: 'john', password: 'secret' }, ['password']);
// { username: 'john', password: '[REDACTED]' }

Extract common fields:

const { userId, sessionId } = extractUserContext(c);
const boardId = extractField(c, ['query:boardId', 'body:boardId'], 'main');

Functions:

  • extractUserContext(c) - Get userId, sessionId
  • extractField(c, sources, default?, transform?) - Single field from multiple sources
  • extractContext(c, config) - Multiple fields at once
  • extractPagination(c) - Get page, limit, offset
  • extractSorting(c) - Get sortBy, sortOrder
  • getRequestMetadata(c) - Get IP, userAgent, country, etc.

Source format: 'header:X-User-Id', 'query:boardId', 'body:title'


validation.ts

Validate request data:

const validation = validateFields(body, [
  { field: 'id', required: true, type: 'string' },
  { field: 'title', required: true, minLength: 1, maxLength: 200 },
]);
if (!validation.valid) return validationError(c, validation.errors);

Functions:

  • validateFields(data, rules) - Full validation with rules
  • requireFields(data, ['id', 'title']) - Quick required check
  • validateBody(rules) - Middleware for auto-validation
  • createValidator(rules) - Reusable validator function

CommonRules:

  • CommonRules.id() - UUID validation
  • CommonRules.title({ maxLength }) - String 1-200 chars
  • CommonRules.email(required) - Email pattern
  • CommonRules.url(required) - URL pattern
  • CommonRules.enum('status', ['active', 'inactive']) - Enum validation
  • CommonRules.array('tags', options) - Array validation
  • CommonRules.number('age', { min, max, integer }) - Number constraints

cors.ts

Standard Hadoku CORS:

app.use('*', createHadokuCors());

Functions:

  • createHadokuCors(additionalOrigins?) - Hadoku defaults + custom
  • createCorsMiddleware(config) - Full custom config
  • matchOrigin(origin, pattern) - Wildcard matching

Presets:

  • CORSPresets.hadoku - Production Hadoku origins
  • CORSPresets.development - Includes localhost
  • CORSPresets.production(origins) - Custom production
  • CORSPresets.publicApi - Public API (all origins)

logging.ts

Log requests and errors:

logRequest('GET', '/api/items', { userId, boardId });
logError('POST', '/api/items', 'Validation failed', { errors });

Functions:

  • logRequest(method, path, context?, level?) - Log HTTP requests
  • logError(method, path, error, context?) - Log errors
  • createLogger(config) - Custom logger instance
  • createRequestLogger(method, path, baseContext) - Request-scoped logger
  • startTimer() - Performance timing (timer.end(message, context))
  • redactFields(obj, fields) - Remove sensitive data

Constants:

  • SENSITIVE_FIELDS - Common sensitive field names (password, apiKey, token, etc.)

responses.ts

Standard HTTP responses:

return ok(c, { items });
return created(c, { item });
return badRequest(c, 'Missing field: id');
return notFound(c, 'Task');

Success:

  • ok(c, data, message?) - 200
  • created(c, data, message?) - 201
  • noContent(c) - 204

Errors:

  • badRequest(c, message, details?) - 400
  • unauthorized(c, message?) - 401
  • forbidden(c, message?) - 403
  • notFound(c, resource?) - 404
  • conflict(c, message, details?) - 409
  • serverError(c, message, details?) - 500
  • validationError(c, errors) - 400 with validation details

Health & Error Handling:

  • healthCheck(c, service, checks?) - Health check response
  • createHealthCheckHandler(service, config) - Health check handler factory
  • handleError(c, error, message) - Generic error handler
  • withErrorHandling(handler) - Async error wrapper

types.ts

Import types:

import type {
  UserType, // 'admin' | 'service' | 'friend' | 'public'
  AuthContext, // { userType, userId?, isAdmin, isFriend, isPublic }
  ValidationRule, // { field, required?, type?, minLength?, ... }
  ValidationResult, // { valid, errors }
  LoggerConfig, // { prefix?, minLevel?, includeTimestamp? }
  CORSConfig, // { origins, methods, allowedHeaders, ... }
} from '@wolffm/worker-utils';

Common Patterns

Minimal Worker
import { Hono } from 'hono';
import {
  createKeyAuth,
  createHadokuCors,
  extractUserContext,
  ok,
} from '@wolffm/worker-utils';

const app = new Hono();

app.use('*', createHadokuCors());
app.use('*', createEdgeAuth());
//             ↑ verifies X-Edge-Auth, trusts the edge-stamped tier

app.get('/api/items', async (c) => {
  const { userId } = extractUserContext(c);
  const items = await getItems(userId);
  return ok(c, { items });
});

export default app;
With Validation
app.post('/api/items', async (c) => {
  const body = await c.req.json();

  const validation = validateFields(body, [
    CommonRules.id(),
    CommonRules.title({ maxLength: 200 }),
  ]);

  if (!validation.valid) {
    return validationError(c, validation.errors);
  }

  const item = await createItem(body);
  return created(c, { item });
});
With Logging
app.post('/api/items', async (c) => {
  const { userId } = extractUserContext(c);
  logRequest('POST', '/api/items', { userId });

  try {
    const item = await createItem(body);
    return created(c, { item });
  } catch (error) {
    logError('POST', '/api/items', error.message, { userId });
    return serverError(c, 'Failed to create item');
  }
});

See Also

  • WORKERS.md - Worker index and setup guide
  • docs/child-apps/NEW_CHILD_APP_CHECKLIST.md - Backend worker setup (see "Optional: Backend API" section)
  • AGENTS.md - Worker debugging and common patterns

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @hadoku/worker-utils

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Frame 2085668439 (1)
Group 1261154229