Skip to content

[BUGFIX] Encrypt api_key before DataHandler records the history diff - #30

Merged
o-ba merged 2 commits into
b13:mainfrom
julianammann:main
Aug 29, 2026
Merged

[BUGFIX] Encrypt api_key before DataHandler records the history diff#30
o-ba merged 2 commits into
b13:mainfrom
julianammann:main

Conversation

@julianammann

Copy link
Copy Markdown
Contributor

On updates, DataHandler captures the sys_history diff in compareFieldArrayWithCurrentAndUnset() before it calls processDatamap_postProcessFieldArray(). Encrypting only there left the plaintext key in the record history, readable in the record's history view and in the database, although the column itself was encrypted. Inserts were not affected.

EncryptApiKey now also encrypts in processDatamap_preProcessFieldArray, so only the ciphertext reaches the history. The post-process hook stays for the "empty means keep the stored key" handling; encrypt() is idempotent, so the value is not encrypted twice.

The new functional test EncryptApiKeyHistoryTest reproduces it through the real DataHandler.

Existing sys_history rows are not rewritten. Installations that stored keys before this fix should purge them once.

julianammann and others added 2 commits August 28, 2026 17:09
CHANGELOG documents the fix and the one-off cleanup for history entries
written before it. Dropping the whole row rather than editing history_data
keeps that a single portable statement: the payload comes in two shapes
(flat for ACTION_ADD, oldRecord/newRecord for ACTION_MODIFY) and would
otherwise need JSON manipulation in four SQL dialects. sys_log.log_data
references the history id, but only as a soft reference, and the backend
history view queries sys_history by tablename/recuid.
@o-ba

o-ba commented Aug 29, 2026

Copy link
Copy Markdown
Member

@julianammann Thank you for the fix!

@o-ba
o-ba merged commit 41d6263 into b13:main Aug 29, 2026
4 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