Skip to content

fix: harden audit follow-ups and ignore .hermes#706

Merged
rinchen merged 2 commits into
mainfrom
chore/hermes-ignore-audit-hardening
Jul 21, 2026
Merged

fix: harden audit follow-ups and ignore .hermes#706
rinchen merged 2 commits into
mainfrom
chore/hermes-ignore-audit-hardening

Conversation

@rinchen

@rinchen rinchen commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Ignore .hermes/ agent scratch in .gitignore.
  • Harden MeshCore pubkey prefix extraction (requireContactPubKeyPrefix), validate starred message localStorage entries, and debug-log skipped support-bundle Reticulum artifacts.
  • Fix appPanel.roomMessages MeshCore Room false friends across locales, cover the key in i18n quality checks, and translate audited zh radioPanel/rrc English residue.

Test plan

  • Pre-commit staged Vitest (782 tests) + typecheck passed
  • Spot-check App → Clear messages room option label in de/fr/nl
  • Developer support-bundle export still omits unreadable Reticulum config/stack (debug log only)
  • MeshCore room/repeater login with valid 32-byte keys unchanged

Summary by CodeRabbit

  • Bug Fixes

    • Invalid saved starred-message entries are now filtered out during loading to prevent malformed data from impacting starred messages.
    • Repeater and room login flows now use a shared, validated contact-key prefix (with clearer errors), improving matching reliability for invalid credentials.
    • Support-bundle collection now skips unreadable diagnostic files safely and logs sanitized debug details when it does.
  • Localization

    • Corrected “room messages” wording across German, Spanish, French, Indonesian, Japanese, Dutch, and Russian.
    • Updated Chinese UI translations and ensured the shared locale-quality checks include the appPanel.roomMessages key.

Ignore Hermes agent scratch, tighten MeshCore pubkey prefix checks and
starred localStorage parsing, and fix roomMessages false friends plus
audited zh English residue.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6579d589-c574-4fda-8885-36ce92bdbeb6

📥 Commits

Reviewing files that changed from the base of the PR and between ae12181 and 904825f.

📒 Files selected for processing (3)
  • src/main/support-bundle.test.ts
  • src/renderer/lib/meshcoreRepeaterRpcCommon.ts
  • src/renderer/locales/zh/translation.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/support-bundle.test.ts
  • src/renderer/lib/meshcoreRepeaterRpcCommon.ts
  • src/renderer/locales/zh/translation.json

📝 Walkthrough

Walkthrough

The changes add fail-safe diagnostics for Reticulum artifact reads, validate persisted starred messages, centralize MeshCore public-key prefix handling, update localization quality coverage and translations, and ignore the .hermes/ directory.

Changes

Reticulum artifact diagnostics

Layer / File(s) Summary
Reticulum sidecar read diagnostics
src/main/support-bundle.ts, src/main/support-bundle.test.ts
Config and stack read failures now emit sanitized debug messages while returning undefined artifacts; tests cover unreadable paths.

Starred message persistence validation

Layer / File(s) Summary
Starred entry validation
src/renderer/lib/chatPanelProtocolStorage.ts, src/renderer/lib/chatPanelProtocolStorage.test.ts
Persisted starred entries are validated for required fields and finite numeric values before malformed entries are filtered out.

MeshCore public-key prefix validation

Layer / File(s) Summary
Shared prefix contract
src/renderer/lib/meshcoreRepeaterRpcCommon.ts
A shared six-byte prefix helper now rejects contact keys shorter than six bytes, and related comparisons use the shared length constant.
Login and push prefix integration
src/renderer/lib/meshcoreRepeaterLoginRpc.ts, src/renderer/lib/meshcoreRepeaterPrefixPushRpc.ts, src/renderer/lib/meshcoreRoomLoginRpc.ts
MeshCore login and push flows use the shared prefix helper.
Short-key rejection coverage
src/renderer/lib/meshcoreRepeaterPrefixPushRpc.test.ts
The prefix push flow tests rejection of short contact keys before event listening begins.

Localization and repository updates

Layer / File(s) Summary
Room-message localization updates
scripts/check-i18n-quality.mjs, src/renderer/locales/{de,es,fr,id,ja,nl,ru}/translation.json
The roomMessages key is added to localization checks and its translations are updated.
Chinese device and RRC translations
src/renderer/locales/zh/translation.json
Device, display, rebroadcast, and RRC strings are translated from English to Chinese.
Hermes workspace ignore rule
.gitignore
The .hermes/ directory is added to ignored paths.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the two main changes: ignoring .hermes and hardening audit follow-ups.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/hermes-ignore-audit-hardening

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/renderer/lib/meshcoreRepeaterRpcCommon.ts (1)

71-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the shared prefix-length constant throughout the contract.

MESHCORE_PUBKEY_PREFIX_LEN is introduced here, but normalizePubKeyPrefix() and pubKeyPrefixesEqual() still hard-code 6. A future contract change could then make extraction accept a different length than matching does.

Proposed follow-up
-  if (prefix instanceof Uint8Array && prefix.length === 6) {
+  if (prefix instanceof Uint8Array && prefix.length === MESHCORE_PUBKEY_PREFIX_LEN) {
...
-  if (ArrayBuffer.isView(prefix) && prefix.byteLength === 6) {
+  if (ArrayBuffer.isView(prefix) && prefix.byteLength === MESHCORE_PUBKEY_PREFIX_LEN) {
...
-  if (Array.isArray(prefix) && prefix.length === 6) {
+  if (Array.isArray(prefix) && prefix.length === MESHCORE_PUBKEY_PREFIX_LEN) {
...
-  if (a.length !== 6 || b.length !== 6) return false;
+  if (
+    a.length !== MESHCORE_PUBKEY_PREFIX_LEN ||
+    b.length !== MESHCORE_PUBKEY_PREFIX_LEN
+  ) return false;
...
-  for (let i = 0; i < 6; i++) {
+  for (let i = 0; i < MESHCORE_PUBKEY_PREFIX_LEN; i++) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/lib/meshcoreRepeaterRpcCommon.ts` around lines 71 - 87, The
shared prefix-length contract is inconsistent because normalizePubKeyPrefix()
and pubKeyPrefixesEqual() still hard-code 6. Update both functions to use
MESHCORE_PUBKEY_PREFIX_LEN for extraction and comparison, preserving their
existing behavior while ensuring all prefix matching uses the same constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/support-bundle.test.ts`:
- Around line 135-152: Ensure the console.debug spy created in the
support-bundle test is always restored by wrapping the test body after spy
creation in a try/finally block, moving debugSpy.mockRestore() into finally.
Preserve the existing artifact setup and assertions while guaranteeing cleanup
when any assertion or operation fails.

In `@src/renderer/locales/zh/translation.json`:
- Around line 3306-3312: Remove the remaining English text from the Chinese
locale by translating the GPIO and POSIX timezone labels at
src/renderer/locales/zh/translation.json:3306-3312, rebroadcast mode labels at
:3324-3332, display-option labels at :3343-3352, RRC hub selection and favorite
actions at :4388-4397, and remaining RRC room controls and statuses at
:4410-4417; preserve the existing translation keys and descriptions.

---

Nitpick comments:
In `@src/renderer/lib/meshcoreRepeaterRpcCommon.ts`:
- Around line 71-87: The shared prefix-length contract is inconsistent because
normalizePubKeyPrefix() and pubKeyPrefixesEqual() still hard-code 6. Update both
functions to use MESHCORE_PUBKEY_PREFIX_LEN for extraction and comparison,
preserving their existing behavior while ensuring all prefix matching uses the
same constant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c6238ed9-3f2e-4200-9d05-e7ffb9832ec4

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd7db8 and ae12181.

📒 Files selected for processing (19)
  • .gitignore
  • scripts/check-i18n-quality.mjs
  • src/main/support-bundle.test.ts
  • src/main/support-bundle.ts
  • src/renderer/lib/chatPanelProtocolStorage.test.ts
  • src/renderer/lib/chatPanelProtocolStorage.ts
  • src/renderer/lib/meshcoreRepeaterLoginRpc.ts
  • src/renderer/lib/meshcoreRepeaterPrefixPushRpc.test.ts
  • src/renderer/lib/meshcoreRepeaterPrefixPushRpc.ts
  • src/renderer/lib/meshcoreRepeaterRpcCommon.ts
  • src/renderer/lib/meshcoreRoomLoginRpc.ts
  • src/renderer/locales/de/translation.json
  • src/renderer/locales/es/translation.json
  • src/renderer/locales/fr/translation.json
  • src/renderer/locales/id/translation.json
  • src/renderer/locales/ja/translation.json
  • src/renderer/locales/nl/translation.json
  • src/renderer/locales/ru/translation.json
  • src/renderer/locales/zh/translation.json

Comment thread src/main/support-bundle.test.ts Outdated
Comment thread src/renderer/locales/zh/translation.json
Restore the support-bundle console spy in finally, use the shared pubkey
prefix length constant consistently, and translate adjacent zh labels.
@sonarqubecloud

Copy link
Copy Markdown

@rinchen
rinchen merged commit d44d55e into main Jul 21, 2026
13 checks passed
@rinchen
rinchen deleted the chore/hermes-ignore-audit-hardening branch July 21, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant