fix(pro): preserve signed license fields on heartbeat rewrite#229
Open
rylinjames wants to merge 1 commit into
Open
fix(pro): preserve signed license fields on heartbeat rewrite#229rylinjames wants to merge 1 commit into
rylinjames wants to merge 1 commit into
Conversation
Audit §3.8 / Part 1 #16 (the autonomous part). load_license refreshes the local heartbeat by rewriting the license file from ProLicense.to_dict(). But ProLicense models only a subset of the on-disk envelope, so the rewrite silently DROPPED license_id, max_seats, and key_id — which are part of the signed payload (pro/signature.py). The result: a signed v2 license verifies on first load, gets rewritten without its signed fields, then fails signature verification with LicenseCorrupt on the *second* load. Every paying customer would lock themselves out on the next server restart the moment the Pro tier is wired. Fix: persist the full raw on-disk dict with only last_heartbeat_at bumped (last_heartbeat_at is not in the signed payload, so it never invalidates the signature). Any future envelope field is preserved automatically. Test (tests/test_pro_license.py): a license carrying license_id/max_seats/ key_id survives the heartbeat rewrite across two consecutive loads, with the heartbeat still refreshed. Full pro-license suite (25) passes. Note: the broader Pro wiring gaps (license never read in production; hardware- binding-vs-signature on first activation; heartbeat sends customer_id as license_id; placeholder renewal URLs) need protocol/product decisions and are tracked separately — this PR fixes the unambiguous data-loss bug only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Audit §3.8 / Part 1 #16 — the unambiguous, autonomous part of the Pro-tier findings.
Problem
load_licenserefreshes the local heartbeat by rewriting the license file fromProLicense.to_dict(). ButProLicensemodels only a subset of the on-disk envelope, so the rewrite silently droppedlicense_id,max_seats, andkey_id— which are part of the signed payload (pro/signature.py). Sequence:load_license→verify_license_signature→LicenseCorrupt: missing required field: license_id❌Every paying customer would lock themselves out on the next server restart, the moment the Pro tier is wired.
Fix
Persist the full raw on-disk dict with only
last_heartbeat_atbumped.last_heartbeat_atis not in the signed payload, so it never invalidates the signature, and any future envelope field is preserved automatically.Test
test_heartbeat_rewrite_preserves_unmodelled_signed_fields: a license carryinglicense_id/max_seats/key_idsurvives the heartbeat rewrite across two consecutive loads, heartbeat still refreshed. Full pro-license suite (25) passes.Out of scope (needs decisions — tracked separately)
The broader Pro gaps — license never read in production (
server.pro_licensenever set, no--proflag); hardware-binding-vs-signature on first activation; heartbeat sendingcustomer_idaslicense_id; placeholder renewal URLs — require protocol/product decisions and are not in this PR.🤖 Generated with Claude Code