rdmbair15m5-changelog-20260923-0030-xentropy-issue-20260922-08-secret-scopes-and-truthful-transports
rdmbair15m5-changelog-20260923-0030-xentropy-issue-20260922-08-secret-scopes-and-truthful-transports
One-line Summary: Remediated security and scoping
invariants for ISSUE-20260922-08 in XEntropy (enforced
.secretRead/.secretUse authorization scopes,
disabled ambient Messages harvesting, eliminated OTP leaks in simulated
receipts, verified 361/361 tests passing, packaged Universal2 App Store
installer, and resolved ticket on canonical).
Context & Problem Statement
Static review of branches e8781a14,
65eaea48, 88806c57
(xentropy-branch-review.md) identified four
security/architectural defects in pending 2FA and federation
features:
- Generic Credential Read Scope Overreach: Endpoints
/v1/2fa/listand/v1/2fa/latestwere authorized by broad.credentialsRead, allowing callers with metadata read permissions to access raw one-time passcode secrets. - Ambient Chat Harvesting & Auto-Broadcast:
IMessageTwoFactorHarvesterattempted live scraping of~/Library/Messages/chat.dbby default without explicit owner consent, with auto-fanout broadcasting. - Untruthful Transport Status & Receipt Secret
Leakage: Hardware broadcaster fixtures (
Tidbyt,Tronbyt,ESP32,macOSNotification) returnedsuccess: truewith no network transport configured, and echoed raw plaintext OTP codes in log/receipt strings. - Overclaimed Federation Readiness: Mock/stubbed
password manager adapters reported
.availableand"Connected and ready", when live enumeration was not implemented.
Remediation Details
1. Enforced Strict Least-Privilege Scopes
- API Endpoints
(
CatalogAPIHandler.swift):/v1/2fa/listand/v1/2fa/latestnow strictly require.secretRead./v1/2fa/broadcastrequires.secretUse.
- MCP Server Tools
(
StatelessMCPHandler.swift):xentropy_2fa_listandxentropy_2fa_latesttool definitions registered with.secretReadscope.xentropy_2fa_broadcasttool definition registered with.secretUsescope.- Callers without explicit secret scopes cannot discover or invoke these tools.
2. Blocked Ambient Scraping & Disabled Auto-Broadcast
- Harvester Protection
(
TwoFactorHarvesters.swift):IMessageTwoFactorHarvesterdefaultsisLiveHarvestEnabled: Bool = false.- When disabled or unconfigured,
pollRecent()immediately returns[]without touching the filesystem or SQLite databases.
- Service Configuration
(
TwoFactorService.swift):- Default initialization sets
broadcastImmediately: falseandbroadcastHarvested: false.
- Default initialization sets
3. Truthful Transport Receipts & Zero Secret Echoing
- Receipt Contract
(
TwoFactorBroadcasters.swift):- Added
isSimulated: Bool = truetoBroadcastReceipt. - Hardware broadcasters without live configuration report
success: false, isSimulated: true. - Receipt messages sanitized:
"Simulated: Notification framed for [\(code.service)] (delivery unconfigured)", strictly omitting secret codes.
- Added
4. Accurate Federation State
- Adapter Contracts
(
CredentialFederationAdapters.swift,CredentialFederationEngine.swift):- Adapters report
.userSelectedExportOnlyor.unavailable. - Descriptions updated to
"Installed; export or user-selected import required"or"Connected with simulated test fixtures".
- Adapters report
- UI Truthfulness
(
TwoFactorBroadcasterView.swift,FederationWorkbenchView.swift):- Metric cards and previews updated from active/ready to
"SIMULATED"/ preview mode.
- Metric cards and previews updated from active/ready to
Verification & Validation
- Full Regression Test Suite:
swift testinapps/XEntropy: 361/361 tests passing across 4 suites (XEntropyTests: 68,XEntropyGatewayTests: 22,XEntropyCoreTests: 212,XEntropyCLITests: 59).- Added negative tests in
CatalogAPIHandlerTests.swiftverifying generic credentialsRead callers are rejected (403 Forbidden). - Added tests in
TwoFactorHarvesterBroadcasterTests.swiftverifying zero ambient chat DB access and zero OTP leakage in receipt payloads.
- Universal2 Lipo Gate & Packaging:
- Built with
./build.shonrdmsm4x:lipo -archs dist/XEntropy.app/Contents/MacOS/XEntropy->x86_64 arm64lipo -archs dist/xentropy->x86_64 arm64- Signed with Hardened Runtime & App Sandbox under Team
ZU2882L4HT. dist/XEntropy.pkg(6.9 MB) generated with 0 AppleDouble files.
- Built with
- App Store Connect Validation Gate:
./scripts/submit_appstore.zsh --validatecompleted withrc=0.
- Git Operations & Sync:
- Committed changes as
caf72e8onmain. - Pushed to
fleet,origin, andbackupremotes. - Mirrored package to
rdmsm4x:~/dev/apps/dist/XEntropy.pkgandrdmbair15m5:~/dev/apps/dist/XEntropy.pkg.
- Committed changes as
- Issue Resolution:
- Resolved
ISSUE-20260922-08on canonical ticket database atrdmsm4x:~/dev/issues/(commitf6897fe).
- Resolved