Tomodachi

Latest version: v0.27.0

Safety actively analyzes 631143 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 24

0.21.5

- If a `PYTHONPATH` environment value is set and a service is started without the `--production` flag, the paths specified in `PYTHONPATH` will be added to the list of directories to watch for code changes and in the event of any changes done to files on those directories, the service will restart. Previously only code changes in the directory or sub directory of the current working directory + the directory of the started service (or services) were monitored.
- The `topic` argument to the `tomodachi.aws_sns_sqs` decorator is now optional, which is useful if subscribing to a SQS queue where the SNS topic or the topic subscriptions are set up apart from the service code, for example during deployment or as infra.

0.21.4

- Encryption at rest for AWS SNS and/or AWS SQS which can optionally be configured by specifying the KMS key alias or KMS key id as a tomodachi service option `options.aws_sns_sqs.sns_kms_master_key_id` (to configure encryption at rest on the SNS topics for which the tomodachi service handles the SNS -\> SQS subscriptions) and/or `options.aws_sns_sqs.sqs_kms_master_key_id` (to configure encryption at rest for the SQS queues which the service is consuming).

Note that an option value set to empty string (`""`) or `False` will unset the KMS master key id and thus disable encryption at rest. (The AWS APIs for SNS and SQS uses empty string value to the KMSMasterKeyId attribute to disable encryption with KMS if it was previously enabled).

If instead an option is completely unset or set to `None` value no changes will be done to the KMS related attributes on an existing topic or queue.

If it's expected that the services themselves, via their IAM credentials or assumed role, are responsible for creating queues and topics, these options could be used to provide encryption at rest without additional manual intervention

*However, do not use these options if you instead are using IaC tooling to handle the topics, queues and subscriptions or that they for example are created / updated as a part of deployments. To not have the service update any attributes keep the options unset or set to a* `None` *value.*

See further details about AWS KMS for AWS SNS+SQS at:

- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html>
- <https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html#sse-key-terms>.

- Fixes an issue where a GET request to an endpoint serving static files via `http_static` could be crafted to probe the directory structure setup (but not read file content outside of its permitted path), by applying directory traversal techniques. This could expose the internal directory structure of the file system in the container or environment that the service is hosted on. Limited to if `http_static` handlers were used within the service and those endpoints could be accessed.

- Additional validation for the path used in the `http_static` decorator to prevent a developer from accidentally supplying a `"/"` or `""` value to the `path` argument, which in those cases could lead to unintended files being exposed via the static file handler.

0.21.3

- Fixes an issue causing a `UnboundLocalError` if an incoming message to a service that had specified the enveloping implementation `JsonBase` where JSON encoded but actually wasn't originating from a source using a `JsonBase` compatible envelope.
- Fixes error message strings for some cases of AWS SNS + SQS related cases of `botocore.exceptions.ClientError`.
- Fixes the issue where some definitions of filter policies would result in an error when running mypy -- uses `Sequence` instead of `List` in type hint definition for filter policy input types.
- Internal updates for developer experience -- refactoring and improvements for future code analysis and better support for IntelliSense.
- Updates to install typeshed generated type hint annotation stubs and updates to support `mypy==0.910`.

0.21.2

- Bugfix for an issue which caused the `sqs.DeleteMessage` API call to be called three times for each processed SQS message (the request to delete a message from the queue is idempotent) when using AWS SNS+SQS via `tomodachi.aws_sns_sqs`.
- Now properly cleaning up clients created with `tomodachi.helpers.aiobotocore_connector` for `aiobotocore`, which previously could result in the error output "Unclosed client session" if the service would fails to start, for example due to initialization errors.

0.21.1

- Added `sentry_sdk` to the list of modules and packages to not be unloaded from `sys.modules` during hot reload of the running when code changes has been noticed. This to prevent errors like `TypeError: run() takes 1 positional argument but X were given` from `sentry_sdk.integrations.threading` when handling early errors or leftover errors from previous session.

0.21.0

- Uses the socket option `SO_REUSEPORT` by default on Linux unless specifically disabled via the `http.reuse_port` option set to `False`. This will allow several processes to bind to the same port, which could be useful when running services via a process manager such as `supervisord` or when it's desired to run several processes of a service to utilize additional CPU cores. The `http.reuse_port` option doesn't have any effect when a service is running on a non-Linux platform. (github: **tranvietanh1991**)
- Services which works as AMQP consumers now has a default prefetch count value of 100, where previously the service didn't specify any prefetch count option, which could exhaust the host's resources if messages would be published faster to the queue than the services could process them. (github: **tranvietanh1991**)
- AWS SNS+SQS calls now uses a slightly changed config which will increase the connection pool to 50 connections, decreases the connect timeout to 8 seconds and the read timeout to 35 seconds.
- Possible to run services using without using the `tomodachi` CLI, by adding `tomodachi.run()` to the end of the Python file invoked by `python` which will start services within that file. Usually in a `if __name__ == "__main__":` if-block.
- The environment variable `TOMODACHI_LOOP` can be used to specify the event loop implementation in a similar way as the CLI argument `--loop [auto|asyncio|uvloop]` would.
- Environment variable `TOMODACHI_PRODUCTION` set to `1` can be used to run the service without the file watcher for automatic code reloads enabled, which then yields higher performance. Equivalent as starting the service with the `--production` argument.
- Smaller performance improvements throughout the framework.
- Improved error handling overall in regards to non-standard exceptions and additional output, if scheduled tasks are unable to run due to other start methods not completing their initial setup.

Page 5 of 24

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.