Zum Hauptinhalt springen
LIVE
CVSS 6.9CVE-2026-138105 | A vulnerability has been found in ssssssss-team magic-api 2.2.2. The affected element is an unknown function of the file /magic/web/datasource/jdbc/test of the component Datasource JDBC Test Endpoint. Such manipulation of the argument driverClassName leads to code injection. The attack can be launched remotely. The exploit has been disclosed to the public and may be used. The project was informed of the problem early through an issue report but has not respoCVSS 6.9CVE-2026-138104 | A flaw has been found in ssssssss-team magic-api up to 2.2.2. Impacted is the function push of the file magic-api/src/main/java/org/ssssssss/magicapi/core/web/MagicWorkbenchController.java of the component Workbench Push Interface. This manipulation of the argument magic-push-target causes server-side request forgery. The attack can be initiated remotely. The exploit has been published and may be used. The project was informed of the problem early through anCVSS 6.9CVE-2026-138103 | A vulnerability was detected in ssssssss-team magic-api up to 2.2.2. This issue affects the function saveFile of the file MagicResourceController.java of the component magic-api-core resource save API. The manipulation results in code injection. It is possible to launch the attack remotely. The exploit is now public and may be used. The project was informed of the problem early through an issue report but has not responded yet.CVSS 9.4CVE-2026-138102 | A security vulnerability has been detected in D-Link DIR-620S 4.0.2. This vulnerability affects unknown code of the file /usr/sbin/anweb of the component Diagnostic Handler. The manipulation of the argument I leads to os command injection. It is possible to initiate the attack remotely. The exploit has been disclosed publicly and may be used.CVSS 5.3CVE-2026-138101 | A weakness has been identified in MassGen up to 0.1.97. This affects the function _generate_subagent_yaml_config of the file massgen/subagent/manager.py of the component Subagent Delegation System. Executing a manipulation can lead to improper authorization. The attack may be performed from remote. The exploit has been made available to the public and could be used for attacks. The project was informed of the problem early through an issue report but has notCVSS 6.9CVE-2026-138100 | A security flaw has been discovered in MassGen up to 0.1.97. Affected by this issue is the function __init__ of the file massgen/filesystem_manager/_filesystem_manager.py. Performing a manipulation results in protection mechanism failure. The attack is possible to be carried out remotely. The exploit has been released to the public and may be used for attacks. The project was informed of the problem early through an issue report but has not responded yet.CVSS 8.7CVE-2026-138099 | A vulnerability was identified in Tenda AC10U 1.18.6. Affected by this vulnerability is the function readUsb of the component ATE Service. Such manipulation leads to out-of-bounds write. The attack can be executed remotely. The exploit is publicly available and might be used.CVSS 6.9CVE-2026-138098 | A vulnerability was determined in weison-tech yii2-cms up to 1.0.2. Affected is an unknown function of the file protected/core/config/common.php of the component RBAC Authorization. This manipulation causes improper authorization. Remote exploitation of the attack is possible.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

How to Generate TypeScript Types from JSON (Without Getting Optional Fields Wrong)

If you've ever pasted a single JSON object into a "json to typescript" tool and gotten back a clean interface, only to have your API return a slightly…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 6 Min. Lesezeit
Quelle: dev.to
Rubrik: Sichere Programmierung

If you've ever pasted a single JSON object into a "json to typescript" tool and gotten back a clean interface, only to have your API return a slightly different shape the next day and blow up your build — you've hit the single-sample problem. It's the most common, least talked-about failure mode in JSON-to-TypeScript conversion, and it's worth understanding before you trust any generated type in a real codebase.






What "generate TypeScript types from JSON" actually means



At its core, converting JSON to TypeScript is a structural mapping exercise. JSON has a small set of value types — string, number, boolean, null, array, object — and each one has an obvious TypeScript counterpart:




{
"id": 42,
"name": "Ada Lovelace",
"active": true
}









export interface Root {
id: number;
name: string;
active: boolean;
}






For a single, simple object, that's the whole job. The complexity — and the part where converters genuinely differ in quality — shows up the moment your JSON sample is an array of objects, which is the shape almost every real REST API response actually has.






The single-sample problem: why optional fields go missing



Here's the trap. Say your API returns a list of users, and one of them is missing an email field because they signed up via SSO:




[
{ "id": 1, "name": "Ada", "email": "ada@example.com" },
{ "id": 2, "name": "Alan" }
]






A converter that only looks at the first array element will produce:




export interface Root {
id: number;
name: string;
email: string;
}






That's wrong — email is not guaranteed to be present, but the generated type says it is. The bug won't show up immediately. It shows up later, as a runtime undefined where TypeScript swore a string would be, because nothing forced the compiler to check the field that was actually missing in your sample data.





This is the single biggest correctness gap across the free "json to typescript interface generator" tools you'll find in a search: most infer structure from element 0 of an array (or the one object you pasted) and never look at the rest.






What correct multi-sample merging looks like



The fix is straightforward in concept, if fiddly to implement correctly: when the JSON root is an array of similar objects, merge the union of every key seen across every element — not just the first — into one interface.




export interface Root {
id: number;
name: string;
email?: string; // absent from at least one sample
}






The same logic applies to types, not just presence. If a field is a number in one record and a string in another — a common pattern when an API is mid-migration, or a field is sometimes an ID and sometimes a slug — proper merging produces a union:




[{ "value": 42 }, { "value": "forty-two" }]









export interface Root {
value: number | string;
}






A converter that samples only the first element would type value as number and quietly break the moment it saw a string. This matters just as much for nested arrays of objects: if a tags array inside one record has an item missing a weight field, that optionality has to survive being merged again when the outer records themselves get merged together — a subtlety that's easy to get right for a single level of nesting and easy to lose once you go two levels deep.






Handling JSON to TypeScript nested objects



Nested objects raise a second, separate design question: should the nested shape be written inline, or pulled out into its own named interface?




{
"id": 1,
"address": { "city": "London", "postcode": "SW1A 1AA" }
}






Inline keeps everything in one block:




export interface Root {
id: number;
address: { city: string; postcode: string };
}






Extracted gives the nested shape its own name, which is usually more readable and lets you reuse the type elsewhere:




export interface Address {
city: string;
postcode: string;
}

export interface Root {
id: number;
address: Address;
}






Extraction is generally the better default for anything beyond a trivial one-off shape, especially if the same nested structure appears under more than one property (a billingAddress and shippingAddress with identical fields, for instance) — a good tool should deduplicate those into a single interface rather than generating two identical ones with different names.






Other details worth checking before you trust a converter's output



A handful of smaller rules separate a converter that produces compiling, correct TypeScript from one that produces something that merely looks right:





  • Empty arrays should infer as unknown[], not silently any[] — an empty array genuinely tells you nothing about its element type, and any defeats the entire point of generating types in the first place.


  • Keys that aren't valid TypeScript identifiers — hyphens, spaces, a leading digit, reserved words — need automatic quoting ("last-login": string;), or the output won't compile at all.


  • null values should be handled explicitly, either as an honest T | null union or folded into key?: T depending on your team's convention — never silently dropped.


  • export and readonly should be simple toggles you control, not a hard-coded style choice you have to find-and-replace after the fact.








Try it: a json to typescript converter built around correct merging



Skojio's JSON to TypeScript Converter exists specifically to close the single-sample gap described above. Paste a JSON object or an array of objects and it will:




  • Merge the union of keys across every array element (not just the first) to correctly infer optional fields and unions

  • Recursively apply the same merging to nested arrays of objects, so optionality survives being merged at multiple levels

  • Let you toggle interface vs type, extract-named-interfaces vs inline nesting, export, and readonly

  • Automatically quote invalid-identifier keys, with a visible note when it happens

  • Give you a copy button and a one-click .ts download



Everything runs in your browser — nothing you paste is sent anywhere. If you want to check your JSON's shape is well-formed before generating types from it, run it through JSON Formatter & Validator first; if you'd rather get the same data into tabular CSV instead of TypeScript, JSON ↔ CSV Converter is the same-input, different-output sibling tool.






  • Most free JSON-to-TypeScript converters infer structure from a single sample (often just array element 0), which silently mis-types fields that are sometimes missing or sometimes a different type.

  • Correct multi-sample merging unions the keys across every array element: absent-in-some-records becomes key?: T, differently-typed-across-records becomes a union type.

  • Nested arrays of objects need the same merge logic applied recursively — optionality discovered one level down has to survive being merged again at the level above.

  • Extracting nested objects into named, deduplicated interfaces is usually more useful than writing them inline, especially when the same shape appears under more than one property.

  • Empty arrays should infer as unknown[], not any[]; invalid-identifier keys need automatic quoting, not a compile error.

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:

💬 Community-Diskussion & Kommentare

🌐 Zum Hauptchat

Starte die Diskussion im Social-Chat Broadcast Stream oder reiche oben über „Information ergänzen“ einen Fachbeitrag ein.

Community Rating & Social Proof
⭐ Leser-Wertung
–
Ø / 5.0
Noch keine Leser-Bewertungen
War dieser Artikel hilfreich?
0
Jetzt Bewertung abgeben
Detail-Bewertung (optional)
Inhalt & Qualität
Quelle & Glaubwürdigkeit
Aktualität
Security Briefing Kostenlos · 1-Klick-Abmeldung

Intelligence Digest — kostenlos

Täglich die wichtigsten Security-News · jederzeit abbestellbar

Verwandte Story-Cluster & Quellen (Vektor-KI)

6 Cluster
16 Quellen
Cyber 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 TechRadar vor 33 Min.
15 weitere Quellen
Latest from TechRadarvor 31 Min.The best Cyber Monday deals in the UK in 2026: top picks from Amazon, Argos, Ninja, Lego and more Latest from TechRadarvor 22 Min.Black 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 TechRadarvor 41 Min.Cyber Monday Australia laptop deals for 2026: score up to 52% off Lenovo, Apple, Dell, HP and more Latest from TechRadarvor 1 Std.Amazon Australia Cyber Monday deals CNETvor 1 Std.This Pocket Battery Recharges Your Phone 4 Times, and it’s Only $38 for Cyber Monday Latest from TechRadarvor 1 Std.Firebat's M1 is a cracking Ryzen AI 9 HX 470 mini PC for AI workloads — and it's packing OCuLink, 32GB of RAM, and a 1TB SSD for $1020 this Cyber Monday Latest from TechRadarvor 1 Std.The Lenovo IdeaCentre Tower Copilot+ PC with Core Ultra 7 CPU isn't discounted for Cyber Monday — and it's still the desktop computer I'd buy for work for $1049 WIREDvor 1 Std.The 8 Best Black Friday Deals on Expert-Tested Laptops (2026): Up to $470 Off The Vergevor 1 Std.Qobuz is my streaming service of choice and it’s on sale during Cyber Monday CNETvor 12 TagenThis Paramount Plus Cyber Monday Deal Gets You Ad-Free Viewing for Only $3 Per Month CNETvor 2 Std.Cyber Monday Meta Quest 3S Deal Knocks $53 Off and Gets You $50 Free Amazon Credit WIREDvor 5 Std.The 31+ Very Best Amazon Black Friday Deals (2026): Up to 50% Off The Vergevor 3 Std.These early Cyber Monday gaming laptop deals offer the most GPU for the least money Latest from TechRadarvor 4 Std.Grab a TP-Link dual-band Wi-Fi 6 router with 1.5Gbps for $44 this Cyber Monday CNETvor 4 Std.Upgrade Your Emergency Preparedness Kit With Black Friday and Cyber Monday Deals on Power Stations, Flashlights, Solar and More
13 Quellen
Linux Overhauls Documentation For Reporting Kernel Security Bugs
Phoronix vor 32 Min.
12 weitere Quellen
DEV Communityvor 1 Std.ForgeOS Booted on a Real Server: Linux Kernel Below, Only Our Own Code Above VulDB Updatesvor 2 Std.CVE-2026-72239 | Linux Kernel sev x86/virt/sev/sev.c wbinvd_on_all_cpus state issue (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72240 | Linux Kernel up to 7.1.4 mfd sm501_register_device memory leak (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72241 | Linux Kernel up to 7.1.4 uleds strchr buffer overflow (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72244 | Linux Kernel up to 6.12.100/6.18.41/7.1.4/7.2-rc2 gpu-buddy allocation of resources (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72243 | Linux Kernel up to 7.2-rc2 selinux socket_sendmsg permission (Nessus ID 364200 / WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72245 | Linux Kernel up to 7.1.4 host1x host1x_device_parse_dt release of resource (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72246 | Linux Kernel flowtable input validation (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72247 | Linux Kernel up to 7.2-rc3 nf_conncount __nf_conncount_add dir comparison (WID-SEC-2026-2852) VulDB Updatesvor 2 Std.CVE-2026-72248 | Linux Kernel up to 7.1.4/7.2-rc2 flowtable nft_flow_dst_release buffer overflow (WID-SEC-2026-2852) LinuxAndUbuntuvor 3 Std.Linux AutoFDO Benchmark: Clang Kernel Optimization VulDB Updatesvor 4 Std.CVE-2022-31607 | NVIDIA GPU Display Driver on Linux Kernel Mode Layer nvidia.ko input validation (EUVD-2022-53059 / Nessus ID 339047)
13 Quellen
CVE-2026-135533 | Mozilla Firefox up to 115.45/153.7/160 Layout Tables off-by-one (Nessus ID 388625)
VulDB Updates vor 1 Std.
12 weitere Quellen
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Generate TypeScript Types from JSON (Without Getting Optional Fields Wrong)

Thematisch verwandte Begriffe: Generate, TypeScript, Types, from · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Widgets & Themen
Widgets werden geladen…
Nächster Beitrag