redash icon indicating copy to clipboard operation
redash copied to clipboard

Unable to clear `AWS Secret Key`

Open yktakaha4 opened this issue 1 year ago • 1 comments
trafficstars

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 avatar Jul 02 '24 05:07 yktakaha4

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. https://github.com/getredash/redash/blob/9b2f635692741396def5b78e0ba0d564a852de6f/redash/utils/configuration.py#L72-L83

yktakaha4 avatar Jul 02 '24 05:07 yktakaha4