Proposal: Add automatic bootstrap download on first run for raptoreumd#438
Proposal: Add automatic bootstrap download on first run for raptoreumd#438Germardies wants to merge 2 commits into
Conversation
- Add BootstrapManager class for automatic blockchain bootstrap - Downloads bootstrap.zip and powcache.dat on first start - Fix build errors: -Woverloded-virtual typo in configure.ac - Fix missing includes in bip32.h and lockedpool.cpp - Fix missing ENABLE_WALLET guards in rpcassets.cpp Test on Ubuntu 24.04.4 LTS
JSanchezFDZ
left a comment
There was a problem hiding this comment.
Reviewed the auto-bootstrap downloader. The intent is useful, but there are a few
blocking concerns, mostly around security:
-
Duplicate / mixed scope. This PR's head (
feature/auto-bootstrap,
eb4a1ea) is the exact same commit as #437, and it bundles two unrelated
features — the assetfeeAddresswork inrpc/rpcassets.cppand the bootstrap
downloader — plus incidental changes (lockedpool.cpp,bip32.h,.gitignore).
Please split into one focused PR per feature and close the duplicate; as-is
neither change can be reviewed or merged cleanly. -
No integrity/authenticity check (security).
DownloadFile()fetches
bootstrap.zip/powcache.datover HTTPS but nothing verifies the payload
(no SHA-256, no signature). A compromised or MITM'd bootstrap host could feed a
crafted snapshot. Please verify a published, ideally signed, SHA-256 of the
archive before extracting and abort on mismatch. -
Path traversal / zip-slip (security).
ExtractArchive()uses
archive_write_disk_new()withoutarchive_write_disk_set_options(...). Set
ARCHIVE_EXTRACT_SECURE_NODOTDOT | ARCHIVE_EXTRACT_SECURE_SYMLINKS | ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; otherwise an archive entry with../,
an absolute path, or a symlink can write outside the data directory. The manual
destDir + "/" + archive_entry_pathname()concatenation does not prevent this. -
Error handling. Return values of
archive_write_header()/
archive_write_data_block()are ignored, andExtractArchive()returnstrue
even when the read loop aborts on error, so it can report "Extraction complete"
after a partial/failed extract.DownloadFile()also doesn't set
CURLOPT_FAILONERROR, so an HTTP 4xx/5xx error page is written into
bootstrap.zipand only fails later at extraction. ConsiderCURLOPT_FAILONERROR
and explicitCURLOPT_SSL_VERIFYPEER/CURLOPT_SSL_VERIFYHOST. -
New daemon dependencies. This adds
-lcurl -larchivetoraptoreumd,
which is a meaningful new attack/build surface and complicates depends and
reproducible builds (related to #151). Worth a maintainer decision before
pulling libcurl into the daemon. -
Opt-in/opt-out. It triggers automatically on first run (detecting a missing
blocks/blk00000.dat). Please make it opt-in or at least disableable via a flag,
and note that-reindex, pruned, or custom datadir layouts may misdetect a
"first run".
Automatic Bootstrap Download on First Run for raptoreumd (no QT)
This PR adds automatic blockchain bootstrap downloading when Raptoreum Core is started for the first time with an empty data directory.
What this does
blocks/blk00000.datis missingbootstrap.zipfrom bootstrap.raptoreum.compowcache.datfor faster initialThis is purely a suggestion for improvement!