SPB Git

Repository Public

parsers-services.json 37.4 KB 675 lines json

1{2  "reviewer": "manual source review (REVIEW-B)",3  "date": "2026-12-04",4  "scope": [5    "QyvoraCore",6    "QyvoraBitcoin",7    "QyvoraEthereum",8    "QyvoraStorage",9    "QyvoraNetworking",10    "QyvoraVault",11    "QyvoraIdentity",12    "QyvoraRecovery",13    "QyvoraQuantumShield",14    "QyvoraMigration",15    "QyvoraWallet"16  ],17  "method": "Reading of the sources for traps reachable from untrusted input (fatalError, precondition, force unwrap, try!, unchecked subscripts and slices, trapping integer conversions and arithmetic, unbounded allocation, recursion, quadratic work), then of the protocol rules with a security impact. Verdicts: safe, fixed (see finding), not-reachable (trap exists but no untrusted input reaches it), open-finding.",18  "limits": "Read in full: every file of QyvoraCore (except the word list), QyvoraBitcoin, QyvoraEthereum, QyvoraStorage, QyvoraNetworking, QyvoraVault (except PasswordQuality.swift), QyvoraIdentity, QyvoraRecovery, and WalletService.swift, Support.swift and the Bitcoin, Ethereum, Onboarding, Shield and Market extensions of QyvoraWallet. Read in part and searched for trapping constructs: WalletTypes.swift, ShieldReport.swift, Migration.swift, PasswordQuality.swift. A manual review does not prove the absence of defects; the fuzzing campaign covers the same parsers mechanically.",19  "entries": [20    {21      "module": "QyvoraEthereum",22      "file": "Sources/QyvoraEthereum/RLP.swift",23      "line": 79,24      "construct": "RLP.decode: length arithmetic, slicing, recursion",25      "input_source": "QR payload, raw transaction text",26      "verdict": "safe",27      "rationale": "Depth limited to 64; every take() checks count >= 0 and remaining; long lengths limited to 8 bytes, canonical, <= Int32.max; a list is bounded by the remaining data before its items are read and must end exactly; allocation is linear in the input."28    },29    {30      "module": "QyvoraEthereum",31      "file": "Sources/QyvoraEthereum/Transaction.swift",32      "line": 115,33      "construct": "EIP1559Transaction.decodeUnsigned / decodeFields: items[0..8] subscripts",34      "input_source": "QR payload (cold signing)",35      "verdict": "safe",36      "rationale": "Callers check the item count (9 unsigned, 12 signed) before indexing; integers go through uintValue (<= 32 bytes, no leading zero) and .uint64 (nil above 64 bits); address 0 or 20 bytes; storage keys exactly 32 bytes."37    },38    {39      "module": "QyvoraEthereum",40      "file": "Sources/QyvoraEthereum/Transaction.swift",41      "line": 156,42      "construct": "SignedEIP1559Transaction.raw: try! RLP.decode of its own encoding",43      "input_source": "internal",44      "verdict": "not-reachable",45      "rationale": "The value is only built by sign() or decode() (no public initializer); the re-encoded unsigned payload is canonical, so the decode cannot fail below 2 GiB of call data (the service limits call data to 4 096 bytes)."46    },47    {48      "module": "QyvoraEthereum",49      "file": "Sources/QyvoraEthereum/Transaction.swift",50      "line": 172,51      "construct": "SignedEIP1559Transaction.decode: signature shape and recovery",52      "input_source": "QR payload, raw transaction text",53      "verdict": "safe",54      "rationale": "yParity < 2, r and s non-zero canonical integers, recovery errors are thrown, verify() applies the low-s rule (requireLowS default true). The service additionally requires raw == re-encoding (canonical form)."55    },56    {57      "module": "QyvoraEthereum",58      "file": "Sources/QyvoraEthereum/Address.swift",59      "line": 60,60      "construct": "EthereumAddress(text): EIP-55",61      "input_source": "user input, QR, JSON",62      "verdict": "safe",63      "rationale": "Exactly 0x + 40 hex digits; mixed case must match the EIP-55 checksum; single-case text is accepted and the service adds the `recipientWithoutChecksum` warning."64    },65    {66      "module": "QyvoraEthereum",67      "file": "Sources/QyvoraEthereum/ERC20.swift",68      "line": 88,69      "construct": "ERC20.decodeCall / decodeUInt / decodeString: fixed slices",70      "input_source": "transaction data, eth_call return data",71      "verdict": "safe",72      "rationale": "decodeCall requires exactly 68 bytes and zero padding above the address; decodeUInt exactly 32 bytes; decodeString checks offset == 32, length <= 256 and the available bytes before slicing, and rejects control characters."73    },74    {75      "module": "QyvoraCore",76      "file": "Sources/QyvoraCore/UInt256.swift",77      "line": 58,78      "construct": "UInt256(bigEndian:), (hex:), (decimal:), reporting arithmetic",79      "input_source": "JSON-RPC quantities, indexer amounts, user input",80      "verdict": "safe",81      "rationale": "Length checks before indexing; decimal parsing uses the reporting multiplication and addition and returns nil on overflow."82    },83    {84      "module": "QyvoraCore",85      "file": "Sources/QyvoraCore/UInt256.swift",86      "line": 175,87      "construct": "UInt256 trapping operators (+, -, quotientAndRemainder by 0)",88      "input_source": "internal",89      "verdict": "not-reachable",90      "rationale": "Call sites reviewed: `balance - cost` after `balance > cost`; `baseFee + baseFee + priorityFee` after both are checked below 1e13; division by the constants 2 and 10 only. External values use the reporting forms."91    },92    {93      "module": "QyvoraCore",94      "file": "Sources/QyvoraCore/UInt256.swift",95      "line": 224,96      "construct": "BaseUnits.parse / format: String(repeating:count:), dropLast, prefix with caller-supplied counts",97      "input_source": "token decimals (network values bounded to <= 36), stored profile",98      "verdict": "fixed",99      "rationale": "Negative decimals trapped and huge ones allocated; now refused (parse) or clamped to 0...255 (format).",100      "finding_id": "QYV-SVC-006"101    },102    {103      "module": "QyvoraCore",104      "file": "Sources/QyvoraCore/Encoding/Base58.swift",105      "line": 79,106      "construct": "Base58.decode: table lookup, quadratic conversion",107      "input_source": "addresses, extended keys, WIF",108      "verdict": "fixed",109      "rationale": "Lookup is guarded by c < 128. The conversion is quadratic: callers now bound the text (address <= 100, descriptor <= 8 192, extended key <= 120, WIF <= 60).",110      "finding_id": "QYV-SVC-015"111    },112    {113      "module": "QyvoraCore",114      "file": "Sources/QyvoraCore/Encoding/Bech32.swift",115      "line": 95,116      "construct": "Bech32.decode / SegWitAddress.decode",117      "input_source": "addresses",118      "verdict": "safe",119      "rationale": "8...90 printable ASCII characters, single case, separator position checked, >= 6 data characters, checksum per variant; version 0 must be Bech32 with a 20- or 32-byte program, versions 1-16 Bech32m; strict padding in fromWords; the human-readable part must be the network's."120    },121    {122      "module": "QyvoraCore",123      "file": "Sources/QyvoraCore/HD/BIP32.swift",124      "line": 188,125      "construct": "ExtendedKey.parse: fixed slices of the 78-byte payload",126      "input_source": "user input, QR, descriptors, watch-only package",127      "verdict": "fixed",128      "rationale": "Slices follow the payload.count == 78 check; version must be known; depth 0 requires zero parent and child; private key range and public key validity are checked. Text length is now bounded before decoding.",129      "finding_id": "QYV-SVC-015"130    },131    {132      "module": "QyvoraCore",133      "file": "Sources/QyvoraCore/HD/BIP32.swift",134      "line": 121,135      "construct": "ExtendedKey.derive: depth + 1, IL >= n, zero key",136      "input_source": "derivation paths from PSBT hints and descriptors",137      "verdict": "safe",138      "rationale": "depth < 255 is checked; privateKeyAdd / publicKeyAdd failures (IL >= n, zero result) are reported as invalidChild; hardened derivation from a public key throws."139    },140    {141      "module": "QyvoraCore",142      "file": "Sources/QyvoraCore/HD/BIP32.swift",143      "line": 65,144      "construct": "DerivationPath(text)",145      "input_source": "user input",146      "verdict": "safe",147      "rationale": "ASCII digits only, UInt32 conversion checked, index below 2^31."148    },149    {150      "module": "QyvoraCore",151      "file": "Sources/QyvoraCore/HD/BIP39.swift",152      "line": 90,153      "construct": "BIP39.entropy / words(from:) / seed",154      "input_source": "user input (recovery phrase), backup records",155      "verdict": "safe",156      "rationale": "Word count checked before any indexing; unknown words reported by position; checksum verified; NFKD normalisation of the sentence and of the passphrase; no trap path."157    },158    {159      "module": "QyvoraBitcoin",160      "file": "Sources/QyvoraBitcoin/Encoding.swift",161      "line": 97,162      "construct": "ByteReader: take, le, varInt, count, varBytes",163      "input_source": "transactions, PSBT",164      "verdict": "safe",165      "rationale": "Every read checks remaining; CompactSize must be canonical; counts are bounded by remaining / minimum item size before Int conversion and before reserveCapacity."166    },167    {168      "module": "QyvoraBitcoin",169      "file": "Sources/QyvoraBitcoin/Encoding.swift",170      "line": 198,171      "construct": "BitcoinWIF.decode",172      "input_source": "user input",173      "verdict": "fixed",174      "rationale": "Slices follow the payload length check. Text length is now bounded before the quadratic Base58 decoding.",175      "finding_id": "QYV-SVC-015"176    },177    {178      "module": "QyvoraBitcoin",179      "file": "Sources/QyvoraBitcoin/Transaction.swift",180      "line": 173,181      "construct": "BitcoinTransaction(parsing:): counts, witness, force-unwrapped outpoint",182      "input_source": "raw transaction hex (indexer, PSBT), broadcast answers",183      "verdict": "safe",184      "rationale": "Input limited to 4 000 000 bytes; counts bounded by the data; BitcoinOutPoint(hash:index:)! follows take(32); witness flag rules of BIP-144; trailing bytes refused."185    },186    {187      "module": "QyvoraBitcoin",188      "file": "Sources/QyvoraBitcoin/Transaction.swift",189      "line": 255,190      "construct": "outputValue: UInt64 sum",191      "input_source": "parsed transactions",192      "verdict": "safe",193      "rationale": "Each value and the running total are checked against 21 million BTC at every step."194    },195    {196      "module": "QyvoraBitcoin",197      "file": "Sources/QyvoraBitcoin/Transaction.swift",198      "line": 289,199      "construct": "BitcoinSighash.segwitV0 / legacy: output subscripts for SIGHASH_SINGLE",200      "input_source": "PSBT sighash types",201      "verdict": "safe",202      "rationale": "Input index checked; SIGHASH_SINGLE beyond the outputs is handled before slicing (zero hash for BIP-143, the constant one for legacy). The wallet signs SIGHASH_ALL only."203    },204    {205      "module": "QyvoraBitcoin",206      "file": "Sources/QyvoraBitcoin/Script.swift",207      "line": 168,208      "construct": "BitcoinScript.decode / classify / parseMultisig / witnessProgram(of:)",209      "input_source": "scriptPubKeys from the indexer and PSBTs",210      "verdict": "safe",211      "rationale": "Push lengths are checked against the remaining bytes before slicing (including OP_PUSHDATA4); fixed-offset subscripts follow exact length checks; smallInteger reads data[0] only for a one-byte push."212    },213    {214      "module": "QyvoraBitcoin",215      "file": "Sources/QyvoraBitcoin/Script.swift",216      "line": 152,217      "construct": "pushNumber precondition",218      "input_source": "internal",219      "verdict": "not-reachable",220      "rationale": "Called with the multisig threshold and key count, both bounded to 1...20 beforehand."221    },222    {223      "module": "QyvoraBitcoin",224      "file": "Sources/QyvoraBitcoin/Address.swift",225      "line": 74,226      "construct": "BitcoinAddress(text, network:)",227      "input_source": "user input, QR",228      "verdict": "safe",229      "rationale": "Non-empty ASCII text of at most 100 characters; Bech32 addresses must carry the network's prefix and the variant required by their version; Base58Check payload must be 21 bytes with the network's version byte; another network's address is reported as wrongNetwork."230    },231    {232      "module": "QyvoraBitcoin",233      "file": "Sources/QyvoraBitcoin/PSBT.swift",234      "line": 197,235      "construct": "PSBT parser: readMap, derivation, witnessStack, per-type fields",236      "input_source": "PSBT text or QR frames",237      "verdict": "safe",238      "rationale": "Key lengths bounded by the remaining data; duplicate keys refused; derivation values must be 4 + 4n bytes; the unsigned transaction is parsed without witness and must have empty scriptSigs; a non-witness UTXO must hash to the outpoint and hold the index; one map per input and output; trailing bytes refused. The service limits the text to 2 000 000 characters."239    },240    {241      "module": "QyvoraBitcoin",242      "file": "Sources/QyvoraBitcoin/PSBT.swift",243      "line": 503,244      "construct": "PSBT.fee: UInt64 sum of claimed input amounts",245      "input_source": "PSBT",246      "verdict": "fixed",247      "rationale": "Overflowed with more than 8 784 maximal inputs; the running total is now bounded.",248      "finding_id": "QYV-SVC-004"249    },250    {251      "module": "QyvoraBitcoin",252      "file": "Sources/QyvoraBitcoin/PSBT.swift",253      "line": 556,254      "construct": "PSBT signer checks (signingContext, sign)",255      "input_source": "PSBT",256      "verdict": "safe-with-open-finding",257      "rationale": "UTXO consistency (non-witness UTXO hashes to the outpoint, agrees with the witness UTXO and with expectedUTXOs), redeem and witness scripts must hash to the output, SIGHASH restricted to the allowed set (ALL by default), legacy inputs need the previous transaction, only P2WPKH / P2PKH / multisig templates. Without expectedUTXOs or a non-witness UTXO the amount of a SegWit input is not verified.",258      "finding_id": "QYV-SVC-008"259    },260    {261      "module": "QyvoraBitcoin",262      "file": "Sources/QyvoraBitcoin/PSBT.swift",263      "line": 688,264      "construct": "PSBT.combine / finalize / extractTransaction: parallel array subscripts",265      "input_source": "PSBT",266      "verdict": "safe",267      "rationale": "Combination requires identical unsigned transactions (hence equal counts); finalization verifies every partial signature with low-s and the declared SIGHASH; extraction verifies the inputs whose UTXO is known."268    },269    {270      "module": "QyvoraBitcoin",271      "file": "Sources/QyvoraBitcoin/Descriptor.swift",272      "line": 411,273      "construct": "OutputDescriptor(parsing:) and DescriptorKey(parsing:)",274      "input_source": "watch-only package, user input",275      "verdict": "safe",276      "rationale": "At most 8 192 bytes; the body is restricted to the descriptor character set before any structural parsing; checksum verified when present (required for a package); no recursion (three fixed templates); numbers are at most 10 ASCII digits below 2^31; private keys and hardened steps after an extended key are refused; at most 20 keys, no duplicate, one network."277    },278    {279      "module": "QyvoraBitcoin",280      "file": "Sources/QyvoraBitcoin/TransactionBuilder.swift",281      "line": 200,282      "construct": "BitcoinTransactionBuilder: UInt64 / Int64 sums over candidates",283      "input_source": "unspent outputs from the indexer",284      "verdict": "fixed",285      "rationale": "Input totals and effective values could overflow with candidates totalling more than 2^63; the candidate total is now bounded to 21 million BTC before any arithmetic.",286      "finding_id": "QYV-SVC-003"287    },288    {289      "module": "QyvoraBitcoin",290      "file": "Sources/QyvoraBitcoin/TransactionBuilder.swift",291      "line": 301,292      "construct": "Int64(costOfChange), Int64(fixedFee), weight sums with inputWeightOverride",293      "input_source": "caller-supplied fee rates and weights",294      "verdict": "not-reachable",295      "rationale": "The service fixes maximumFeeRate at 1 000 sat/vB, passes no long-term rate and no weight override, so these values stay far below the range. A direct caller of the library passing a fee rate near UInt64.max / 2 or a weight near Int.max would trap: API precondition, not untrusted input."296    },297    {298      "module": "QyvoraBitcoin",299      "file": "Sources/QyvoraBitcoin/CoinSelection.swift",300      "line": 68,301      "construct": "FeeRate.fee / fromEstimate",302      "input_source": "fee estimates from the indexer",303      "verdict": "safe",304      "rationale": "Estimates must be finite, non-negative and <= 1 000 000 sat/vB before the Double conversion; multiplication reports overflow and saturates."305    },306    {307      "module": "QyvoraBitcoin",308      "file": "Sources/QyvoraBitcoin/Account.swift",309      "line": 182,310      "construct": "BIP84Account.nextUnusedIndex: max + 1",311      "input_source": "used indices (synchronization: < 2 000; stored profile)",312      "verdict": "not-reachable",313      "rationale": "Indices produced by the synchronization are below maximumScanIndex. A stored profile holding UInt32.max would trap here (see QYV-SVC-011: the profile is not authenticated)."314    },315    {316      "module": "QyvoraBitcoin",317      "file": "Sources/QyvoraBitcoin/Signing.swift",318      "line": 172,319      "construct": "BitcoinVerifier.verifyInput / checkMultisig",320      "input_source": "transactions and PSBTs",321      "verdict": "safe",322      "rationale": "Stack shapes are checked before subscripts (witness count == 2, multisig stack == k + 1 with an empty dummy); unknown scripts are reported as unsupported, never as valid."323    },324    {325      "module": "QyvoraStorage",326      "file": "Sources/QyvoraStorage/BinaryCoding.swift",327      "line": 102,328      "construct": "ByteReader (big-endian): raw, u8...u64, prefixed8/16/32",329      "input_source": "vault file, backup file, identity objects, envelopes",330      "verdict": "safe",331      "rationale": "Typed throws; every read checks count >= 0 and remaining; length prefixes are compared with a caller maximum before the read."332    },333    {334      "module": "QyvoraStorage",335      "file": "Sources/QyvoraStorage/BinaryCoding.swift",336      "line": 62,337      "construct": "ByteWriter.prefixed8/16/32 preconditions",338      "input_source": "internal",339      "verdict": "not-reachable",340      "rationale": "Writers receive fields whose sizes are fixed by the suite or were read with the same prefix width; the PIN is checked against 65 535 bytes before prefixed16."341    },342    {343      "module": "QyvoraStorage",344      "file": "Sources/QyvoraStorage/BinaryCoding.swift",345      "line": 188,346      "construct": "Base64URL.decode",347      "input_source": "QR frames, identity text",348      "verdict": "safe",349      "rationale": "Table lookup on a byte; canonical form enforced; no padding accepted."350    },351    {352      "module": "QyvoraStorage",353      "file": "Sources/QyvoraStorage/SecureEnclaveKey.swift",354      "line": 88,355      "construct": "EnclaveECIES.open: fixed slices",356      "input_source": "device slot blob of the vault file",357      "verdict": "safe",358      "rationale": "Minimum length (1 + 65 + 12 + 16) and version checked before slicing; CryptoKit errors mapped to invalidData."359    },360    {361      "module": "QyvoraVault",362      "file": "Sources/QyvoraVault/VaultFile.swift",363      "line": 271,364      "construct": "VaultFile.parse",365      "input_source": "vault file on disk",366      "verdict": "safe",367      "rationale": "Size <= 64 MiB; magic, version and minimum length before any subscript; SHA-256 checksum before structural parsing; header <= 65 536 bytes; slot types strictly increasing; fixed slot sizes; KDF parameters must be within limits; record count bounded by the body size; record <= 16 MiB + tag; duplicate record identifiers refused; trailing bytes refused. The HMAC under the master key is verified before any record is used."368    },369    {370      "module": "QyvoraVault",371      "file": "Sources/QyvoraVault/Vault.swift",372      "line": 46,373      "construct": "Vault.seconds: UInt64(Double)",374      "input_source": "record dates from a restored backup",375      "verdict": "fixed",376      "rationale": "Trapped for dates whose interval is 2^64 or more; now saturating.",377      "finding_id": "QYV-SVC-005"378    },379    {380      "module": "QyvoraVault",381      "file": "Sources/QyvoraVault/Vault.swift",382      "line": 697,383      "construct": "persist: generation + 1, rotateMasterKey: epoch + 1",384      "input_source": "vault file",385      "verdict": "not-reachable",386      "rationale": "Both values come from a file whose HMAC verified under the master key; an attacker without the key cannot set them to the maximum."387    },388    {389      "module": "QyvoraVault",390      "file": "Sources/QyvoraVault/VaultCrypto.swift",391      "line": 229,392      "construct": "KDFParameters.isWithinLimits",393      "input_source": "vault and backup headers",394      "verdict": "open-finding",395      "rationale": "Lower bounds prevent a division by zero or a degenerate Argon2 call; upper bounds (2 GiB, 64 passes) still allow a denial of service on a phone.",396      "finding_id": "QYV-SVC-012"397    },398    {399      "module": "QyvoraRecovery",400      "file": "Sources/QyvoraRecovery/BackupFile.swift",401      "line": 225,402      "construct": "BackupFile.parse / open",403      "input_source": "backup file, transfer package payload",404      "verdict": "safe",405      "rationale": "Size <= 256 MiB; magic, version, minimum length and checksum first; header <= 128 KiB; record count <= 100 000 and equal to the count in the authenticated plaintext; signature present if and only if a signer is named, verified before the key derivation and never ignored; each record carries a SHA-256 digest; duplicate identifiers refused; trailing bytes refused."406    },407    {408      "module": "QyvoraRecovery",409      "file": "Sources/QyvoraRecovery/BackupFile.swift",410      "line": 373,411      "construct": "recordBody: UInt64(Double) on record dates",412      "input_source": "records read from a vault or a backup",413      "verdict": "fixed",414      "rationale": "Same conversion as Vault.seconds; now saturating.",415      "finding_id": "QYV-SVC-005"416    },417    {418      "module": "QyvoraRecovery",419      "file": "Sources/QyvoraRecovery/QRChunks.swift",420      "line": 121,421      "construct": "QRAssembler.add / assemble",422      "input_source": "scanned QR frames",423      "verdict": "safe",424      "rationale": "Four colon-separated fields; index and total are 1-4 digits without leading zero, index <= total <= 9 999; checksum 16 lower-case hex digits; frame data 1...2 048 bytes of strict base64url; conflicting duplicates and mixed sets refused; memory bounded to about 20 MB; SHA-256 prefix over the reassembled payload."425    },426    {427      "module": "QyvoraRecovery",428      "file": "Sources/QyvoraRecovery/RecoverySheet.swift",429      "line": 109,430      "construct": "RecoverySheet.make / fromJSON",431      "input_source": "recovery phrase from the vault, JSON",432      "verdict": "safe",433      "rationale": "Address count bounded to 0...1 000 before the UInt32 conversion; Codable decoding throws on malformed JSON."434    },435    {436      "module": "QyvoraIdentity",437      "file": "Sources/QyvoraIdentity/Identity.swift",438      "line": 177,439      "construct": "PublicIdentity / IdentitySignature / Identity(privateEncoding:) / RotationCertificate / RotationChain decoders",440      "input_source": "QR frames, transfer packages, backup signer field, vault records",441      "verdict": "safe",442      "rationale": "Magic, version and suite checked; exact key and signature sizes; ML-KEM encapsulation key validated (FIPS 203 modulus check); purposes restricted to 1...64 characters of a fixed alphabet; chains limited to 64 certificates of at most 512 KiB; trailing bytes refused; private keys are checked against the public identity."443    },444    {445      "module": "QyvoraIdentity",446      "file": "Sources/QyvoraIdentity/HybridEnvelope.swift",447      "line": 144,448      "construct": "HybridEnvelope(encoded:) / open",449      "input_source": "transfer package",450      "verdict": "safe",451      "rationale": "Field lengths bounded (payload <= 64 MiB + tag, signature <= 128 KiB); ML-KEM ciphertext size exact; recipient fingerprint and signature are verified before decapsulation; the key schedule binds both shared secrets, both fingerprints, the recipient keys, the ephemeral key, the ciphertext and the content type; implicit rejection of ML-KEM ends in an AES-GCM failure; an all-zero X25519 secret is refused."452    },453    {454      "module": "QyvoraIdentity",455      "file": "Sources/QyvoraIdentity/X25519.swift",456      "line": 70,457      "construct": "X25519 (CryptoKit)",458      "input_source": "peer public keys",459      "verdict": "safe",460      "rationale": "No from-scratch ladder: CryptoKit performs clamping and the constant-time ladder; key sizes checked; an all-zero shared secret (low-order point) is refused."461    },462    {463      "module": "QyvoraNetworking",464      "file": "Sources/QyvoraNetworking/HTTP.swift",465      "line": 97,466      "construct": "URLSessionTransport.send: unbounded body",467      "input_source": "any endpoint",468      "verdict": "fixed",469      "rationale": "The body is now streamed with a 32 MiB limit.",470      "finding_id": "QYV-SVC-007"471    },472    {473      "module": "QyvoraNetworking",474      "file": "Sources/QyvoraNetworking/HTTP.swift",475      "line": 195,476      "construct": "EndpointConfiguration.isAcceptable",477      "input_source": "user-configured endpoints, stored profile",478      "verdict": "safe",479      "rationale": "https for any host without credentials in the URL; http only for localhost, .local, .onion and private or loopback IPv4 literals (four decimal octets, each parsed with a length limit); other schemes refused. Redirects are refused by the session delegate; ephemeral session without cookies, cache or credential storage; default TLS validation, no custom trust delegate."480    },481    {482      "module": "QyvoraNetworking",483      "file": "Sources/QyvoraNetworking/Esplora.swift",484      "line": 95,485      "construct": "EsploraAddressStats.isUsed / hasSpent: Int addition",486      "input_source": "Esplora JSON",487      "verdict": "fixed",488      "rationale": "Counters are now compared, not added.",489      "finding_id": "QYV-SVC-002"490    },491    {492      "module": "QyvoraNetworking",493      "file": "Sources/QyvoraNetworking/Esplora.swift",494      "line": 116,495      "construct": "Esplora JSON decoding (Codable) and path construction",496      "input_source": "Esplora JSON, addresses and txids placed in URLs",497      "verdict": "safe",498      "rationale": "Codable throws on a wrong type or an integer outside the field's range; addresses and txids are restricted to alphanumeric text of bounded length before they enter a path; broadcast answers are compared with the locally computed txid."499    },500    {501      "module": "QyvoraNetworking",502      "file": "Sources/QyvoraNetworking/EthereumRPC.swift",503      "line": 112,504      "construct": "JSON-RPC results: quantity, data, receipts, logs",505      "input_source": "JSON-RPC answers",506      "verdict": "safe",507      "rationale": "Quantities must be 0x-prefixed hex of at most 64 digits; 64-bit fields go through .uint64 (nil when larger); fee data is refused above 10 000 gwei; missing members throw invalidResponse; chain id and nonce require agreement of every answering endpoint."508    },509    {510      "module": "QyvoraNetworking",511      "file": "Sources/QyvoraNetworking/Indexers.swift",512      "line": 92,513      "construct": "EthereumIndexer.number: UInt64(Double); tokenDecimals: Int(UInt64)",514      "input_source": "Blockscout JSON",515      "verdict": "fixed",516      "rationale": "Both conversions trapped on out-of-range numbers; now checked.",517      "finding_id": "QYV-SVC-001"518    },519    {520      "module": "QyvoraNetworking",521      "file": "Sources/QyvoraNetworking/Indexers.swift",522      "line": 188,523      "construct": "PriceClient: URLComponents(...)! and c.url!",524      "input_source": "configured price endpoint, asset identifiers",525      "verdict": "not-reachable",526      "rationale": "The base URL passed isAcceptable and URL(string:); identifiers are restricted to a-z, 0-9 and '-'; the path always begins with '/', so URLComponents cannot fail to produce a URL. Prices must be finite numbers and are bounded again by the service (< 1e12)."527    },528    {529      "module": "QyvoraWallet",530      "file": "Sources/QyvoraWallet/WalletService+Bitcoin.swift",531      "line": 381,532      "construct": "WalletService.check: bounds of an indexer transaction",533      "input_source": "Esplora JSON",534      "verdict": "safe",535      "rationale": "txid shape; 1...25 000 inputs and outputs; values <= 21 million BTC with running totals; scripts <= 10 000 bytes of hex; vout 0...99 999 before UInt32; block height 0...99 999 999; a transaction must involve the address it was listed for; two versions of one txid are refused."536    },537    {538      "module": "QyvoraWallet",539      "file": "Sources/QyvoraWallet/WalletService+Bitcoin.swift",540      "line": 218,541      "construct": "performBitcoinSync: unspent-output total",542      "input_source": "Esplora JSON",543      "verdict": "fixed",544      "rationale": "Each output was bounded and cross-checked with its transaction when known, but the total was not; now bounded.",545      "finding_id": "QYV-SVC-003"546    },547    {548      "module": "QyvoraWallet",549      "file": "Sources/QyvoraWallet/WalletService+Bitcoin.swift",550      "line": 692,551      "construct": "review(psbt): sums and subscripts",552      "input_source": "PSBT",553      "verdict": "safe",554      "rationale": "1...1 000 inputs and outputs; outputValue checked before the per-output sums; ownership established by deriving the wallet's own keys (PSBT derivations are hints only); change is recognised by derivation on the internal chain."555    },556    {557      "module": "QyvoraWallet",558      "file": "Sources/QyvoraWallet/WalletService+Ethereum.swift",559      "line": 444,560      "construct": "buildEthereumReview / checkSignable: fee and gas arithmetic",561      "input_source": "JSON-RPC answers, cold payloads",562      "verdict": "safe",563      "rationale": "Reporting multiplication and addition throughout; gas estimate bounded to 21 000...30 000 000 before the margin and refused above 200 000; maxFeePerGas below 100 000 gwei; chain id must be the active network's (EIP-155 replay protection inside the type-2 payload); contract creation and access lists refused; call data <= 4 096 bytes."564    },565    {566      "module": "QyvoraWallet",567      "file": "Sources/QyvoraWallet/WalletService+Market.swift",568      "line": 131,569      "construct": "market quotes and charts",570      "input_source": "CoinGecko JSON",571      "verdict": "safe",572      "rationale": "Prices finite, >= 0 and < 1e12; changes bounded; sparkline <= 400 points; chart <= 20 000 points; no Double to integer conversion."573    },574    {575      "module": "QyvoraWallet",576      "file": "Sources/QyvoraWallet/Support.swift",577      "line": 187,578      "construct": "QRExport.text(from:)",579      "input_source": "pasted text or QR frames",580      "verdict": "safe",581      "rationale": "UTF-8 validated; assembler errors mapped; callers bound the text (PSBT 2 000 000, Ethereum payload 20 000 characters)."582    },583    {584      "module": "QyvoraWallet",585      "file": "Sources/QyvoraWallet/WalletService+Onboarding.swift",586      "line": 209,587      "construct": "importWatchOnly(package:)",588      "input_source": "QR frames, pasted JSON",589      "verdict": "safe",590      "rationale": "Codable decoding; format and version checked; the descriptor (checksum required) must describe the same account as the key next to it; mainnet keys refused unless mainnet is enabled; private extended keys refused."591    },592    {593      "module": "QyvoraWallet",594      "file": "Sources/QyvoraWallet/WalletTypes.swift",595      "line": 268,596      "construct": "WalletProfile decoding",597      "input_source": "wallet-profile.json (local, unauthenticated)",598      "verdict": "open-finding",599      "rationale": "Tolerant Codable decoding; the values are trusted afterwards (account keys, used indices, token decimals, durations). The trapping uses found were bounded (QYV-SVC-006); the lack of authentication is QYV-SVC-011.",600      "finding_id": "QYV-SVC-011"601    },602    {603      "module": "QyvoraQuantumShield",604      "file": "Sources/QyvoraQuantumShield/ShieldReport.swift",605      "line": 511,606      "construct": "Int(seconds / 60), Int(interval / 86 400)",607      "input_source": "stored profile",608      "verdict": "fixed",609      "rationale": "Bounded before the conversion.",610      "finding_id": "QYV-SVC-006"611    },612    {613      "module": "QyvoraMigration",614      "file": "Sources/QyvoraMigration/Migration.swift",615      "line": 173,616      "construct": "MigrationEngine: static registry, size ratios",617      "input_source": "none (constants)",618      "verdict": "safe",619      "rationale": "No external input; arithmetic on constants."620    }621  ],622  "protocol": [623    {624      "topic": "Review-before-sign integrity",625      "verdict": "verified",626      "evidence": "BitcoinSendPlan (WalletTypes.swift:464), EthereumSendReview (WalletTypes.swift:706) and BitcoinTransactionPlan (TransactionBuilder.swift:132) have only `let` members and no public initializer: the interface cannot build or alter one. signAndBroadcastBitcoin re-validates the plan against the snapshot (inputs, amounts, fee), compares the txid, the outputs and the lock time of the signed transaction with the plan, and verifies every signature; signEthereum re-decodes the signed bytes and requires equality with the reviewed transaction and the expected sender."627    },628    {629      "topic": "Mainnet gate and unaudited limits",630      "verdict": "verified",631      "evidence": "requireAllowed (WalletService.swift:216) is reached through bitcoinAccount() / ethereumAccount() / verifiedEsplora / verifiedRPC by every prepare, sign and synchronize entry point; the gate needs both the build declaration and the user opt-in (MainnetPolicy.mainnetEnabled, Networks.swift:112) and a stored profile cannot widen it (WalletService.swift:160). Value ceilings are enforced at prepare (buildBitcoinPlan, buildEthereumReview) and again at sign (validate, signPSBT, finalizeAndBroadcastPSBT, signEthereum). Fees are outside the ceilings: QYV-SVC-009."632    },633    {634      "topic": "Replay protection",635      "verdict": "verified",636      "evidence": "Ethereum: the chain id is the first field of the signed type-2 payload (Transaction.swift:92) and checkSignable refuses a chain id other than the active network's (WalletService+Ethereum.swift:574). Bitcoin has no replay protection across forks that share history: a signature valid on one fork is valid on the other; the wallet relies on the networks having distinct histories (mainnet, testnet, signet)."637    },638    {639      "topic": "Nonce rule",640      "verdict": "verified",641      "evidence": "prepare reads latest and pending counts through quorum (all answering endpoints must agree), refuses when they differ unless replacePending is set, and uses the latest count (WalletService+Ethereum.swift:457). The nonce is not re-read at signing time; a review that waited may replace a newer pending transaction of the same nonce."642    },643    {644      "topic": "Bitcoin signatures",645      "verdict": "verified",646      "evidence": "BIP-143 preimage and legacy digest reviewed against the specifications; only SIGHASH_ALL is signed by the service (PSBT.SigningOptions default, BIP84Account.sign); every produced transaction is verified by BitcoinVerifier before it is returned; RBF is signalled (0xfffffffd) and the lock time follows the tip (anti-fee-sniping). Taproot spending is not implemented (P2TR is only recognised as a destination)."647    },648    {649      "topic": "Fee and dust handling",650      "verdict": "verified",651      "evidence": "Fee rate bounded by minimum relay and 1 000 sat/vB; absolute fee capped at 1 000 000 sat; the paid fee must lie between the required fee and required + tolerance (absurd-fee guard); recipients below their dust threshold are refused; a remainder below dust goes to the fee and is reported (`dustAddedToFee`); change goes to the next unused internal address derived by the wallet."652    },653    {654      "topic": "Vault format",655      "verdict": "verified",656      "evidence": "Slots: AES-256-GCM wrap of the master key under HKDF(Argon2id || PBKDF2-HMAC-SHA512) with associated data binding version, vault id, slot type and key epoch; records sealed under an HKDF subkey with associated data binding record id, type, creation time and epoch; the whole file is authenticated by HMAC-SHA256 under a subkey, verified right after any slot opens; replaced content is scrubbed from the `.previous` copy on password change, record update or deletion, slot removal and key rotation. A rollback to an older complete file is not detectable without an external counter: an attacker holding an old file and the old password could already decrypt that file offline."657    },658    {659      "topic": "Keychain and Secure Enclave attributes",660      "verdict": "verified",661      "evidence": "Generic-password items with kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, never synchronizable, data-protection Keychain (KeychainStore.swift:77-112); the device key adds SecAccessControl .biometryCurrentSet; the Secure Enclave key is P-256 key agreement with kSecAttrAccessibleWhenUnlockedThisDeviceOnly + .privateKeyUsage (SecureEnclaveKey.swift:130). Not exercised on hardware by this review (tests use InMemoryKeychainStore and SoftwareEnclaveKey)."662    },663    {664      "topic": "File storage",665      "verdict": "verified",666      "evidence": "Atomic replace through a temporary file, fsync and rename(2); NSFileProtectionComplete on iOS; isExcludedFromBackup on the directory and on every file (FileStore.swift:220). Temporary files of an interrupted write are not cleaned up (they hold the same ciphertext as the vault)."667    },668    {669      "topic": "Secrets in errors and logs",670      "verdict": "verified",671      "evidence": "No print, NSLog, os_log or Logger call in the eleven modules reviewed; error enums carry fixed labels, status codes, positions of unknown words and server text truncated to 300-400 characters, never key material, phrases or passwords; SecretBytes prints as <redacted>."672    }673  ]674}675
Files main
Menu

Theme