-
Notifications
You must be signed in to change notification settings - Fork 5
DynamoDB improvements #221
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
base: main
Are you sure you want to change the base?
Conversation
|
@michelemin For one more review |
michelemin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nits and typos
| /// Configured readers - maps a table name to a list of rules that are allowed to READ data | ||
| r: HashMap<String, HashSet<String>>, | ||
| /// Reserved tables - list of 'reserved' table names which rules cannot access | ||
| /// For the purpose of preventing rules rule accessing 'storage' tables in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo - "preventing rules rule accessing"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think the entire second line should be removed. The first line seems sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| /// Configured readers - maps a table name to a list of rules that are allowed to READ data | ||
| r: HashMap<String, HashSet<String>>, | ||
| /// Reserved tables - list of 'reserved' table names which rules cannot access | ||
| /// For the purpose of preventing rules rule accessing 'storage' tables in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
|
||
| #[derive(PartialEq, PartialOrd)] | ||
| #[derive(PartialEq, PartialOrd, Debug)] | ||
| /// Represents an access scope for a rule has to modify a DynamoDB table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
| /// Represents an access scope for a rule has to modify a DynamoDB table | |
| /// Represents an access scope that a rule has to modify a DynamoDB table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| /// Checks if module can perform given give action | ||
| /// Modules are registerd as as read (R) or write (RW) under self. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typos
| /// Checks if module can perform given give action | |
| /// Modules are registerd as as read (R) or write (RW) under self. | |
| /// Checks if module can perform a given action | |
| /// Modules are registered as as read (R) or write (RW) under self. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| // check if read access is configured for this table | ||
| if let Some(table_readers) = self.r.get(table_name) { | ||
| // check if this module has read access to this table | ||
| if table_readers.contains(&module.to_string()) { | ||
| warn!( | ||
| "[{module}] trying to [write] but only has [read] permission for dynamodb table [{table_name}]" | ||
| ); | ||
| return Err(ApiError::BadRequest); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this block after checking for Write access.
Otherwise, imagine that a module appears both in the r and rw sections for a table: we would log a warning but then everything would be fine.
So I'd say we first check the happy path: if something goes wrong, we dig deeper and try to understand what happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Improvements to the dynamodb api for rules:
reserved_tablesconfig to prevent rules from accessing 'reserved_tables' i.e dynamodb table used by the storage API