security: protect local data at rest (issue #146) #172
Open
jabber.developer2
wants to merge 1 commits from
fix/data-at-rest-hardening into master
pull from: fix/data-at-rest-hardening
merge into: devs:master
devs:master
devs:fix/e2ee-transport-147
devs:fix/disco-info-null-from
devs:fix/editor-terminal-size
devs:fix/omemo-prosody-bootstrap
devs:feat/ai-api-type
devs:ci/docker-hub-publishing
devs:feat/disco-ac
devs:feat/privacy-enhancements
devs:fix/clientid-regression
devs:fix/ai-chat-completions-followup
devs:feat/ai-custom
devs:fix/unencrypted-send
devs:rollback/pre-upstream-merge
devs:fix/autoping-warning-null-domain
devs:fix/pad-dead-space-reclaim
devs:feat/autoping-warning
devs:chore/untrack-gitversion
devs:fix/multiline-pad-clip
devs:fix/issue-112-followups
devs:fix/issue-128-migrate-v3-dedup
devs:fix/delay-timestamp-validation
devs:ref/light-cleanup
devs:fix/history-scroll-pad-redraw-storm
devs:fix/plugin-post-display-incoming-only
devs:merge/upstream-full
devs:merge-improve
devs:chore/remove-chatlog-stage-1
devs:fix/ai-json-encoding
devs:feat/no-db-backlog-114
devs:fix/scroll-non-chat-windows
devs:fix/paged-non-chat-windows
devs:fix/ai-leaks
devs:feat/ai
devs:fix/ai-followups
devs:test/ai-coverage-unit-only
devs:test/ai-coverage
devs:refactor/scroll-mechanism
devs:fix/verify-per-contact-context
devs:feat/no-db-mode
devs:feat/ai-json
devs:feat/pikaur-parity-arch
devs:fix-pikaur-build
devs:feat/upstream-sync
devs:feat/functest-speedup
devs:fix/cwe-134-format-string-audit
devs:ci/separate-build-step
devs:test/autoping-functional-tests
devs:test/db-functional-tests
devs:fix/arch-build
devs:fix/xep-0030-disco-items-error-handling
devs:fix/xep-0030-empty-disco-items
devs:playground/fix/src_refactoring
devs:tests/disco
devs:fix/test-CI-stability
devs:feat/parallel-tests-clean
devs:feat/parallel-functional-tests
devs:fix/functional_tests_v2
devs:fix/functional_tests
devs:fix/connect_max_args
devs:feat/extended_debug_info
devs:playground/fix/scroll-stuck
devs:build/multicore
devs:build/reenable-fedora
devs:build/autoupdate
No Reviewers
Labels
Clear labels
Compat/Breaking
Breaking change that won't be backward compatible
Kind/Bug
Something is not working
Kind/Documentation
Documentation changes
Kind/Enhancement
Improve existing functionality
Kind/Feature
New functionality
Kind/Security
This is security issue
Kind/Testing
Issue or pull request related to testing
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Low
4
The priority is low
Priority
Medium
3
The priority is medium
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: devs/cproof#172
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "fix/data-at-rest-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #146
Implements all three work streams; every finding was re-verified against current master before implementation.
T03 — keep secrets out of profanity.log (REQ-DAR-03, REQ-LOG-06)
New redact_secrets() helper masks the content of SASL auth/response/challenge/success, (XEP-0077, MUC) and (XEP-0078) elements. Applied in the libstrophe logger and the stderr-to-log bridge. Input is normalised with g_utf8_make_valid() first so invalid UTF-8 cannot make redaction fail open.
_add_to_db() no longer logs decrypted message bodies or the full INSERT statement.
T07 — owner-only permissions (REQ-AUTH-01)
chmod 0600 on chatlog.db after open (journal/WAL inherit) and on OTR keys.txt/fingerprints.txt after every write. Parent directories were already 0700; this is defense in depth.
T08 — integrity before trust (REQ-RES-02, REQ-CRY-06)
PRAGMA quick_check(1) gates every chatlog.db open. On failure the DB stays closed, the user gets a one-time console warning, and the session continues without history.
OMEMO aesgcm downloads now decrypt into a 0600 tempfile next to the target and rename it into place only after the GCM tag verifies. Previously the plaintext was written straight to the destination and — worse — the open-command hook ran even when decryption failed; both are fixed, unverified output is always deleted.
Tests: unit tests for the redaction helper (8 cases incl. legacy-auth digest and invalid UTF-8); AES-256-GCM roundtrip plus tampered-tag/tampered-ciphertext tests (src/omemo/crypto.c is now linked into unittests under BUILD_OMEMO); functional test planting a corrupt chatlog.db and asserting the client warns and stays up.
Verification: clean -Werror build; unittests 649/649; functional suite 152 OK. The one failing functional test, ai_providers_lists_defaults, is broken on master independently of this branch — it expects the pre-chat-completions string "Available AI providers:" while master prints "Configured providers:"; fix incoming separately. Manually confirmed in a live client log: legacy-auth password appears as [REDACTED], chatlog.db is created -rw-------.
Deliberately out of scope: the issue's optional CI grep for plaintext-in-logs; SASL2 (XEP-0388) element names (libstrophe 0.14 does not emit them); the raw XML console (/xmlconsole) intentionally keeps showing live unredacted traffic — it is an ephemeral debug view, not a persistent log.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.