Skip to content

Conversation

@PimSanders
Copy link
Contributor

@PimSanders PimSanders commented Jan 7, 2026

This PR fixes an issue where a InvalidPageType would be thrown when attempting to read data from page 1 of a WAL commit, e.g. Error while executing 'notifications.wpndatabase': Unknown page type: 83.

This issue was discussed while working on #9, see: #9 (comment).

Back then I was not able to create a database with data on page 1, and page 1 being in WAL. I have found that the Windows notifications database on both my VM's does this, which allowed me to work on a fix. It is fixed by just moving the head past the header. This fix works on the notifications database.

I have not yet been able to achieve this in Python's SQLite3 library, so there is no new test data.

Required for: fox-it/dissect.target#1454

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.05%. Comparing base (cba61a9) to head (6ab5bd3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dissect/database/sqlite3/sqlite3.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #15   +/-   ##
=======================================
  Coverage   82.05%   82.05%           
=======================================
  Files          31       31           
  Lines        2346     2352    +6     
=======================================
+ Hits         1925     1930    +5     
- Misses        421      422    +1     
Flag Coverage Δ
unittests 82.05% <90.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Schamper
Copy link
Member

Schamper commented Jan 7, 2026

Pushed a slightly changed suggestion, let me know if that works.

Question: does the header actually change? I.e. is it worth to read the database header from the WAL instead of always from fh like we do now?

@PimSanders
Copy link
Contributor Author

I don't think that is necessary. It is possible for the header to change, for example when a PRAGMA command is executed, but that seems to be written directly to the database file.

@Schamper
Copy link
Member

Schamper commented Jan 7, 2026

Cool, if you can confirm my change is fine, this LGTM.

@PimSanders
Copy link
Contributor Author

Yes, it still works as expected.

@Schamper Schamper merged commit 1e58b09 into fox-it:main Jan 8, 2026
23 checks 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