Updates to scanner with CVE saving and auto update

This commit is contained in:
Mark Gregory
2026-10-22 18:01:41 +01:00
parent ee37674a2a
commit 2f5e67add3
7 changed files with 48 additions and 3 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

+5 -1
View File
@@ -388,7 +388,11 @@ extension VulnerabilityService {
// A package from a third-party PPA or custom repository cannot be
// certified solely using the Ubuntu distribution advisory.
// Require positive repository provenance before issuing a verdict.
let hasUbuntuOrigin = false // Conservative: repository listing does not prove installed-version origin.
let hasUbuntuOrigin = report.packageOrigins.contains { line in
// Only an explicit, independently verified installed-version attestation
// may unlock vendor conclusions. Repository listings alone never qualify.
line == "VERIFIED_INSTALLED_ORIGIN|ubuntu|" + report.ubuntuCodename
}
guard hasUbuntuOrigin else {
return assessments.map { original in
var item = original
+10 -1
View File
@@ -21,7 +21,16 @@ APP="$DERIVED/Build/Products/Debug/PHPGuard.app"
exit 1
}
"$ROOT/Scripts/install-app-icon.sh" "$APP"
# Xcode generates AppIcon.icns from Assets.xcassets.
# Verify that the compiled application contains its icon.
ICON="$APP/Contents/Resources/AppIcon.icns"
if [[ ! -s "$ICON" ]]; then
echo "ERROR: Compiled PHPGuard application icon missing: $ICON" >&2
exit 1
fi
echo "PHPGuard application icon verified."
echo
echo "Build complete: $APP"
+9 -1
View File
@@ -1 +1,9 @@
xcodebuild -list -project PHPGuard.xcodeproj
#!/bin/zsh
set -euo pipefail
cd "$(dirname "$0")/.."
python3 -m unittest discover -s tests -v
if [[ "$(uname -s)" == "Darwin" ]] && command -v xcodebuild >/dev/null 2>&1; then
xcodebuild -project PHPGuard.xcodeproj -scheme PHPGuard -configuration Debug -derivedDataPath .build CODE_SIGNING_ALLOWED=NO build
else
echo "SKIP: Xcode build requires macOS/Xcode"
fi
+8
View File
@@ -20,3 +20,11 @@ The scan collects package inventory and upstream NVD PHP CVE *candidates*. A ver
5. Run Xcode build, UI checks, signing and notarization on macOS; this archive has not been built in Xcode here.
This package is a security-hardening development snapshot, **not a production release**.
## Build verification update
`Scripts/test.sh` executes the Python scanner safety regressions and (on macOS) an Xcode Debug build. The project does not yet have an XCTest target.
The hard-coded unreachable Ubuntu branch has been replaced with an explicit attestation check. **The scanner does not emit such attestations**; Ubuntu advisory verdicts therefore remain Unverified until installed-version origin can be independently verified. Do not manufacture this marker from repository listings.
Unassigned application icon images have been removed from this source archive.
+16
View File
@@ -20,6 +20,22 @@ class ScannerTests(unittest.TestCase):
def test_no_package_mutation(self):
for command in ('apt upgrade','apt install','dnf update','yum update','apk upgrade','zypper update'):
self.assertNotIn(command,self.script)
def test_provenance_guard_is_not_hardcoded_false(self):
code=(ROOT/'PHPGuard/VulnerabilityService.swift').read_text()
self.assertNotIn('let hasUbuntuOrigin = false',code)
self.assertIn('VERIFIED_INSTALLED_ORIGIN|ubuntu|',code)
# Scanner does not issue an attestation from apt-cache policy alone.
self.assertNotIn('VERIFIED_INSTALLED_ORIGIN|ubuntu|',self.script)
def test_no_false_secure_claims(self):
code=(ROOT/'PHPGuard/VulnerabilityService.swift').read_text()
self.assertIn('Unverified',code)
def test_icon_assets_are_assigned(self):
import json
directory=ROOT/'PHPGuard/Assets.xcassets/AppIcon.appiconset'
metadata=json.loads((directory/'Contents.json').read_text())
assigned={i.get('filename') for i in metadata['images']}
unassigned={p.name for p in directory.glob('*.png')}-assigned
self.assertFalse(unassigned,unassigned)
def test_unknown_vendor_not_verified(self):
store=(ROOT/'PHPGuard/AuditStore.swift').read_text()
self.assertIn('No vendor advisory adapter for this distribution',store)