The first fuzz run on cnx01 found it: a drawn signature of 798 bytes whose PNG header says 300 x 738,197,594 pixels made krilla ask for 885 GB. A failed allocation aborts the process, so one such signature on any client link (or such an upload in a pack) would have ended the app for everyone; reproduced on a normal build, with a valid IHDR checksum. krilla decodes a picture as soon as it makes it, so papers::pixels reads the size from the header first, with the decoder krilla uses (png, zune-jpeg, image-webp; already in Cargo.lock, now direct dependencies), and papers::picture refuses more than MAX_PIXELS (50 megapixels, about 200 MB decoded) before krilla sees the file. The pack and the Documents tab print a note for such a file, the signed copy refuses it, and the client page refuses the signature (422, "did not arrive whole") before anything is stored. tests/fuzz_cases/signed_copy/png-claims-885-gigabytes is the finding, replayed on every push; unit tests for the header sizes and the limit, and the agreements test sends the forged signature.
76 lines
2.8 KiB
TOML
76 lines
2.8 KiB
TOML
[package]
|
|
name = "visa"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
rust-version = "1.95"
|
|
description = "Lanna Desk (lannadesk.com): immigration records, deadlines and extension packs for foreigners in Thailand"
|
|
publish = false
|
|
# Integration tests are one binary: tests/main.rs declares every tests/*.rs
|
|
# as a module, so the suite links once.
|
|
autotests = false
|
|
|
|
[lib]
|
|
doctest = false
|
|
|
|
[[bin]]
|
|
name = "visa"
|
|
path = "src/main.rs"
|
|
test = false
|
|
|
|
[[test]]
|
|
name = "integration"
|
|
path = "tests/main.rs"
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
axum = { version = "0.8", features = ["multipart"] }
|
|
base64 = "0.22"
|
|
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
|
|
form_urlencoded = "1"
|
|
# pdf: the blank forms and uploaded PDFs go in as they are; raster-images:
|
|
# uploaded scans and photos in the extension pack.
|
|
krilla = { version = "0.8", default-features = false, features = ["pdf", "raster-images", "simple-text"] }
|
|
# krilla's own image decoders, for their headers only: a picture's size is
|
|
# read before krilla decodes it (papers::picture)
|
|
png = "0.18.1"
|
|
zune-jpeg = "0.5.5"
|
|
image-webp = "0.2.1"
|
|
# Mail by SMTP submission to the fleet's mail server, over rustls with the
|
|
# system's CA bundle, as reqwest (phase 8: notifications).
|
|
lettre = { version = "0.11", default-features = false, features = ["builder", "smtp-transport", "tokio1-rustls", "ring", "rustls-native-certs"] }
|
|
minijinja = "2"
|
|
# The client link as a QR code to show on a phone (an inline SVG).
|
|
qrcode = { version = "0.14", default-features = false, features = ["svg"] }
|
|
# The login service's certificate is checked against the system's CA bundle
|
|
# (native roots), so a NixOS VM test can bring its own CA.
|
|
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "json"] }
|
|
# ID token signatures (ES256 from Kanidm, RS256 accepted), PKCE, random tokens
|
|
# and the session hashes, as in proplan and the fleet overview.
|
|
ring = "0.17"
|
|
rustybuzz = "0.20"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
serde_urlencoded = "0.7"
|
|
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "postgres", "chrono", "migrate", "macros"] }
|
|
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync", "time"] }
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
|
|
|
|
[dev-dependencies]
|
|
http-body-util = "0.1"
|
|
# property tests (src/props.rs); without fork and timeout, which pull in
|
|
# a process spawner the tests do not use
|
|
proptest = { version = "1", default-features = false, features = ["std"] }
|
|
tower = { version = "0.5", features = ["util"] }
|
|
|
|
[profile.dev]
|
|
# Line tables keep file:line in panics at a fraction of full debug info.
|
|
debug = "line-tables-only"
|
|
|
|
[profile.dev.package."*"]
|
|
debug = false
|
|
|
|
[profile.release]
|
|
lto = "thin"
|
|
strip = true
|