Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Fix SQLite session_id #2977

Merged
merged 2 commits into from
Feb 17, 2023
Merged

Fix SQLite session_id #2977

merged 2 commits into from
Feb 17, 2023

Conversation

S7evinK
Copy link
Contributor

@S7evinK S7evinK commented Feb 17, 2023

This fixes an issue with device_id/session_ids.
If a device_id is reused, we would reuse the same session_id, since we delete one device and insert a new one directly, resulting in the query to get a new session_id to return the previous session_id. (SELECT count(access_token))

For reference: matrix-org/complement#613

@S7evinK S7evinK added C-User-API T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. C-SQLite labels Feb 17, 2023
@S7evinK S7evinK requested a review from a team as a code owner February 17, 2023 10:02
@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Base: 63.27% // Head: 63.25% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (15ea20c) compared to base (11d9b9d).
Patch coverage: 68.62% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2977      +/-   ##
==========================================
- Coverage   63.27%   63.25%   -0.03%     
==========================================
  Files         499      499              
  Lines       53612    53651      +39     
==========================================
+ Hits        33924    33937      +13     
- Misses      15992    16011      +19     
- Partials     3696     3703       +7     
Flag Coverage Δ
unittests 42.24% <68.62%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
userapi/storage/postgres/devices_table.go 85.44% <25.00%> (-1.10%) ⬇️
userapi/storage/shared/storage.go 77.55% <70.00%> (-0.25%) ⬇️
userapi/storage/sqlite3/devices_table.go 84.21% <76.47%> (-0.37%) ⬇️
internal/caching/cache_serverkeys.go 53.84% <0.00%> (-46.16%) ⬇️
federationapi/storage/shared/storage.go 75.30% <0.00%> (-1.86%) ⬇️
mediaapi/routing/upload.go 56.19% <0.00%> (-1.77%) ⬇️
roomserver/storage/sqlite3/rooms_table.go 74.31% <0.00%> (-1.64%) ⬇️
roomserver/internal/query/query.go 55.17% <0.00%> (-0.44%) ⬇️
roomserver/storage/shared/storage.go 65.86% <0.00%> (ø)
syncapi/storage/shared/storage_sync.go 61.92% <0.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@S7evinK S7evinK merged commit f080507 into main Feb 17, 2023
@S7evinK S7evinK deleted the s7evink/fixsqlitesessionid branch February 17, 2023 10:39
@hughns
Copy link
Member

hughns commented Apr 18, 2023

For future reference, the complement test ended up in matrix-org/complement#622

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-SQLite C-User-API T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants