Repository navigation
Closed
Description
What is broken.
Several comments and documents describe diary and directory behaviour the code does not have. Nothing fails at runtime today. The problem is that each one tells the next reader, or the family on the page, something false:
- A CA bundle nothing reads.
Region.ca_bundleis documented as "a path to a CA file to trust for that origin only". Nothing reads the field, and no region sets it.build_clienttakes no verify or CA argument, yet its own comment tells the reader to put a CA bundle for the Russian Trusted Root "in regions.py". The netschool provider also uses one process-wide client for every region, so there is no per-origin client a bundle could go on. - A keep-alive breaker that does not exist. The
AddressRefuseddocstring says "the keep-alive trips a per-origin breaker on it rather than pinging that origin's other sessions into the same wall". The keep-alive has no breaker and no idea of an origin._Claimdoes not carry the region, andAddressRefusedfalls into a bareexcept Exceptionthat marks the row "skip". TheDiarySession.regioncomment, the 0015 revision andCLAUDE.mdall say the column exists so sessions can be "grouped per origin for the keep-alive", and nothing does that. - A region order that does not match its source.
_REGIONSis headed "Ordered as docs/diaries.md lists them". It is in alphabetical order by title, anddocs/diaries.mdlists republics, then krais, then oblasts. - A password route that skips our server. The
diary_webmodule docstring and theDiaryLinkCodedocstring both say the password goes "from the browser straight to the upstream". In fact the form posts to our own/diary/signin/{code}(CSPform-action 'self'), the handler reads the password and passes it todiary_service.sign_in, and for «Сетевой город» it is hashed in our process.POST /api/v1/diary/logintakes it in the JSON body too. Three user-facing texts make the same claim:- the form: «Пароль уходит прямо в дневник и нигде не сохраняется»
- the bot's offer: «оттуда пароль уходит прямо в дневник»
- the bot's link card: «уходит прямо в дневник — ни бот, ни эта база его не видят»
- "No passwords" on the phone-to-server wire.
docs/build.md, "Why HTTP and not HTTPS", says what travels over the phone-to-server wire is "only a class code and a timetable: no passwords, no personal data". But the app's diary sign-in posts the diary password to/api/v1/diary/loginover that same client and URL.network_security_config.xmlalready says the old wording stopped being true.build.mdwas never updated. - One DaData request per search.
docs/deploy.mdsays "the bot makes one request per search".suggest_schoolssends a second request, without the ОКВЭД filter, whenever the first one comes back empty.
The failure scenario.
- A region turns out to present the Russian Trusted Root. A maintainer follows
http.py's comment and setsca_bundle=on thatRegion. Nothing reads it, and the shared client still verifies against the default roots. Sign-in to that region goes on failing on TLS, and the code change looks like it should have fixed it. - A regional server starts dropping the deployment's address.
AddressRefusedis raised on each ping, caught as a generic exception and marked "skip". Four minutes later (KEEPALIVE_MIN_INTERVAL), every session on that origin is pinged again, up to 200 per tick, which is exactly what the docstring says the breaker prevents. Anyone readingerrors.pyconcludes the case is handled. - Somebody reorders
_REGIONSto "match docs/diaries.md" as the comment promises. The bot's region picker (listed()), which is alphabetical today, becomes Республика Бурятия … Алтайский край … Амурская область. - A reviewer checking where the diary password goes reads the
diary_weborDiaryLinkCodedocstring. They conclude our server never handles it, so logging, request-body limits and error paths insign_in_submitand/diary/loginneed no care for secrets. That conclusion is wrong. The family reads «уходит прямо в дневник» on the form, which is not true either. - A school owner reads
docs/build.md, runs the server on plainhttp://on the school Wi-Fi, and believes no password crosses it. A parent then signs in to the diary from the app, and the login and password travel in clear text. - An owner sizing the DaData free plan with
docs/deploy.mdcounts one request per search. Every search that finds nothing under 85.12–85.14 costs two.
Where.
server/app/providers/netschool/regions.py:27-29(docstring),:45(ca_bundle: str | None = None, read nowhere)server/app/providers/diary/http.py:76-82(build_clienttakes no verify or CA),:95-97(comment pointing to a CA bundle in regions.py)server/app/providers/netschool/client.py:69-87(one shared client for every region)server/app/providers/diary/errors.py:77-79(the per-origin breaker)server/app/services/diary_keepalive.py:60-66(_Claimhas no region),:153-155(except Exception→ "skip")server/app/models.py:812-814,server/migrations/versions/0015_diary_provider_columns.py:18,CLAUDE.md:366("grouped per origin for the keep-alive")server/app/providers/netschool/regions.py:48(the order comment);docs/diaries.md:152,:173,:182(the actual order)server/app/api/diary_web.py:10-11(docstring),:191(form posts to our own path),:298,:323-326(password passed on),:200(form text)server/app/models.py:840-841(DiaryLinkCodedocstring)server/app/bot/diary_render.py:172-173,server/app/bot/handlers/diary.py:207-208(bot texts)server/app/api/diary.py:248,:284(/diary/logintakespayload.password)docs/build.md:652-653; contradicted byandroid/core/data/src/main/kotlin/com/lumenpearson/lessons/core/data/network/DiaryApi.kt:50andandroid/app/src/main/res/xml/network_security_config.xml:13-21docs/deploy.md:235-236; contradicted byserver/app/providers/dadata/client.py:154-167
Also user-facing, found while fixing the rest. The same false promise is shown to people, in Russian: the bot's sign-in page (server/app/api/diary_web.py, around :206-208) and the bot's signed-out card (server/app/bot/diary_render.py, around :172-173) both say the password goes straight to the diary. The page posts it to our server, which relays it once.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
Let a phone register a diary session it opened itself, and fix what t…
Stop telling families the bot's sign-in page sends the password strai…
Document how a diary session now reaches the server, the region catal…
Document the phone's half: the first run through your own school's di…