Repository navigation
Description
What is broken.
The «Сетевой город» sign-in takes the session's ver from cacheVer in GET /webapi/logindata with setdefault. If that field is missing or null, the session stores "ver": None. That value is sealed into the credential as JSON null. Both calls that send ver build it with str(self.session.get("ver", "")). The key exists, so the "" default never applies, and they send the four-letter string None: the SecurityWarning acknowledgement and POST /webapi/auth/logout.
The project's own reference does not list cacheVer among the logindata fields (docs/diaries/netschool.md:53 and :203). Only one server in regions.md has been seen returning it. The tests always supply it, so nothing covers the missing case.
Separately, the module docstring says the session keeps "the login's timeOut so the keep-alive knows this server's idle window". Sign-in does write time_out, but nothing reads it. The keep-alive pings on a fixed four-minute floor whatever the server's window is. The docstring describes behaviour that does not exist.
The failure scenario.
- A family signs in to a region whose
GET /webapi/logindataanswers{"schoolLogin": true, ...}with nocacheVer. login_allowedrunsself.session.setdefault("ver", None). The session was built inNetSchoolProvider.sign_inwithout averkey, soNoneis stored.client.credentialserialises it as"ver": null, and it is sealed intodiary_sessions.upstream_token.- Later, any authenticated read or the cron keep-alive gets the co-working
/asp/SecurityWarning.aspinterstitial._acknowledge_warningthen postsat=…&WarnType=2&ver=None. The same can happen during the sign-in bootstrap, from the in-memory session. - If the server rejects that acknowledgement, the retried call shows the interstitial again.
_authed_jsonthen raisesSessionExpired, so the family's session is expired, and the only thing wrong is averthe client made up. This step depends on how the upstream checksver, and nothing has been run against a live server. - On sign-out,
services/diary.pycallsprovider.open(credential).close(), andlogoutpostsat=…&ver=Noneto/webapi/auth/logout. - Separately: a reader of the client's docstring expects the keep-alive to adapt to
timeOut(900000 ms on one server, 3600000 ms on asurso.ru). It does not.session["time_out"]is written and read by nothing except one test assertion.
Where.
- server/app/providers/netschool/client.py:263:
self.session.setdefault("ver", data.get("cacheVer"))storesNone. - server/app/providers/netschool/client.py:244:
_acknowledge_warningsendsstr(self.session.get("ver", "")), which is"None". - server/app/providers/netschool/client.py:393:
logoutsends the same expression. - server/app/providers/netschool/client.py:221-225: a second interstitial after the acknowledgement raises
SessionExpired. - server/app/providers/netschool/provider.py:165-166: the session starts without a
verkey. - server/app/providers/netschool/client.py:9-12: the docstring promises the keep-alive uses
timeOut. - server/app/providers/netschool/client.py:341-342:
time_outis written and never read. - server/app/services/diary_keepalive.py:48 and :141-156: the keep-alive uses a fixed
KEEPALIVE_MIN_INTERVALof four minutes and never looks at the session'stime_out.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
Let a phone register a diary session it opened itself, and fix what t…