Skip to content

feat: add packet authenticity policy setting#1261

Draft
RCGV1 wants to merge 4 commits into
meshtastic:mainfrom
RCGV1:codex/packet-auth-policy
Draft

feat: add packet authenticity policy setting#1261
RCGV1 wants to merge 4 commits into
meshtastic:mainfrom
RCGV1:codex/packet-auth-policy

Conversation

@RCGV1

@RCGV1 RCGV1 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Adds Security → Packet authenticity for firmware that reports XEdDSA verification support. The radio-owned receive policy now follows the shipped protocol contract:

  • Compatible — Accept unsigned — the zero/default value; verify signatures when present and retain legacy unsigned traffic.
  • Balanced — Prefer authenticated — reject unsigned, signable broadcasts from known signers while retaining legacy compatibility.
  • Strict — Require authenticated — accept only verified XEdDSA or successfully PKI-authenticated decryptable remote traffic.

Strict requires explicit confirmation and explains that authentication does not establish content truth or freshness.

Implementation

  • gates the selector on an active connection plus DeviceMetadata.has_xeddsa
  • preserves all values through config read, form state, validation, payload conversion, and setRadioSection("security", ...)
  • maps an absent policy to Compatible and removes the old Recommended/default framing from Balanced
  • retains the focused workspace protobuf overlay because the public JSR package is not yet publish-current: installed @jsr/meshtastic__protobufs@2.7.26 does not export packetSignaturePolicy or hasXeddsa, although protobufs#983 is merged. Remove the overlay once a published JSR package contains that schema.

Validation

  • pnpm --filter meshtastic-web test --run src/components/PageComponents/Settings/Security/Security.test.ts src/components/PageComponents/Settings/Security/PacketAuthenticityPolicyField.test.tsx src/validation/config/security.test.ts — 23 passed
  • targeted oxfmt and oxlint checks — passed
  • buf format --diff packages/protobufs/meshtastic/config.proto and git diff --check — passed

The full app typecheck remains blocked by existing SDK-preview / better-result incompatibilities outside this change. The full app format check also reports an existing issue in src/pages/Connections/useConnections.ts.

Evidence and hardware status

This remains a draft. No real-radio configuration round-trip or filtered receive-path verification has been performed.

The repository's approved browser harness is a real-device meshtasticd Docker simulation rather than a fixture route. A freshly pulled 2026-07-21 daily-debian image connects through the normal Web HTTPS flow, but its bd71ad2 firmware build predates the 2026-07-21 merge of firmware#10967 and therefore does not advertise DeviceMetadata.has_xeddsa; the selector is correctly unavailable. I reviewed genuine local captures of that unavailable state in light/dark and desktop/mobile layouts. The remaining 16 captures (Compatible default, Balanced, Strict, and Strict confirmation in each layout/theme) are blocked until a post-merge simulator image or physical radio advertises the capability. No fixture route, production backdoor, or capture artifact has been committed.

Closes #1260
Design: meshtastic/design#121
Depends on meshtastic/protobufs#983 (merged source; published JSR artifact pending)

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

@RCGV1 is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

@RCGV1

RCGV1 commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds configurable packet authenticity policies to the protobuf schema, security validation and persistence flow, and web settings UI. The UI supports capability gating, translated policy descriptions, strict-mode confirmation, and associated component, hook, schema, and persistence tests.

Changes

Packet Authenticity Configuration

Layer / File(s) Summary
Protocol and capability contract
packages/protobufs/meshtastic/config.proto, packages/protobufs/meshtastic/mesh.proto, packages/sdk/package.json, apps/web/src/components/generic/Filter/useFilterNode.test.ts
Adds packet policies, an XEdDSA capability field, workspace protobuf consumption, and updated node fixtures.
Security schema and persistence
apps/web/src/validation/config/security.*, apps/web/src/components/PageComponents/Settings/Security/Security.*
Validates packet policies, maps them between form and protobuf shapes, preserves values during submission, and tests all enum values.
Policy selector and option presentation
apps/web/src/components/Form/FormSelect.tsx, apps/web/src/components/PageComponents/Settings/Security/PacketAuthenticityPolicyField.*, apps/web/public/i18n/locales/en/config.json
Adds translated policy labels and descriptions, capability-based disabling, and reusable per-option display labels.
Strict confirmation flow
apps/web/src/components/PageComponents/Settings/Security/usePacketAuthenticityConfirmation.*, PacketAuthenticityStrictDialog.*, apps/web/public/i18n/locales/en/dialog.json, Security.tsx
Requires confirmation for Strict selection and handles cancellation when capability becomes unavailable.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Security
  participant PacketAuthenticityPolicyField
  participant usePacketAuthenticityConfirmation
  participant PacketAuthenticityStrictDialog
  Security->>PacketAuthenticityPolicyField: Render policy selector and capability state
  PacketAuthenticityPolicyField->>usePacketAuthenticityConfirmation: Validate selected policy
  usePacketAuthenticityConfirmation->>PacketAuthenticityStrictDialog: Open dialog for STRICT
  PacketAuthenticityStrictDialog-->>usePacketAuthenticityConfirmation: Confirm or cancel selection
  usePacketAuthenticityConfirmation-->>PacketAuthenticityPolicyField: Resolve policy validation
  PacketAuthenticityPolicyField-->>Security: Submit selected packet signature policy
Loading

Possibly related issues

  • meshtastic/design#121 — Describes the packet authenticity policy implemented in this change.
  • meshtastic/firmware#10963 — Covers corresponding firmware enforcement for the policy and capability fields.
  • meshtastic/Meshtastic-Android#6176 — Covers equivalent selector, capability gating, and Strict confirmation behavior.
  • meshtastic/Meshtastic-Apple#2065 — Covers corresponding cross-client policy configuration behavior.

Poem

A rabbit hops through settings bright,
Three shielded paths now guide the night.
Strict asks twice before it springs,
Signed packets dance on whiskered wings.
Balanced keeps the mesh just right.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR maps an absent/default policy to Compatible, but #1260 requires absent/default to map to Balanced. Change the absent/default packet_signature_policy mapping to Balanced and recheck the other #1260 acceptance criteria.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changes are focused on packet-authenticity schema, UI, validation, and tests, with no clear unrelated additions.
Title check ✅ Passed The title clearly summarizes the main change: adding a packet authenticity policy setting.
Description check ✅ Passed The PR description covers the feature, implementation, validation, and issue linkage, with only optional template sections like screenshots/checklist omitted.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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)
apps/web/src/components/PageComponents/Settings/Security/usePacketAuthenticityConfirmation.ts (1)

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

Consider sourcing STRICT_POLICY_KEY from the shared enum rather than a private literal.

This string must stay in sync with whatever key format the policy selector/schema uses for the Strict value. Importing it from the protobuf-generated enum (or a shared constants module) would prevent silent drift if the source enum naming changes.

🤖 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
`@apps/web/src/components/PageComponents/Settings/Security/usePacketAuthenticityConfirmation.ts`
at line 3, The private literal used by STRICT_POLICY_KEY can drift from the
policy selector’s canonical Strict value. Replace it with the corresponding
protobuf-generated enum member or shared constant, update imports as needed, and
keep consumers of STRICT_POLICY_KEY unchanged.
🤖 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 `@apps/web/public/i18n/locales/en/dialog.json`:
- Around line 32-36: Update the packetAuthenticityStrict description in
dialog.json to retain the existing disappearing-node warning and explicitly add
that PKI-encrypted direct messages are outside this broadcast policy, while
authentication does not prove the content is truthful or fresh.

In `@packages/protobufs/meshtastic/mesh.proto`:
- Around line 2678-2683: Resolve the unused protobuf tag gap in DeviceMetadata:
either renumber has_xeddsa to field 13 if available, or explicitly declare tag
13 as reserved when it must remain unused.

---

Nitpick comments:
In
`@apps/web/src/components/PageComponents/Settings/Security/usePacketAuthenticityConfirmation.ts`:
- Line 3: The private literal used by STRICT_POLICY_KEY can drift from the
policy selector’s canonical Strict value. Replace it with the corresponding
protobuf-generated enum member or shared constant, update imports as needed, and
keep consumers of STRICT_POLICY_KEY unchanged.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ee48395-07c0-4f1f-b35c-fdfeb1390a2e

📥 Commits

Reviewing files that changed from the base of the PR and between a7f7e8f and 323ec42.

⛔ Files ignored due to path filters (3)
  • packages/protobufs/packages/ts/dist/meshtastic/config_pb.ts is excluded by !**/dist/**
  • packages/protobufs/packages/ts/dist/meshtastic/mesh_pb.ts is excluded by !**/dist/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • apps/web/public/i18n/locales/en/config.json
  • apps/web/public/i18n/locales/en/dialog.json
  • apps/web/src/components/Form/FormSelect.tsx
  • apps/web/src/components/PageComponents/Settings/Security/PacketAuthenticityPolicyField.test.tsx
  • apps/web/src/components/PageComponents/Settings/Security/PacketAuthenticityPolicyField.tsx
  • apps/web/src/components/PageComponents/Settings/Security/PacketAuthenticityStrictDialog.test.tsx
  • apps/web/src/components/PageComponents/Settings/Security/PacketAuthenticityStrictDialog.tsx
  • apps/web/src/components/PageComponents/Settings/Security/Security.test.ts
  • apps/web/src/components/PageComponents/Settings/Security/Security.tsx
  • apps/web/src/components/PageComponents/Settings/Security/usePacketAuthenticityConfirmation.test.tsx
  • apps/web/src/components/PageComponents/Settings/Security/usePacketAuthenticityConfirmation.ts
  • apps/web/src/components/generic/Filter/useFilterNode.test.ts
  • apps/web/src/validation/config/security.test.ts
  • apps/web/src/validation/config/security.ts
  • packages/protobufs/meshtastic/config.proto
  • packages/protobufs/meshtastic/mesh.proto
  • packages/sdk/package.json

Comment thread apps/web/public/i18n/locales/en/dialog.json
Comment thread packages/protobufs/meshtastic/mesh.proto
@RCGV1
RCGV1 force-pushed the codex/packet-auth-policy branch from 323ec42 to edf4cca Compare July 10, 2026 00:18
@RCGV1

RCGV1 commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@RCGV1

RCGV1 commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@RCGV1

RCGV1 commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

Evidence update: I exercised the app against the repository’s two-node meshtasticd Docker simulator using the normal HTTPS connection flow. The freshly pulled 2026-07-21 daily image reports firmware 2.8.0.bd71ad2 / commit bd71ad2, which predates firmware#10967’s 2026-07-21 16:32 UTC merge; it therefore does not advertise DeviceMetadata.has_xeddsa, and the selector correctly renders unavailable. I reviewed light/dark × desktop/mobile unavailable-state captures locally; they are intentionally not committed. The remaining capability-enabled matrix is blocked on a post-merge simulator image or physical radio exposing the capability. No fixture route or production-only test hook was added.

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.

[2.8.0] Configure packet authenticity policy

1 participant