Repository navigation
[FEATURE/SECURITY/BUG] Add hash key validation to check the files downloaded from external projects #3418
Copy link
Copy link
Open
Labels
Type: BugSomething isn't workingSomething isn't working
Description
Activity
- changed the title
[-][FEATURE/SECURITY/BUG] Add harsh key validation to check the files downloaded from external projects[/-][+][FEATURE/SECURITY/BUG] Add hash key validation to check the files downloaded from external projects[/+]on Mar 4, 2026 Hi @acassis,
I would like to take this up!
Looking into the repository, we actually already have
apps/tools/check-hash.shin tree (added around NuttX 7.29), but currently only 5 packages (inih,psmq,embedlog,rtttl-c,morsey) utilize it. Flagship packages like LVGL, zlib, and others still download archives without validation.I propose the following approach:
-
Enhance
apps/tools/check-hash.sh:- Add
md5support alongsidesha1|sha224|sha256|sha384|sha512. - Replace legacy
whichchecks with POSIXcommand -v. - Add a fallback to Python 3's
hashlibif neither<algo>sumnorshasumis available on the host build environment. - Normalize hash comparison to be case-insensitive.
- Add
-
Standardize Makefile & CMake Integration:
- Define
CHECKHASH ?= $(APPDIR)/tools/check-hash.shcentrally inapps/Make.defsso individual Makefiles do not need ad-hoc tool paths. - Allow optional hash overrides (e.g.,
LVGL_SHA256 ?= ...), skipping validation gracefully only if an upstream hash is explicitly cleared or pointing to an unversioned dev branch. - Add matching
URL_HASHvalidation inCMakeLists.txt(FetchContent_Declare).
- Define
-
Rollout:
- Start with
graphics/lvgl(and optionallysystem/zlib) as the primary pilot PR, followed by rolling it out systematically to the remaining external packages.
- Start with
Please let me know if this plan looks good to you, and feel free to assign this issue to me.
-
Thanks @Swatantra-66 yes please provide the PR with solution proposition :-)
- MD5 is not considered secure, we should use SHA256+ where possible.
- okay to replace
whichwithcommand -v. - For now I would avoid Python in the
*.shscripts. We have clear separation of interpreters and dependencies. Python became moving target while shell is stable. We may want to fallback to pythoh when we hit a wall with existing problem, or create a dedicated python script for that. For now please avoid mixing the Python in. - okay with lowercase hash comaprison.
- okay with
CHECKHASHcentralization inapps/Make.defs. - okay with optional overrides.
- okay with example implementation in
graphics/lvglandsystem/zlib.
Thank you and have fun! :-)
Reacted by Swatantra Yadav- added 2 commits that reference this issue
on Oct 11, 2026
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't workingSomething isn't working
Description / Steps to reproduce the issue
Currently all external projects are downloaded/compiled without checking if their MD5/SHA are valid, so if their content get modified we will not know, ie:
LVGL_UNPACKNAME = lvgl$(if $ (V),,-q)$(if $ (V),,-Ss)
UNPACK ?= unzip -o
CURL ?= curl -L -O
LVGL_UNPACKDIR =$(WD)/$ (LVGL_UNPACKNAME)
$(LVGL_TARBALL):
$(Q) $ (CURL) $(CONFIG_GRAPH_LVGL_URL)/$ (LVGL_TARBALL)
$(ECHO_BEGIN)"Downloading: $(LVGL_TARBALL)"
$(ECHO_END)
$(ECHO_BEGIN)"Unpacking: $(LVGL_TARBALL) -> $(LVGL_UNPACKNAME)"
$(ECHO_END)
On which OS does this issue occur?
[OS: Linux]
What is the version of your OS?
Ubuntu 24.04
NuttX Version
mainline
Issue Architecture
[Arch: all]
Issue Area
[Area: Examples]
Host information
No response
Verification