Softanza
DémarrerEnglish
Softanza
Entrées-sorties, formats, extensibilité, médias

Fichiers et formats

La sûreté d'abord : XXE fermé par construction ; des sous-ensembles délibérés (HTML plat, zip seul, UTF-8, plafond de 64 Mo).

1 Strong · 6 Solid · 4 Partial · 1 Emerging

Mesuré contre : lxml · libarchive · Dossiers : base/file(s'ouvre dans un nouvel onglet) · base/archive(s'ouvre dans un nouvel onglet) · base/html(s'ouvre dans un nouvel onglet) · Pour les programmeurs : la référence de ce domaine

les formes d'un document : un arbre pour JSON, des lignes pour CSV, des boîtes imbriquées pour XML
les formes d'un document : un arbre pour JSON, des lignes pour CSV, des boîtes imbriquées pour XML. dessiné le 2026-10-01 par le script du site tools/areas-figurative.ring, exécuté dans la bibliothèque au commit 0e72e2e2c · la source(s'ouvre dans un nouvel onglet)

Repensé depuis les premiers principes

Ce que Softanza a gardé de ce qui marche, et ce qu'elle a repensé, tel que la bibliothèque l'a écrit dans ses documents de conception et ses narrations.

La manière SoftanzaOn aborde un fichier selon ce qu'on veut en faire, et chaque format est analysé une seule fois, dans le moteur, par un analyseur dont les refus font partie de la sécurité.

Gardé des meilleures pratiques

  • La forme canonique XML est comparée octet par octet à libxml2 sur dix vecteurs, gardés comme tests permanents. Une référence indépendante juge le code, pas sa propre parole. source(s'ouvre dans un nouvel onglet)
  • La lecture rend la valeur, pas le texte brut : & revient en &. L'appelant ne décode jamais à la main, donc rien n'est affiché brut ni échappé deux fois. source(s'ouvre dans un nouvel onglet)
  • Une classe par format, pas par source. JSON, CSV, HTML et XML prennent du texte ; un fichier est une source, pas un genre, et charger ou enregistrer reste une commodité. source(s'ouvre dans un nouvel onglet)

Repensé

  • Un fichier s'ouvre par intention, pas par mode : FileRead, FileAppend, FileCreate, FileOverwrite, FileUpdate. Chaque intention permet aussi de lire, comme un cahier ouvert. source(s'ouvre dans un nouvel onglet)
  • L'analyseur XML refuse toute déclaration DOCTYPE ou ENTITY avant d'analyser. La lecture de fichiers piégée et l'explosion mémoire sont exclues par construction, pas par un réglage oubliable. source(s'ouvre dans un nouvel onglet)
  • Les chemins XML n'ont que trois formes, et comparent les noms locaux. Un XPath partiel inviterait des requêtes qui échouent en silence ; un préfixe n'est qu'un surnom local. source(s'ouvre dans un nouvel onglet)
  • Une clé de stockage d'objets n'est pas un chemin. Chaque fichier porte le SHA-256 de sa clé : la traversée de chemin devient inexprimable et Photo.JPG reste distinct de photo.jpg. source(s'ouvre dans un nouvel onglet)

A competent, safety-first formats module -- engine-backed file I/O, directories (with the Windows non-ASCII listing bug defeated), CSV, JSON, and a namespace-aware XML parser -- whose one genuine standout is XML security: XXE is closed by construction, the parser refusing <!DOCTYPE> and <!ENTITY> outright, which lxml and most XML libraries get wrong by default. Everything else is a deliberate subset: no XPath/XSLT/validation, a flat HTML index, zip-only archives via Haro's minizip, UTF-8 only, and whole-file reads with a 64 MB cap.

Ce qu'un artisan en fait, et ce qui se distingue

  • XXE closed by construction: the parser refuses <!DOCTYPE> and <!ENTITY>, a posture lxml defaults to wrong
  • The Windows non-ASCII directory listing bug defeated (wide-W API to UTF-8)
  • One strict namespace-aware XML parser shared with XML digital signatures (SAML), with exclusive C14N
  • CSV eval() on list-looking cells removed; byte-scan number test ~156x faster than regex-per-cell

Ce qui est dû

  • Migrate the stzJson constructor to the fixed UTF-8 parser (shipped but unwired)
  • Streaming and large-file reads past the 64 MB cap; iterparse-style XML/JSON
  • A real archive layer (tar, gzip/zlib); charset detection and non-UTF-8 decoding
  • Multiline CSV, richer HTML (slice 3), XPath, a pathlib-style path surface

La manière Softanza, exécutée

Ce que Softanza fait autrement dans ce domaine, montré par du code tiré de ses narrations et de ses gardes, et exécuté pour cette page.

Tout document portant une déclaration DOCTYPE ou ENTITY est refusé avant même l'analyse.

Softanza
? StzXmlIsValid("<!DOCTYPE d [<!ENTITY e SYSTEM 'file:///etc/passwd'>]><d/>")
? StzXmlIsValid("<!ENTITY xxe SYSTEM 'file:///etc/passwd'><d/>")
Sortie
0
0

exécuté le 2026-10-01 21:18 dans la bibliothèque au commit 0e72e2e2c ; tiré de base/doc/narrations/stz-xml-the-parser-that-says-no.md(s'ouvre dans un nouvel onglet)

Trois formes de chemin, comparées sur le nom local, lisent un document doté d'un espace de noms sans jamais le nommer.

Softanza
cXml = '<library xmlns="urn:lib" name="City Library">' +
       '<book isbn="1"><title>Dune</title><year>1965</year></book>' +
       '<book isbn="2"><title>Ubik</title><year>1969</year></book>' +
       '</library>'
? StzXmlRoot(cXml)
? StzXmlGet(cXml, "library/book/title")
? StzXmlGet(cXml, "library/book[2]/title")
? StzXmlGet(cXml, "//year")
Sortie
library
Dune
Ubik
1965

exécuté le 2026-10-01 21:18 dans la bibliothèque au commit 0e72e2e2c ; tiré de base/doc/narrations/stz-xml-the-parser-that-says-no.md(s'ouvre dans un nouvel onglet)

Deux clés qui ne diffèrent que par la casse restent deux objets, même sur un disque insensible à la casse, car chaque fichier stocké est nommé par une empreinte de sa clé.

Softanza
oB = StzFileBlobStoreQ("uploads")
oB.Save("Photo.JPG", "the original")
oB.Save("photo.jpg", "a different picture")
? oB.NumberOfBlobs()                 # --> 2
? oB.Fetch("Photo.JPG")              # --> the original
? oB.Fetch("photo.jpg")              # --> a different picture
Sortie
2
the original
a different picture

exécuté le 2026-10-01 21:18 dans la bibliothèque au commit 0e72e2e2c ; tiré de base/doc/narrations/stz-service-virtualization-code-first-subscribe-later.md(s'ouvre dans un nouvel onglet)

Les articles de ce domaine (4)

Les couloirs, un par un

Les couloirs et leurs notes sont cités tels qu'ils ont été lus à la source, le Read from the source on 2026-09-16, from a read-only main worktree.

XML security -- XXE closed by construction
Strong
xml.zig refuses any document containing <!DOCTYPE> or <!ENTITY>, a hard failure; guarded: a file:///etc/passwd entity doc returns FALSE, SAML docs parse.xml.zig; XXE guard under test/file
File I/O
Solid
read/write/append/copy/delete/stat engine-backed with a pathIsUsable screen; 64 MB read cap, no streaming, no mmap/seek, Move is copy+delete.file.zig, stzFile
Directory operations
Solid
list/walk/create/delete/count via stz_dir_*; non-ASCII listing fixed with the wide-W API (guarded: Arabic/CJK/Hebrew/emoji names, listed count == engine count).stz_dir_*, stzFolder; non-ASCII guard under test/file
CSV
Solid
csv.zig RFC-4180 quoting, header auto-detect, exact round-trip inference; eval() on cells removed, byte-scan number test ~156x faster; no multiline fields.csv.zig, stzCSV
JSON
Solid
json.zig parse/serialize/pretty; the UTF-8 trap fixed in StzJsonToList, but the stzJson class constructor still calls the old pure-Haro parser; no JSONPath.json.zig, StzJsonToList, JsonFilterFeatures
XML parsing & query
Solid
Strict namespace-aware parser shared with xmldsig.zig/SAML, exclusive C14N, a small local-name path grammar; no XPath, XSLT or DTD/XSD validation.xml.zig, xmldsig.zig, stzXml
File watching
Solid
fswatch.zig snapshots (mtime, size) and diffs to ADD/MOD/DEL; stzFolderWatcher Watch/Drain/Stop; polling-based, no native OS events.fswatch.zig, stzFolderWatcher
HTML parsing & query
Partial
html_dom.zig tokenizer + flat element index with tag/#id/.class selectors, double-decode fix, O(n^2) Find fix; no real DOM tree, no combinators, read-only.html_dom.zig, stzHtml; test/html
Archives & compression
Partial
stzZipFile read/write backed by Haro's native ziplib (minizip), not the engine; compressor.zig only crc32/adler32/RLE; zip only, no tar/gzip/7z.stzZipFile, compressor.zig
Path manipulation
Partial
Engine stz_path_extension/basename/dirname only (both / and \); no join, normalize, relative-to or glob, no path object.stz_path_extension, stz_path_basename, stz_path_dirname
Streaming & large files
Partial
Whole-file read only with a hard 64 MB cap; the one large-file path is JsonFilterFeatures (GeoJSON in-engine); no streaming, iterparse or mmap.JsonFilterFeatures
Encoding / charset
Emerging
None for text: codec.zig is Base64 only, everything UTF-8 by design; no charset detection, no non-UTF-8 decoding (Windows-1252, Shift-JIS).codec.zig