fix: feed_api_key field doesn't show its "stored" state after masking - #9
fix: feed_api_key field doesn't show its "stored" state after masking#9rjonesbsink wants to merge 1 commit into
Conversation
Follow-up to #7. 07b9d1d already added data-secret="1" to feed_api_key in settings.php (fixing the actual data loss), but didn't touch config.js — the generic applySettingsToForm() has no idea about the <name>_set sentinel the server sends for masked fields, so the field still LOOKS empty and the "external feed is disabled" banner still shows even when a key is in fact configured. Cosmetic next to the data loss, but still wrong, and called out explicitly in the #7 thread as a gap being left for a separate fix. loadApiKeys() now reads feed_api_key_set and shows the same "stored — leave blank to keep, type to replace" placeholder loadSlackConfig() already uses for its secret fields, and tracks a data-configured flag so updateFeedKeyBanner() reflects the real state instead of just checking whether the box happens to be non-empty. (Dropped the settings.php data-secret="1" hunk this branch used to carry — main already has it via 07b9d1d, identical text, so keeping it here was pure duplication.)
79e9b47 to
3c6f774
Compare
|
Reviewed this one too — it's good to go from my side. No security surface, no server-side change, ES5-clean, and it mirrors I particularly like that the banner logic keeps the blank-and-configured case hidden, which is what "blank means keep the stored value" should look like to a user. That was the confusing part of #7 and this makes the state visible instead of implied. It's still marked draft — flip it to ready and I'll merge it. Thanks for splitting this out from the larger fix rather than bundling it. Reviewing a focused 22-line diff is a very different experience from reviewing it buried in a nine-file change, and I noticed. |
Review outcome: no objections. Merge decision is Eric's.This went through a full adversarial pre-merge security review alongside #10. The verdict on this one is safe as-is — no server-side change, no new network call, no secret reaches the browser, and it mirrors Two things the review confirmed specifically, since a "stored secret" change is worth being precise about:
One thing you should know before you spend more time on itWhile this was open, the same defect got fixed in the dev tree independently, and in a more general form. Telling you plainly because it affects what happens to your branch, not to take anything away from it — your report in #7 is what drove the fix. Instead of handling // A secret never arrives as a value — the server sends `<key>_set`.
// Reflect that state in the placeholder and leave the box empty, so
// saving without retyping omits the key and the stored value lives.
if (el.getAttribute('data-secret') === '1') {
markSecretFieldState(el, settings[key + '_set'] === true);
continue;
}
The rest of what you found in that area landed too:
So: the behaviour you reported is fixed and shipped. Whether to merge this branch as well is Eric's call and I'm not going to pre-empt it. Why merging it here alone would not have worked anywayWorth knowing for #10 too, and for anything you send in future — it is not obvious from the outside. This public repository is a one-way, full-tree-replace snapshot of a private dev tree. A change merged only here is overwritten by the dev tree's version of that file at the next release — or deleted outright if the dev tree has no such file. Git raises no objection and no diff shows it: from this side it just looks like the maintainer committed a tree in which your change is absent. A fix can appear merged, sit for days, and quietly vanish. That is not hypothetical, which is why there is now a guard. The practical consequence: an accepted contribution has to be applied in the dev tree, not merged here. Merging here is the acknowledgement, not the shipping. Nothing for you to do differently — just so a later Thanks for this one. The diagnosis was right, and the reason it is fixed is that you wrote it up. |
|
Closing this one without merging, and I want to be precise about why, because your diagnosis was correct and the credit for finding this is yours. You identified the real defect: While this PR was open, the same defect was fixed in the development tree in a more general form (1923ba5, "Saving a Settings panel wiped the stored secret it never showed you"). Rather than handling
That is the same three behaviours your patch introduced — the corrected banner, the unconditional blanking, and the stored/not-set placeholder — applied to every secret field instead of one. I checked each against your diff before closing rather than assuming, including that One thing you should know, since it is not visible from here: that fix has not been published yet. This repository is a snapshot of a private development tree, republished whole at each release, so The fix went further than the display problem you reported. The same masking gap had a data-loss half: four save handlers hand-built their POST payload and posted the always-empty secret box verbatim, so changing anything else on those panels and clicking Save wrote Your issue #7 is what started that thread, and your note there that the suffix-based secret classifier deserved an audit is cited in So: nothing needed from you, nothing wrong with the patch, and it is only being closed because merging it now would conflict with a fix that already covers it. The check failure showing on this PR is a stale run from before a large amount of change on main — it is not a problem with your work. Ignore the merge status; the bug you found is fixed, and it is fixed more thoroughly than the report asked for. Thank you. |
Summary
Fixes the config.js half of #7.
07b9d1dalready fixed the actual data-loss bug (data-secret="1"onfeed_api_keyinsettings.php) and covered the 9-field audit + boolean-masking issue — this PR doesn't touch any of that.What's left is the piece explicitly called out as a separate gap in that thread:
applySettingsToForm()has no concept of the<name>_setsentinel the server sends for masked fields, so a correctly-configuredfeed_api_keystill renders as an empty box, and the "external feed is disabled" banner still shows even though a key is in fact set.Change
loadApiKeys()now readsfeed_api_key_setand shows the same "stored — leave blank to keep, type to replace" placeholderloadSlackConfig()already uses for its own secret fields, tracking adata-configuredflag soupdateFeedKeyBanner()reflects the real state instead of just checking whether the box happens to be non-empty.This branch previously also carried the
data-secret="1"addition tosettings.php, but that's now identical to what's already onmainvia07b9d1d— dropped it to keep this PR to just the one remaining gap, rather than duplicating your own fix.Testing
Verified end-to-end on a live install: with a key configured, the field now shows the "stored" placeholder and the banner stays hidden; saving an unrelated field on the same form no longer touches the key (confirmed via direct DB check) and the display now correctly reflects that.