Zum Hauptinhalt springen
LIVE
CVSS 7.4CVE-2026-138376 | AsyncSSH 1.13.1 before 2.24.2 contains an improper authentication vulnerability in SSHConnection._match_known_hosts that accumulates trusted client host keys across host-based authentication attempts on one connection. With trust_client_host enabled, attackers holding one known client host's private key can retry naming another known host and log in as users authorized only from that host.CVSS 7.6CVE-2026-138377 | AsyncSSH 1.13.1 before 2.24.2 contains an improper certificate validation vulnerability that allows remote clients to authenticate as users by abusing X.509 certificates matched in known_client_hosts. Attackers can make a failed host-based authentication attempt with any host key, adding host-only CA certificates to the trust anchors, then authenticate using user certificates issued under those CAs.CVSS 9.1CVE-2026-138378 | react-native-pure-jwt before 3.1.1 on Android contains a signature verification bypass vulnerability that allows unauthenticated attackers to forge tokens because RNPureJwtModule decode() calls JJWT parse() without algorithm pinning. Attackers can craft a token with header alg none and an empty signature to have arbitrary claims accepted as verified, forging identities or roles.CVSS 6.9CVE-2026-138379 | flare-redact before 1.13.1 contains a redaction bypass vulnerability that leaks secrets because the redact() object walker masks sensitive keys only when values are strings. Numbers, objects, arrays and binary data under keys such as password, cvv, pin, cookie or authorization pass through unchanged, exposing secrets in clear text to logger, Sentry, gateway and Fluent Bit sinks.CVSS 6.9CVE-2026-138380 | MediaInfoLib before 26.10 contains a heap-based buffer over-read vulnerability in File_Ogg::Data_Parse() that allows attackers to read beyond heap buffers via crafted Ogg segment sizes. Attackers can supply an Ogg file whose segment sizes exceed the page payload, wrapping the unsigned offset check and causing memcpy over-reads that crash the process or leak heap memory.CVSS 6.9CVE-2026-138381 | GNU LibreDWG 0.14 before 0.15 contains a heap use-after-free vulnerability in in_dxf.c new_object() where the OLE2FRAME oleclient pointer references freed memory after DXF import. Attackers can supply a DXF file with an OLE2FRAME entity to crash dxfwrite or similar applications and leak freed heap contents into exported output.CVSS 10.0CVE-2026-138227 | A vulnerability was found in D-Link R95 1.04B04Beta. This affects the function SetTimeSettings of the file /bin/ssi of the component DHMAPI. Performing a manipulation of the argument TZLocation results in os command injection. Remote exploitation of the attack is possible. The exploit has been made public and could be used.CVSS 10.0CVE-2026-138226 | A vulnerability has been found in D-Link R95 1.04B04Beta. Affected by this issue is the function SetSecureDNSSettings of the file /bin/ssi of the component DHMAPI SOAP interface. Such manipulation of the argument URI leads to os command injection. The attack may be launched remotely. The exploit has been disclosed to the public and may be used.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

Type-Safe Env Vars Without Zod

Most TypeScript projects treat environment variables like second-class citizens. They're string | undefined everywhere, asserted with ! and parsed with…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 3 Min. Lesezeit
Quelle: dev.to
Rubrik: Programación segura

Most TypeScript projects treat environment variables like second-class citizens. They're string | undefined everywhere, asserted with ! and parsed with parseInt(). TypeScript can't help because process.env is typed as Record<string, string | undefined>.



Schema-based validation fixes this. But most solutions bring zod, which adds 50 KB to your bundle. CtroEnv does it with zero dependencies and 6.5 KB gzipped.






How Inference Works



The type system reads each validator's configuration at compile time:




type InferredValue<V> =
V extends Validator<infer T>
? V["metadata"] extends { hasDefault: true }
? T // .default() → non-nullable
: V["metadata"] extends { optional: true }
? T | undefined // .optional() → nullable
: T // required → guaranteed present
: never






This means the schema defines the type:




const env = defineEnv({
PORT: number().port().default(3000),
// ^? number — default makes it always present

DB_URL: string().url(),
// ^? string — required

DEBUG: boolean().optional(),
// ^? boolean | undefined — optional

NODE_ENV: pick(["dev", "prod", "staging"] as const),
// ^? "dev" | "prod" | "staging" — exact union
})






No interface Env { ... }. No z.infer<typeof Schema>. Add a new validator, and the type updates automatically.






Default vs Optional vs Required



The three states and their types:

































Declaration Type Runtime behavior
string() string Required — throws if missing
string().optional() `string \ undefined`
string().default("x") string Falls back to "x"
string().optional().default("x") string Default overrides optional


TypeScript reflects this exactly. Optional gives you | undefined. Default removes it.






The as const Requirement



pick() needs as const to preserve literal types:




pick(["dev", "prod"])           // type: string — widened
pick(["dev", "prod"] as const) // type: "dev" | "prod" — exact union






Without as const, TypeScript widens the array to string[] and you lose the union.






Exhaustive Checking



With exact literal types, you get exhaustive checking:




switch (env.NODE_ENV) {
case "dev": break
case "prod": break
case "staging": break
// TypeScript error if you forget a case — and you can't match "production"
// because it's not in the union
}









The Chain Order Gotcha



Type-specific methods (.url(), .email(), .min()) must come before chainable methods (.secret(), .optional(), .describe()):




string().url().secret()     // ✅ correct
string().secret().url() // ❌ — .url() doesn't exist after .secret()






Reason: .secret() returns a generic Validator & ChainableMethods wrapper. The type-specific methods like .url() only exist on StringValidator. Once you call a chainable method, those are gone.



Quick reference:




// ✅ Correct
string().min(1).max(255).url().secret()
number().int().positive().default(42)
pick(["a", "b"] as const).optional()
boolean().default(false)

// ❌ Wrong
string().secret().url() // .url() lost
number().optional().int() // .int() lost






pick(), boolean(), semver(), ip(), uuid() have no type-specific refinements, so chain order doesn't matter for them.






Composing Schemas



defineSchema() + extendSchema() preserve full types through composition:




import { defineSchema, extendSchema } from "@ctroenv/core"

const base = defineSchema({
NODE_ENV: pick(["dev", "prod"] as const).default("dev"),
})

const schema = extendSchema(base, {
PORT: number().port().default(3000),
})

const env = defineEnv(schema)
// env.NODE_ENV: "dev" | "prod"
// env.PORT: number






The composed type merges both schemas. Extension keys override base keys — with a dev-mode warning on conflicts.






Compared to Zod






// zod — 50 KB dependency
import { z } from "zod"
const Schema = z.object({
PORT: z.coerce.number().min(1).max(65535).default(3000),
DB_URL: z.string().url(),
})
type Env = z.infer<typeof Schema>

// CtroEnv — 6.5 KB, zero deps
import { defineEnv, string, number } from "@ctroenv/core"
const env = defineEnv({
PORT: number().port().default(3000),
DB_URL: string().url(),
})
// ^? { PORT: number; DB_URL: string } — inferred automatically






Same validation power. No manual type extraction. No extra dependency.




npm install @ctroenv/core






Links: GitHub · Docs · npm



Previous: Why Your .env File Is Lying to You

Next: Framework-Specific Env Patterns

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Debate de la comunidad y comentarios

🌐 Unirse al chat principal

Inicia el debate en el stream de difusión del Social Chat o envía arriba una contribución experta mediante el formulario de ampliación.

Valoración de la comunidad &amp; prueba social
⭐ Valoración de los lectores
–
Ø / 5.0
Aún no hay valoraciones de lectores
¿Le ha resultado útil este artículo?
0
Dejar una valoración ahora
Valoración detallada (opcional)
Contenido & calidad
Fuente & credibilidad
Actualidad
Briefing de seguridad Gratis · baja en 1 clic

Intelligence Digest — gratis

Cada día las noticias de seguridad más importantes · baja en cualquier momento

Clústeres de historias relacionados & fuentes (IA vectorial)

6 Cluster
25 fuentes
CVE-2026-135550 | Mozilla Firefox Web Codecs memory corruption (Nessus ID 388625)
VulDB Updates hace 1 h
24 fuentes más
VulDB Updateshace 1 hCVE-2026-135551 | Mozilla Firefox up to 153.7/160 Layout use after free (Nessus ID 388625) VulDB Updateshace 1 hCVE-2026-135552 | Mozilla Firefox up to 115.45/153.7/160 Canvas2D use after free (Nessus ID 388625) VulDB Updateshace 1 hCVE-2026-135554 | Mozilla Firefox up to 115.45/153.7/160 Navigation use after free (Nessus ID 388625) VulDB Updateshace 1 hCVE-2026-135556 | Mozilla Firefox up to 115.45/153.7/160 JIT memory corruption (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135540 | Mozilla Firefox up to 115.45/153.7/160 JIT memory corruption (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135539 | Mozilla Firefox up to 115.45/153.7/160 CSS Object Model use after free (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135542 | Mozilla Firefox up to 115.45/153.7/160 Layout buffer overflow (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135541 | Mozilla Firefox up to 115.45/153.7/160 XSLT use after free (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135544 | Mozilla Firefox up to 115.45/153.7/160 Navigation memory corruption (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135545 | Mozilla Firefox up to 153.7/160 Editor memory corruption (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135543 | Mozilla Firefox up to 115.45/153.7/160 Networking memory corruption (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135547 | Mozilla Firefox up to 115.45/153.7/160 Networking sandbox (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135549 | Mozilla Firefox up to 115.45/153.7/160 XSLT use after free (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135548 | Mozilla Firefox up to 115.45/153.7/160 Layout use after free (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135533 | Mozilla Firefox up to 115.45/153.7/160 Layout Tables off-by-one (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135536 | Mozilla Firefox up to 115.45/153.7/160 DOM Editor uninitialized pointer (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135535 | Mozilla Firefox up to 115.45/153.7/160 Skia input validation (Nessus ID 388625) VulDB Updateshace 4 hCVE-2026-135537 | Mozilla Firefox up to 115.45/153.7/160 Layout Text/Fonts out-of-bounds (Nessus ID 388625) VulDB Updateshace 5 hCVE-2026-135525 | Mozilla Firefox up to 115.45/153.7/160 WebRender use after free (Nessus ID 388625) VulDB Updateshace 5 hCVE-2026-135526 | Mozilla Firefox up to 115.45/153.7/160 Networking use after free (Nessus ID 388625) VulDB Updateshace 5 hCVE-2026-135527 | Mozilla Firefox up to 115.45/153.7/160 DOM/HTML use after free (Nessus ID 388625) VulDB Updateshace 5 hCVE-2026-135528 | Mozilla Firefox up to 153.7/160 HTTP race condition (Nessus ID 388625) VulDB Updateshace 5 hCVE-2026-135530 | Mozilla Firefox up to 115.45/153.7/160 HTTP sandbox (Nessus ID 388625) VulDB Updateshace 5 hCVE-2026-135529 | Mozilla Firefox up to 153.7/160 Text sandbox (Nessus ID 388625)
17 fuentes
Apple Cyber Monday Deals (2026): AirPods, iPads, MacBooks, and More
WIRED hace 23 min.
16 fuentes más
The Mac Observerhace 32 min.Aqara W200 thermostat is $119.99 for Cyber Monday, $40 off and Apple Home ready Latest from TechRadarhace 50 min.Cyber Monday mini PC deals 2026 live — top tiny desktops from GMKtec, Geekom, Minisforum, and more as the Black Friday sale continues The Mac Observerhace 57 min.Sonos Beam Gen 2 is $339 for Cyber Monday, $160 off and $359 under two HomePods The Mac Observerhace 1 hMagic Mouse in black drops to $79.99 for Cyber Monday, $19 under Apple’s $99 The Mac Observerhace 1 hGarmin fenix 8 47mm drops $250 to $749.99 for Cyber Monday, $49 under Ultra 4 Latest from TechRadarhace 2 hI've been waiting for a better deal on the Philips LatteGo 4400 — and Amazon has delivered a record-low price for Cyber Monday Latest from TechRadarhace 2 hLooking to get a last-minute gaming gift before Cyber Monday is over? WIREDhace 3 hLast Call for Black Friday iPad Deals (2026): Save Up to $100 Latest from Windows Centralhace 3 hWhy I bought a handheld over a gaming laptop on Cyber Monday Latest from TechRadarhace 4 hI found the most capable PC under $300 for Cyber Monday — Origimagic's C7 Windows 11 Pro machine packs dual Thunderbolt 4, 2.5Gb LAN, a Core 3 100U, 16GB of RAM, and a 512GB SSD OS X Dailyhace 3 hCyber Monday Deals: $300 Off 16″ PROLED MacBook Pro, $100 Off AirPods Pro 3, $100 Off iPad Air, & More Latest from TechRadarhace 4 hCyber Monday home office deals 2026 live — our top workspace picks from FlexiSpot, Dell, Anker, Logitech and more as Black Friday sale rolls on Latest from TechRadarhace 4 hThe best Cyber Monday deals in the UK in 2026: top picks from Amazon, Argos, Ninja, Lego and more Latest from TechRadarhace 4 hBlack Friday laptop deals 2026: the huge savings on MacBooks, Chromebooks and Windows 11 laptops still available from Apple, Dell, HP and many more Latest from TechRadarhace 4 hCyber Monday Australia laptop deals for 2026: score up to 52% off Lenovo, Apple, Dell, HP and more Latest from TechRadarhace 4 hAmazon Australia Cyber Monday deals
12 fuentes
CVE-2026-116159 | ImageMagick up to 6.9.13-57/7.1.2-32 CDL Option memory leak (Nessus ID 388637)
VulDB Updates hace 1 h
11 fuentes más
Artículos similares
🔍 Verwandte News

Auch interessante Nachrichten Type-Safe Env Vars Without Zod

Thematisch verwandte Begriffe: TypeSafe, Vars, Without · 6 Treffer

Laden...

Cargando artículos ...

Laden...

Cargando vídeos ...

Laden...

Cargando artículos ...

Laden...

Cargando vídeos ...

Laden...

Cargando artículos ...

Laden...

Cargando vídeos ...

💬 Cargando comentarios…
Desliza para actualizar
Widgets & temas
Cargando widgets…
Siguiente entrada