milenkovicm opened a new pull request, #2976:
URL: https://github.com/apache/datafusion-ballista/pull/2976

   # Which issue does this PR close?
   
   Closes #.
   
   # Rationale for this change
   
   The scheduler's `GET /api/job/{job_id}/config` endpoint returns a job's 
session configuration exactly as `SessionConfig::to_props()` produces it. That 
includes registered config extensions, so a secret set by a client, such as 
`s3.secret_access_key` or `s3.session_token`, is returned in plain text to 
anyone who can reach the REST API.
   
   The same map is also written to the event log when a job finishes, and the 
history server serves the stored copy. So the secrets were persisted to disk as 
well as exposed by the live scheduler.
   
   Ballista already redacts these values in log lines (`redact_config_value` / 
`redact_key_value_pairs`), but that rule was never applied to the REST 
responses.
   
   # What changes are included in this PR?
   
   - `ballista-core` (`utils.rs`):
     - New `is_sensitive_config_key(key)`, holding the key-name rule that was 
previously inside `redact_config_value`. A key is sensitive if it contains 
`secret`, `password`, `token`, `credential`, `api_key` or `private_key`, 
ignoring case. `redact_config_value` now calls it, so its behaviour is 
unchanged.
     - New `redact_config_props(props)`, which replaces the values of sensitive 
keys with the existing `REDACTED` marker (`<redacted>`). Unlike the log 
redaction, served values do not include the original value's length.
   - `ballista-scheduler`:
     - `session_config_to_job_config` now redacts. This covers the event log 
and therefore the history server.
     - The `get_job_config` handler uses `session_config_to_job_config` instead 
of calling `to_props()` directly, so the live endpoint and the stored record 
are built by the same function.
   - Tests:
     - A core unit test for `redact_config_props`.
     - A scheduler test that builds a `SessionConfig` with a test config 
extension. It checks that secret and token values are replaced, other values 
are kept, and the raw values do not appear anywhere in the serialized JSON.
   
   # Are there any user-facing changes?
   
   Yes:
   
   - `GET /api/job/{job_id}/config`, on both the scheduler and the history 
server, now returns `"<redacted>"` for the values of sensitive keys. Anything 
that read secrets back from this endpoint will no longer get them. The keys 
themselves are still listed.
   - Live scheduler responses now come back with keys sorted. The JSON shape is 
unchanged and matches the `BTreeMap` already documented in the OpenAPI spec.
   - Event logs written before this change still contain the raw values, and 
the history server serves them as they are. Operators who are concerned should 
rotate the affected credentials and remove or rewrite older event logs.
   
   There are no breaking changes to the public Rust API; the two new functions 
in `ballista_core::utils` are additions. No `.proto` or wire-format changes.
   
   🤖 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