- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
MediaConvert #7
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
MediaConvert #7
Conversation
| if (empty($dotenv['APP_VERSION'])) { | ||
| $this->throwException($dotenv, 'APP_VERSION'); | 
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.
 Potential bug: Direct access to keys in the $dotenv array without an existence check can cause 'Undefined array key' errors if environment variables are missing.
- 
Description: The
EnsureEnvIsConfiguredCorrectlyStepvalidates environment variables. However, when a variable likeASSET_URLorAWS_MEDIACONVERT_ROLE_IDis missing, the code accesses the$dotenvarray without checking if the key exists. This occurs both in direct comparisons and within thethrowExceptionmethod when constructing the error message ({$dotenv[$key]}). This results in a PHP 'Undefined array key' warning. In environments with strict error reporting, this warning will be treated as an error, causing the deployment to crash instead of gracefully reporting the missing configuration. - 
Suggested fix: Before accessing keys from the
$dotenvarray, verify their existence usingisset()or the null coalescing operator (??). For example, in thethrowExceptionmethod, change{$dotenv[$key]}to{$dotenv[$key] ?? 'not set'}to prevent errors when constructing the exception message for a missing key.
severity: 0.7, confidence: 0.95 
Did we get this right? 👍 / 👎 to inform future reviews.
Hey, I made a thing! 🥳
Great! Now please answer the following questions to help out your assigned reviewer:
What problems are you solving?
AWSElementalMediaConvertFullAccessto EC2 roleAPP_VERSIONandASSET_URLYOLO_$ENV_AWS_PROFILEis default / null for safetyIs there anything the reviewer needs to know to deploy this?
sync:iamwill need to run in each environment. This will set the necessary service role for MediaConvert to assume when running, as well as allow the EC2 role to manage MediaConvert.