Repository navigation
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
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.
Summary
initData(auth_date). Data older thanTELEGRAM_MINIAPP_INIT_TTL_MINUTES(default 1440 = 24 h) is rejected, as Telegram recommends.hmac.compare_digest), and requests are refused when no webhook secret is configured.edited_message, channel posts and similar) instead of failing on a missingfrom_user.generate-temp-key --action create_owner|reset_owner|delete_owner|upgrade_owner. A bound key is accepted only by that action. Keys created without--actionwork as before.passkey_challenges.expires_at, which is used by the cleanup of expired challenges on every passkey options request.Behavior change / upgrade notes
initDataolder than 24 hours get403and must be reopened from Telegram. SetTELEGRAM_MINIAPP_INIT_TTL_MINUTESto change the window;0turns the check off.generate-temp-keygets an optional--action/-aoption. Without it, keys behave as before (usable for any setup action), so existing scripts keep working.d3f1a2b4c5e6(index only, no data changes). It is based on the currentdevheadc8d2e4f6a1b3. PR fix(subscription): preserve token revocation timestamp precision #758 also adds a migration (9e0d7a1c4b52) on top of the same head: whichever of the two is merged second must change itsdown_revisionto the other one, otherwise Alembic ends up with two heads.Type of change
Tests
test_miniapp_rejects_stale_init_data-initDataolder than the TTL gets 403.test_miniapp_accepts_fresh_init_data- freshinitDatastill logs in.test_webhook_rejects_missing_or_wrong_secret- empty configured secret, missing or wrong header are refused.test_webhook_accepts_the_configured_secret- the right secret is accepted.test_acl_skips_updates_without_a_sender- anedited_messageupdate and a message withoutfrom_userare skipped without an error.test_bound_key_is_not_consumed_by_another_action- a key bound to one action fails for another and stays unused.test_bound_key_is_consumed_by_its_own_action- a bound key works for its action.test_unbound_key_is_consumed_by_any_action- keys without a binding keep the old behavior.test_mark_temp_key_used_respects_the_binding- marking a key used follows the same rule.test_unknown_used_and_expired_keys_keep_their_errors- existing error messages are unchanged.tests/api/test_setup.py- updated for the unbound key valuepending; 22 passed.Run:
pytest tests/test_miniapp_init_data_ttl.py tests/test_telegram_webhook_and_acl.py tests/test_temp_key_binding.py- 14 passed;pytest tests/api/test_setup.py- 22 passed.Migration check
alembic upgrade headfrom an empty database,downgrade -1andupgrade headagain on MySQL 8.4, MariaDB 11 and PostgreSQL 17: theix_passkey_challenges_expires_atindex is created, dropped and created again;alembic checkis clean; single head.cli/README.mddocuments the new--actionoption.Checklist