Skip to content

Commit 10b9ade

Browse files
Copilotprobonopd
andcommitted
Address review feedback: remove runtime hash verification and simplify error messages
- Remove strict hash verification for continuous runtime releases (will break on updates) - Add detailed note explaining the limitation and suggesting alternatives (GPG, versioned releases) - Simplify error messages in hash verification scripts (remove unnecessary awk) - Document scan-build and -fanalyzer as future static analysis enhancements - Add note about CI testing requirement for sanitizers to be effective - Update SECURITY.md with all clarifications Co-authored-by: probonopd <2480569+probonopd@users.noreply.github.com>
1 parent e508c0f commit 10b9ade

File tree

4 files changed

+39
-45
lines changed

4 files changed

+39
-45
lines changed

SECURITY.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,42 @@ The project is built with comprehensive compiler warnings enabled to catch poten
1313

1414
These flags help ensure code quality and catch potential security issues at compile time.
1515

16+
### Future Enhancements
17+
18+
Additional static analysis tools that could be integrated:
19+
- **scan-build** (Clang Static Analyzer): Performs code flow analysis to detect issues like null pointer dereferences and use-after-free
20+
- **gcc -fanalyzer**: GCC's built-in static analyzer for similar code flow analysis
21+
1622
## Download Verification
1723

18-
All external dependencies downloaded during the build process are verified using SHA256 hashes:
24+
External dependencies downloaded during the build process are verified where practical:
1925

2026
### Runtime Binaries
2127

22-
The AppImage runtime binaries are downloaded from https://github.com/AppImage/type2-runtime/releases and verified with SHA256 hashes for each architecture:
28+
**Important Note**: The AppImage runtime binaries are downloaded from the `continuous` release at https://github.com/AppImage/type2-runtime/releases.
29+
30+
**Current Limitation**: Hash verification for continuous releases is problematic because:
31+
- Continuous releases are updated regularly
32+
- Hard-coded hashes would break when type2-runtime is updated
33+
- This creates a maintenance burden
2334

24-
- `x86_64`: e70ffa9b69b211574d0917adc482dd66f25a0083427b5945783965d55b0b0a8b
25-
- `i686`: 3138b9f0c7a1872cfaf0e32db87229904524bb08922032887b298b22aed16ea8
26-
- `aarch64`: c1b2278cf0f42f5c603ab9a0fe43314ac2cbedf80b79a63eb77d3a79b42600c5
27-
- `armhf`: 6704e63466fa53394eb9326076f6b923177e9eb48840b85acf1c65a07e1fcf2b
35+
**Current Approach**: The build process prints the SHA256 hash and size of the downloaded runtime for transparency and audit purposes, but does not enforce hash verification.
2836

29-
The build process prints the hash and size of the downloaded runtime for transparency.
37+
**Recommended Future Improvements**:
38+
1. Use GPG signature verification (download `.sig` files and verify with GPG)
39+
2. Switch to versioned/tagged releases instead of continuous
40+
3. Implement automatic hash updates when type2-runtime changes
3041

3142
### Build Tools
3243

33-
External build tools are also verified:
44+
External build tools use strict hash verification:
3445

3546
- **mksquashfs 4.6.1**: SHA256 hash `9c4974e07c61547dae14af4ed1f358b7d04618ae194e54d6be72ee126f0d2f53`
36-
- **zsyncmake 0.6.2**: SHA256 hash `0b9d53433387aa4f04634a6c63a5efa8203070f2298af72a705f9be3dda65af2` (already verified)
47+
- **zsyncmake 0.6.2**: SHA256 hash `0b9d53433387aa4f04634a6c63a5efa8203070f2298af72a705f9be3dda65af2`
3748
- **desktop-file-validate 0.28**: SHA256 hash `379ecbc1354d0c052188bdf5dbbc4a020088ad3f9cab54487a5852d1743a4f3b`
3849

50+
These are versioned dependencies where hash verification is practical and effective.
51+
3952
## Build Provenance Attestation
4053

4154
The GitHub Actions workflow generates cryptographically signed build provenance attestations using GitHub's attestation service. These attestations:
@@ -63,7 +76,13 @@ These sanitizers help detect:
6376
- Memory errors (use-after-free, buffer overflows, memory leaks)
6477
- Undefined behavior (integer overflow, null pointer dereferences, etc.)
6578

66-
Note: Sanitizers cannot be used with static builds and are intended for development/testing only.
79+
**Note**: Sanitizers cannot be used with static builds and are intended for development/testing only.
80+
81+
**Future Enhancement**: To be fully effective, sanitizer builds should be run in CI with both:
82+
- The full application exercising real-world use cases
83+
- Unit tests covering both happy paths and error handling paths
84+
85+
This would catch issues before they reach production.
6786

6887
## Updating Hashes
6988

ci/build.sh

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,14 @@ chmod +x AppDir/AppRun
4545

4646
wget https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-"$ARCH"
4747

48-
# Verify runtime hash for supply chain security
49-
# These hashes are from the continuous release and should be updated when the runtime is updated
50-
case "$ARCH" in
51-
x86_64)
52-
expected_hash="e70ffa9b69b211574d0917adc482dd66f25a0083427b5945783965d55b0b0a8b"
53-
;;
54-
i686)
55-
expected_hash="3138b9f0c7a1872cfaf0e32db87229904524bb08922032887b298b22aed16ea8"
56-
;;
57-
aarch64)
58-
expected_hash="c1b2278cf0f42f5c603ab9a0fe43314ac2cbedf80b79a63eb77d3a79b42600c5"
59-
;;
60-
armhf)
61-
expected_hash="6704e63466fa53394eb9326076f6b923177e9eb48840b85acf1c65a07e1fcf2b"
62-
;;
63-
*)
64-
echo "Warning: Unknown architecture $ARCH, skipping hash verification"
65-
expected_hash=""
66-
;;
67-
esac
68-
69-
if [ -n "$expected_hash" ]; then
70-
echo "Verifying runtime-$ARCH hash..."
71-
echo "$expected_hash runtime-$ARCH" | sha256sum -c || {
72-
echo "ERROR: Runtime hash verification failed for $ARCH"
73-
echo "Expected: $expected_hash"
74-
echo "Got: $(sha256sum runtime-$ARCH | awk '{print $1}')"
75-
exit 1
76-
}
77-
echo "Runtime hash verified successfully"
78-
else
79-
echo "Warning: Runtime hash not verified for $ARCH"
80-
fi
48+
# NOTE: Hash verification for continuous releases has limitations:
49+
# - Continuous releases are updated regularly, causing hash mismatches
50+
# - This will break when type2-runtime is updated
51+
# - For production use, consider:
52+
# 1. Using versioned/tagged releases instead of continuous, OR
53+
# 2. Implementing GPG signature verification (download .sig and verify with GPG), OR
54+
# 3. Automatically updating hashes when type2-runtime changes
55+
# For now, we print the hash for transparency but skip strict verification.
8156

8257
# Print runtime information for transparency
8358
echo "Runtime file: runtime-$ARCH"

ci/install-static-desktop-file-validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if [[ "$version" == "0.28" ]]; then
3232
echo "$expected_hash desktop-file-utils-$version.tar.gz" | sha256sum -c || {
3333
echo "ERROR: desktop-file-utils tarball hash verification failed"
3434
echo "Expected: $expected_hash"
35-
echo "Got: $(sha256sum desktop-file-utils-$version.tar.gz | awk '{print $1}')"
35+
echo "Got: $(sha256sum desktop-file-utils-$version.tar.gz)"
3636
exit 1
3737
}
3838
echo "Tarball hash verified successfully"

ci/install-static-mksquashfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ echo "Verifying mksquashfs tarball hash..."
2828
echo "$expected_hash $version.tar.gz" | sha256sum -c || {
2929
echo "ERROR: mksquashfs tarball hash verification failed"
3030
echo "Expected: $expected_hash"
31-
echo "Got: $(sha256sum $version.tar.gz | awk '{print $1}')"
31+
echo "Got: $(sha256sum $version.tar.gz)"
3232
exit 1
3333
}
3434
echo "Tarball hash verified successfully"

0 commit comments

Comments
 (0)