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

state.dynamodb: validate AWS connection #3285

Merged
merged 12 commits into from Jan 2, 2024

Conversation

elena-kolevska
Copy link
Contributor

Description

I added a Get check to a dummy key on component Init for aws Dynamodb. This will prevent Dapr from initialising if we have wrong component info (credentials/table name).

Issue reference

#3190

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation - N/A

Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
@elena-kolevska elena-kolevska requested review from a team as code owners December 22, 2023 12:26
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
@ItalyPaleAle ItalyPaleAle changed the title Aws connection validation state.dynamodb: validate AWS connection Dec 22, 2023
Copy link
Contributor

@ItalyPaleAle ItalyPaleAle left a comment

Choose a reason for hiding this comment

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

Please fix the linter issues

TableName: aws.String(d.table),
Key: map[string]*dynamodb.AttributeValue{
d.partitionKey: {
S: aws.String(uuid.NewString()),
Copy link
Contributor

Choose a reason for hiding this comment

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

uuid.NewString can panic (if the kernel doesn't have entropy). Please use uuid.NewRandom and then call .String() on the result

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, ptr.Of

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ItalyPaleAle! Check out if you like how I did this. In case of error, I chose to use a fixed string, since I didn't want to have the initialisation of dapr fail because of it; it's just a dummy check anyway.

state/aws/dynamodb/dynamodb.go Outdated Show resolved Hide resolved
state/aws/dynamodb/dynamodb.go Outdated Show resolved Hide resolved
state/aws/dynamodb/dynamodb_test.go Outdated Show resolved Hide resolved
state/aws/dynamodb/dynamodb.go Outdated Show resolved Hide resolved
elena-kolevska and others added 5 commits December 22, 2023 18:38
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
@ItalyPaleAle ItalyPaleAle added this pull request to the merge queue Jan 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 2, 2024
@ItalyPaleAle ItalyPaleAle added this pull request to the merge queue Jan 2, 2024
Merged via the queue into dapr:main with commit 0c48ced Jan 2, 2024
87 checks passed
@ItalyPaleAle ItalyPaleAle added this to the v1.13 milestone Jan 2, 2024
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.

None yet

4 participants