Skip to content

fix(admin): do not copy settings of -D options and variables on a General save - #4058

Open
marevol wants to merge 1 commit into
mainfrom
fix/general-save-keeps-override-values
Open

marevol wants to merge 1 commit into
mainfrom
fix/general-save-keeps-override-values

Conversation

@marevol

@marevol marevol commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

A value that a setting gets from -Dfess.system.<key> or FESS_SYSTEM_<KEY> was still copied into system.properties by a save of the General page that changed nothing, when it had outer blanks or CR line breaks (for example saml.idp.x509cert given as a PEM that ends with a line break). The stored copy then wins, so a later change of the variable or option has no effect.

Cause

The form mapping trims every text field and turns CRLF and CR into LF (except fields whose name ends with password). FessProp compared the value to be stored with the raw option or variable.

Change

  • A text to be stored also counts as the value of the option or variable when it equals that value after the same normalization, now shared with the form mapping.
  • Secrets (never shown) and list choices (sso.type, storage.type, rag.llm.name, entraid.response.mode, fess.log.notification.level) are still compared as they are: they are typed or chosen, and retyping or choosing a value without a stray line break must be stored. The typed boolean and integer setters keep their own comparison for the same reason.
  • Values that a save reformats are compared in their reformatted form: theme.settings, rag.chat.permissions and rag.chat.labels.
  • The SPNEGO check boxes and entraid.use.ds are saved as booleans, so a variable such as TRUE is no longer copied as true.

Keys already in system.properties are written as before.

Behaviour to be aware of

For a text field, a value that differs from the option or variable only in outer blanks or line endings now counts as unchanged, on the screen and in PUT /api/admin/general. The two cannot be told apart on the screen.

Not changed

  • Copies stored by earlier saves stay in system.properties; remove the line to use the option or variable again.
  • A number given with blanks or a line break around it is not read, so the screen shows the default and saves it. A list setting whose value is none of its choices is saved as the choice the browser selects.
  • fess.log.notification.level is read from system.properties directly by the log notification appender.

Tests

New cases in AdminGeneralActionTest; four of them fail without the change, the others guard that edits, typed secrets and chosen values are still stored. Also checked by saving the General page in a browser against a running server with settings given by variables and an option: values were copied before the change and are not after it, and edited fields are stored.

…eral save

The form mapping trims a text field and turns CRLF and CR into LF, while the
value to be stored was compared with the raw -Dfess.system.<key> option or
FESS_SYSTEM_<KEY> variable. A value with outer blanks or CR line breaks, such as
a certificate ending with a line break, was therefore written to
system.properties by an unchanged save and won over the option or variable from
then on. The comparison now accepts the text as a form sends it back. Secrets and
list choices, which are typed or chosen, are still compared as they are.

The same applies to values that a save reformats: theme settings, the RAG chat
permissions and labels, and the SPNEGO and Entra ID check boxes.
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.

1 participant