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

feat(stepfunctions): add stepfunctions service and check stepfunctions_statemachine_logging_enabled #5466

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

AdriiiPRodri
Copy link
Contributor

@AdriiiPRodri AdriiiPRodri commented Oct 18, 2024

Context

To cover the checks for the Step Functions service, in this PR we have added that service and have also included the logging enabled check: [StepFunctions.1] Step Functions state machines should have logging turned on

Description

This PR adds:

  • Step Functions service.
  • Step Functions client.
  • stepfunctions_statemachine_logging_enabled check.
  • Unittest for service, check and config.
  • Config file parameter to check log level (the check will only pass if the state machine has the specified logging level enabled).

Checklist

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@AdriiiPRodri AdriiiPRodri added the provider/aws Issues/PRs related with the AWS provider label Oct 18, 2024
@AdriiiPRodri AdriiiPRodri self-assigned this Oct 18, 2024
@AdriiiPRodri AdriiiPRodri requested review from a team as code owners October 18, 2024 14:00
Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

@AdriiiPRodri AdriiiPRodri force-pushed the PRWLR-4469-Ensure-Step-Functions-State-Machines-Have-Logging-Enabled branch from fcf088e to 6636b62 Compare October 18, 2024 16:12
Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 98.54015% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.92%. Comparing base (f53a887) to head (c70626e).
Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
...ws/services/stepfunctions/stepfunctions_service.py 98.24% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5466      +/-   ##
==========================================
+ Coverage   89.88%   89.92%   +0.03%     
==========================================
  Files        1132     1136       +4     
  Lines       35275    35450     +175     
==========================================
+ Hits        31706    31877     +171     
- Misses       3569     3573       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@AdriiiPRodri AdriiiPRodri force-pushed the PRWLR-4469-Ensure-Step-Functions-State-Machines-Have-Logging-Enabled branch from 6636b62 to 4999bf0 Compare October 20, 2024 21:51
Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

Co-authored-by: Rubén De la Torre Vico <[email protected]>
Copy link
Contributor

You can check the documentation for this PR here -> Prowler Documentation

Copy link
Member

@MrCloudSec MrCloudSec left a comment

Choose a reason for hiding this comment

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

@AdriiiPRodri, to simplify the check, please ensure it only verifies whether the state machine has logging enabled, regardless of the log level (similar to how other logging checks in Prowler work). Additionally, include only the necessary attributes and functions required to verify logging, avoiding any extra details that Prowler doesn't currently use. This approach will help minimize potential errors in unused attributes or functions.

Thanks for your work on this! 😊

@AdriiiPRodri
Copy link
Contributor Author

@AdriiiPRodri, to simplify the check, please ensure it only verifies whether the state machine has logging enabled, regardless of the log level (similar to how other logging checks in Prowler work). Additionally, include only the necessary attributes and functions required to verify logging, avoiding any extra details that Prowler doesn't currently use. This approach will help minimize potential errors in unused attributes or functions.

Thanks for your work on this! 😊

In this case I have added the logic to check the logging level enabled since it seems that SecurityHub does the same, so I replicated the behavior to make it work like SecurityHub: https://docs.aws.amazon.com/securityhub/latest/userguide/stepfunctions-controls.html#stepfunctions-1

If this is not really necessary I will remove that logic, I would need confirmation as this logging check is not like other services.

@AdriiiPRodri
Copy link
Contributor Author

AdriiiPRodri commented Nov 19, 2024

As agreed, the specific logging level check has been removed. Now it is ready for review @MrCloudSec @puchy22

Copy link
Member

@MrCloudSec MrCloudSec left a comment

Choose a reason for hiding this comment

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

Please @AdriiiPRodri, review my comments.

@AdriiiPRodri AdriiiPRodri force-pushed the PRWLR-4469-Ensure-Step-Functions-State-Machines-Have-Logging-Enabled branch from 9ef9a54 to 6cf1db1 Compare November 19, 2024 14:20
Copy link
Member

@MrCloudSec MrCloudSec left a comment

Choose a reason for hiding this comment

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

Could you update the tests to use Moto? It’s important to ensure the responses match AWS API behavior as closely as possible. Let me know if you need help with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation provider/aws Issues/PRs related with the AWS provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants