rusackas opened a new pull request, #40652:
URL: https://github.com/apache/superset/pull/40652

   ### SUMMARY
   
   The unauthenticated `/version` endpoint (`superset/views/health.py`) returns 
the full version metadata: `version_string`, `version_sha`, `full_sha`, 
`build_number`, and `branch_name` (when available, sourced from 
`get_version_metadata()`). This PR adds an `EXPOSE_VERSION_INFO` config option 
so operators can control how much of that build-specific detail is exposed to 
unauthenticated callers — generic surface-reduction hardening.
   
   **Default choice:** `EXPOSE_VERSION_INFO = True`, which **preserves the 
existing behavior** and is the least-breaking option. I chose to keep the 
current behavior by default rather than silently changing what `/version` 
returns; operators opt in to the reduced response. When set to `False`, 
`/version` returns only `{"version_string": ...}` and omits the Git SHA, full 
SHA, build number, and branch name. The gating lives in the endpoint itself.
   
   **Back-compat / escape hatch:** because the default is `True`, existing 
deployments see no change. The reduced response is fully opt-in via:
   
   ```python
   EXPOSE_VERSION_INFO = False
   ```
   
   An `UPDATING.md` entry under `## Next` documents the new option and notes it 
is non-breaking.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   `GET /version` with `EXPOSE_VERSION_INFO = True` (default):
   
   ```json
   {"version_string": "1.2.3", "version_sha": "abcd1234", "full_sha": 
"abcd1234ef567890", "build_number": "42", "branch_name": "master"}
   ```
   
   `GET /version` with `EXPOSE_VERSION_INFO = False`:
   
   ```json
   {"version_string": "1.2.3"}
   ```
   
   ### TESTING INSTRUCTIONS
   
   Unit tests added in `tests/unit_tests/views/health_version_test.py` (pass 
locally):
   
   - default (`True`) returns full metadata including SHA and branch
   - `False` returns only `version_string` and omits SHA/full SHA/build 
number/branch
   
   Plus a config-default assertion in 
`tests/unit_tests/config_test.py::test_expose_version_info_defaults_to_true`.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   > Note: introduces a new config option. Default (`True`) preserves the 
current shipped behavior; the reduced response is opt-in via 
`EXPOSE_VERSION_INFO = False`. `UPDATING.md` entry included.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to