Skip to content

Conversation

@d0ugal
Copy link

@d0ugal d0ugal commented Nov 10, 2025

Possibly fixes #931

The trustToken getter re-reads the file and overwrites the in-memory value, causing a race condition where the token is cleared before it's persisted.

Use _resources.trustToken directly when emitting TRUSTED events to avoid the getter's file re-read.

The trustToken getter re-reads the file and overwrites the in-memory value
every time it's accessed. This causes a race condition where:
1. applyTrustResponse() sets the trust token and starts writing to file
2. The TRUSTED event accesses trustToken via getter, re-reading the file
3. The getter overwrites the in-memory value with undefined (old file value)
4. The file write completes, but writes undefined (which gets omitted from JSON)

Fix by using _resources.trustToken directly in the two places where we emit
TRUSTED events immediately after setting the token, avoiding the getter's
file re-read that would overwrite the newly set value.

Fixes issue where MFA is required on every run because trust token isn't
persisted to the resource file.
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.

MFA required on every sync

1 participant