Skip to content

Validate legacy settings before flash writes - #660

Draft
Jacksper13 wants to merge 1 commit into
dev-v2.4.0from
fix/legacy-settings-overflow
Draft

Validate legacy settings before flash writes#660
Jacksper13 wants to merge 1 commit into
dev-v2.4.0from
fix/legacy-settings-overflow

Conversation

@Jacksper13

Copy link
Copy Markdown
Collaborator

Summary

  • validate serialized legacy settings size before selecting or erasing a flash slot
  • replace the invalid lowercase assert false with an explicit ValueError
  • add a regression test covering oversized settings and the no-flash-selection invariant

Background

The legacy internal-flash settings backend attempted to reject JSON larger than its 8,160-byte data area with assert false. Because Python boolean literals are capitalized, that path raised NameError. It also selected a flash slot before checking the serialized size, allowing an oversized save attempt to perform flash management before failing.

This backend is retained for the Passport Founders Edition v1-to-v2 settings migration; current user settings use the external settings backend.

Validation

  • focused overflow-path test with MicroPython modules stubbed
  • Python syntax compilation
  • pycodestyle on the changed Python files
  • git diff --check

@Jacksper13
Jacksper13 requested a review from eupn August 7, 2026 16:19
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