Skip to content

fix(http): fail on non-success response status codes#298

Open
allamiro wants to merge 1 commit into
lixmal:masterfrom
allamiro:fix/http-status-check
Open

fix(http): fail on non-success response status codes#298
allamiro wants to merge 1 commit into
lixmal:masterfrom
allamiro:fix/http-status-check

Conversation

@allamiro

@allamiro allamiro commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #274.

Problem

The HTTP db backend never checked response status codes. A 404/500 error page was streamed straight into the kdbx parser (reads) or silently treated as a successful upload (writes).

Changes

  • get_db_read, get_key_read: error_for_status() before streaming the body
  • get_db_write: the upload result channel now reports non-success statuses as errors
  • two new regression tests (GET 404, PUT 500), both fail before the fix

Testing

cargo test: 11/11 pass in a rust:1.83 container.


Summary by cubic

Make the HTTP db backend fail on non-success status codes instead of streaming error pages or treating failed writes as successful. This prevents confusing parser errors and surfaces clear HTTP failures.

  • Bug Fixes
    • Use error_for_status() in get_db_read and get_key_read before streaming.
    • Propagate non-2xx statuses as errors in get_db_write.
    • Add regression tests for GET 404 and PUT 500.

Written for commit 3c03e80. Summary will update on new commits.

Review in cubic

The HTTP db backend streamed whatever the server returned into the
kdbx parser: a 404/500 error page surfaced as a confusing 'keepass db
initialization failed'. Reads, keyfile reads and writes now check the
response status via error_for_status.
@allamiro allamiro force-pushed the fix/http-status-check branch from 3c03e80 to 46a5cef Compare June 13, 2026 00:17
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.

HTTP db backend ignores response status codes

1 participant