Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to clear AWS Secret Key #7042

Open
yktakaha4 opened this issue Jul 2, 2024 · 1 comment
Open

Unable to clear AWS Secret Key #7042

yktakaha4 opened this issue Jul 2, 2024 · 1 comment

Comments

@yktakaha4
Copy link

Issue Summary

I can't delete the AWS Secret Key in the Amazon Athena data source credentials from the GUI.
This behavior becomes problematic when switching from an IAM user to an instance IAM role.

image

Also, making a request to the POST /api/data_sources/ endpoint didn't change the result, so I guessed that the backend needed to be fixed.

$ curl -XPOST -d '{
  "id": 13,
  "name": "service-logs",
  "type": "athena",
  "syntax": "sql",
  "paused": 0,
  "pause_reason": null,
  "supports_auto_limit": false,
  "options": {
    "aws_access_key": "",
    "aws_secret_key": "",
    "region": "ap-northeast-1",
    "s3_staging_dir": "s3://xxx",
    "schema": "yyy"
  },
  "queue_name": "queries",
  "scheduled_queue_name": "scheduled_queries",
  "groups": {
    "2": false
  }
}' -H "Content-Type: application/json" -H "Authorization: xxx" "https://redash.example.com/api/data_sources/13"

I don't know if similar issues occur with other AWS data sources. (eg. Elasticsearch)

Steps to Reproduce

  1. Create new Amazon Athena Data Source with AWS Secret Key .
  2. Clear AWS Secret Key , then save.
  3. Open again, key will be restored.

Technical details:

  • Redash Version: 10.1.0.b50633
  • Browser/OS: Google Chrome 126.0.6478.127
  • How did you install Redash: EKS
@yktakaha4
Copy link
Author

I don't know what to fix yet, but it may be necessary to set an empty string in options or enable operations to delete keys.
I would like to create a PR.

def update(self, new_config):
jsonschema.validate(new_config, self.schema)
config = {}
for k, v in new_config.items():
if k in self.schema.get("secret", []) and v == SECRET_PLACEHOLDER:
config[k] = self[k]
else:
config[k] = v
self._config = config
self.changed()

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

No branches or pull requests

1 participant