Skip to content

Security: refuse a non-object settings block on save and on read - #495

Merged
SandObserver merged 1 commit into
mainfrom
security/config-shape-checks
Oct 18, 2026
Merged

SandObserver merged 1 commit into
mainfrom
security/config-shape-checks

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Return 400 from POST /api/config when settings is present and is not a plain object. An array or primitive previously lost the preserved settings.auth on write, which removed the password without the current-password check.
  • Treat a settings value in apps.json that is not a plain object (array, primitive, null) as wrong shape: back the file up, mark it damaged, refuse sign-in and saving.
  • Skip items entries that are not objects on read, after writing a .corrupt- backup of the file. Readers no longer return 500 on a null entry.

Testing
All green. Added 6 tests covering the save route and wrong-typed settings and items on disk; all fail without the change.

Changelog

Security

  • Refuse a config save whose settings block is not an object, which could remove the password.

Fixed

  • Treat a damaged settings block in the config file as damage instead of loading it as an open install.
  • Skip invalid entries in the config file's app list instead of failing health checks, badges and widgets.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.

A config save with settings as an array or a primitive dropped the stored
password when written. A file with such a settings block loaded as an open
install and was overwritten on the next save. Both now count as invalid:
the save returns 400, and the file is backed up and marked damaged.

Item entries that are not objects are skipped on read after the file is
backed up.
@SandObserver SandObserver added the security Security fix label Oct 18, 2026
@SandObserver
SandObserver merged commit b40793f into main Oct 18, 2026
6 checks passed
@SandObserver
SandObserver deleted the security/config-shape-checks branch October 18, 2026 21:51
stackyard-release Bot pushed a commit that referenced this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant