Skip to content

fix(rustore): отправляем заголовок ruStoreVerCode - #139

Merged
npinaev merged 2 commits into
Dynamic-Mobile-Security:mainfrom
SergeyOstrouhov:fix/rustore-vercode-header
Jul 21, 2026
Merged

fix(rustore): отправляем заголовок ruStoreVerCode#139
npinaev merged 2 commits into
Dynamic-Mobile-Security:mainfrom
SergeyOstrouhov:fix/rustore-vercode-header

Conversation

@SergeyOstrouhov

Copy link
Copy Markdown

Summary

Restores the RuStore distribution system, which was broken for every package: --distribution_system rustore failed on the very first call with

[CRITICAL] Cannot download application file: Rustore - Failed to get application info. Status: 400, body:

Root cause

Since July 2026 the RuStore backapi.rustore.ru API (behind the kittenx edge proxy) rejects requests that do not carry a client version header, ruStoreVerCode. Without it, both applicationData/overallInfo/{package} and applicationData/download-link return an empty HTTP 400. mdast-cli was not sending this header.

This is not a TLS-fingerprint or User-Agent block (verified: browser TLS impersonation and mobile User-Agents make no difference) and not a per-request anti-bot challenge — a single static header fixes it.

How the server validates the header

Measured against overallInfo:

ruStoreVerCode Response
header absent 400
non-numeric (abc) 400
< 247 (e.g. 246) 417
>= 247 (247 … 999999999) 200

The server enforces only a lower bound (currently 247); it does not require the value to match the current RuStore client release. Any larger integer is accepted.

Change

  • Add the ruStoreVerCode header to the RuStore API requests in get_app_info.
  • Default it to a value far above the bound so it never needs bumping as the real client version changes, and allow overriding it via the MDAST_RUSTORE_VER_CODE environment variable in case RuStore ever raises the minimum.
RUSTORE_VER_CODE = os.environ.get('MDAST_RUSTORE_VER_CODE', '2000000000')

Testing

End-to-end download of a real package now succeeds:

mdast_cli --download_only --distribution_system rustore \
          --rustore_package_name ru.adengi --download_path ./downloads
  • overallInfo → 200, download-link → 200
  • APK downloaded and extracted from the RuStore zip container (valid APK: contains AndroidManifest.xml and classes.dex)
  • Verified both the default constant and the MDAST_RUSTORE_VER_CODE env override are applied.

Сергей Остроухов added 2 commits July 20, 2026 12:51
С июля 2026 RuStore backapi отклоняет запросы без этого заголовка
(пустой HTTP 400), из-за чего скачивание из RuStore не работало.
Сервер требует только число >= 247, поэтому шлём значение с запасом;
переопределяется через переменную окружения MDAST_RUSTORE_VER_CODE.
Бамп версии в __init__.py, setup.py и docker-тегах после фикса RuStore.
@npinaev
npinaev merged commit 708eb3c into Dynamic-Mobile-Security:main Jul 21, 2026
1 check passed
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 participants