← Back to Pull requests

Validate configuration map entries before saving #552

Closed
unknown closed this pull request without merging on Nov 19, 2026 01:24 UTC
View on GitHub
unknown unknown commented on Nov 01, 2026 16:59 UTC
Author

Summary

Fixes #520.

Neither configuration map PUT endpoint checks the body before saving it. The XML and JSON readers ignore the map's generic types, so a request can deserialize to a null map, or a map with a null or non-string key, or a null or non-ConfigurationProperty entry. DefaultConfigurationController.setConfigurationProperties saved the map before building the in-memory copy, so in database mode the bad map was written to the database and then the in-memory update threw. On the next startup the map failed to load and then read as empty. A null key didn't throw at all. It was persisted and broke the Administrator's Configuration Map tab.

PUT /configurationMap/{key} from #515 goes through the same method, so a <null/> body there does the same damage. @NicoPiel and @gibson9583 both reported that in their reviews of #515.

setConfigurationProperties now rejects a null map, and checks every raw entry's key and value type. If any check fails, it throws a ControllerException before saving anything. Both endpoints go through that method, so one check covers both.

Notes for reviewers

  • A rejected request still comes back as a 500, because the servlet wraps the ControllerException. What #520 asked for is that nothing gets saved and the map is unaffected. Returning 400 instead would mean checking the body in the servlets, or adding a new exception type mapped to 400. I've left that for a separate change. Let me know if you'd rather have it here.

  • The tests are in their own commit, before the fix, and they fail against the old code.
  • Testing

    DefaultConfigurationControllerTest has new database-mode cases for a null map, a null entry, a null key, a non-string key, a non-ConfigurationProperty entry, and a null property sent to the single-entry endpoint. Each one checks that the stored database row and the in-memory map are both unchanged after the rejection.

    Claude checked:

  • The new tests fail on the test commit and pass with the fix.

  • ./gradlew clean build -PdisableSigning=true passes.
  • Release Note

    Invalid configuration map updates through the REST API no longer empty the map after a restart

    With configurationmap.location = database, an invalid body sent to PUT /api/server/configurationMap was saved to the database before the request failed. Examples are a <null/> body, an entry with no value, or a key that isn't a string. The server kept using the old map until the next restart, so nothing looked wrong. After the restart the map couldn't be loaded and read as empty, so $cfg lookups returned nothing. If someone saved the Configuration Map panel in that state, the original entries were lost for good. A null key was also accepted and kept, and it stopped the Administrator's Configuration Map panel from loading. The server now checks every key and entry and rejects an invalid update before anything is saved. The same check applies to the new single-entry PUT /api/server/configurationMap/{key} endpoint. (#520, #552)

    Rejected updates still return a 500, as they did before, but the stored map is no longer changed. File mode wasn't affected, because those bodies already failed before the file was written.

    If your configuration map came up empty after a restart, and the first request for it after the restart failed with a NullPointerException or ClassCastException, the configuration.properties row for category core in the CONFIGURATION table probably holds a bad map. Fix or delete that row by hand and restart.

    ---
    🤖 Drafted with Claude Code

    Diff: 449 lines (+336 / -113) across 5 files Reviewer: NicoPiel Review duration: 24985m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.69) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.69 · 449 lines diff across 5 files
    0.69
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    57%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.366
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.069
    Real PR Conversation Timeline
    1 comments
    "Review active on #552"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.6% (HIGH) · Higher = larger blast radius
    68.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 58.0% · Lower = rushed or shallow review
    58.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 28.8% · Safe to merge
    28.8%