Skip to content

fix(configuration): treat empty secret as explicit clear - #7756

Open
ehooi wants to merge 2 commits into
getredash:masterfrom
ehooi:fix/empty-secret-clear
Open

fix(configuration): treat empty secret as explicit clear#7756
ehooi wants to merge 2 commits into
getredash:masterfrom
ehooi:fix/empty-secret-clear

Conversation

@ehooi

@ehooi ehooi commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Bug Fix

Description

When a user clears a password field in the UI and saves, the empty string is persisted to the data source options as-is. Downstream SDKs (e.g. boto3) then receive an explicit empty credential instead of falling back to the default credential chain, and authentication fails with empty keys (observed with the Athena data source's aws_secret_key).

Distinguish the placeholder ("--------", meaning "no change") from an empty string ("explicit clear") and drop the latter from the stored options.

How is this tested?

  • Unit tests (pytest, jest)
  • Manually

Related Tickets & Documents

N/A

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

N/A - backend-only change.

Review in cubic

When a user clears a password field in the UI and saves, the empty
string is persisted to the data source options as-is. Downstream SDKs
(e.g. boto3) then receive an explicit empty credential instead of
falling back to the default credential chain, and authentication fails
with empty keys (observed with the Athena data source's
aws_secret_key).

Distinguish the placeholder ("--------", meaning "no change") from an
empty string ("explicit clear") and drop the latter from the stored
options.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR distinguishes unchanged secret placeholders from explicitly cleared secrets and adds a unit test for removing cleared values.

  • Caches the schema’s secret-field collection during configuration updates.
  • Preserves existing values for placeholder submissions.
  • Omits secrets submitted as empty strings.
  • Adds coverage for explicit secret clearing.

Confidence Score: 4/5

This PR should not merge until clearing a schema-required secret is rejected rather than persisted as an invalid configuration.

Empty required secrets pass input validation before being deleted, and the resulting invalid options are committed without a second validation step.

Files Needing Attention: redash/utils/configuration.py

Important Files Changed

Filename Overview
redash/utils/configuration.py Adds explicit secret-clearing behavior, but performs deletion after validation and can persist a configuration missing a required secret.
tests/test_configuration.py Covers removal of an optional emptied secret but not rejection of an emptied required secret.

Reviews (1): Last reviewed commit: "Merge branch 'master' into fix/empty-sec..." | Re-trigger Greptile

Comment on lines +81 to 84
elif k in secrets and v == "":
# An empty secret means the user explicitly cleared the field; drop it.
continue
else:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Required secrets bypass validation

When Athena runs with ATHENA_OPTIONAL_CREDENTIALS=false and ATHENA_ASSUME_ROLE=false, an empty aws_secret_key satisfies the required-field validation and is then removed before persistence, leaving the stored configuration invalid and causing subsequent queries to fail authentication instead of rejecting the update.

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.

2 participants