-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Integration Tests: Check for exceptions at build time #10789
Conversation
DryRun Security SummaryThe code change in this pull request is a script that identifies missing dependencies for the Chrome browser in a Docker environment, logs the missing packages, and helps prevent potential security vulnerabilities or stability problems. Expand for full summarySummary: The code change in this pull request is part of a script that identifies missing dependencies for the Chrome browser when running in a Docker environment. The script uses the From an application security perspective, this change is focused on ensuring the correct dependencies are installed for the Chrome browser, which is a critical component for many web applications. By identifying and resolving missing dependencies, the script helps prevent potential issues related to missing libraries or outdated dependencies, which could lead to security vulnerabilities or stability problems. The code appears to be well-structured and handles errors appropriately, but there are a few areas for potential improvement, such as adding more robust error handling and extending the script to automatically install the missing packages. Files Changed:
Overall, this code change is focused on improving the reliability and security of the Chrome browser deployment in a Docker environment, which is an important aspect of application security. Code AnalysisWe ran Riskiness🟢 Risk threshold not exceeded. |
return stdout, code | ||
with suppress(subprocess.CalledProcessError): | ||
return run_command(["ldd", file_path]) | ||
return "", 1 | ||
|
||
|
||
raw_deps = ldd("/opt/chrome/chrome") |
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.
Doesn't this also need to check the return code, or does ldd
return a nonzero status code in cases that aren't really errors for us here? Just thinking we may not want to ignore all ldd
errors.
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 believe the intention is to return an empty string such we skip the logic of identifying missing packages. We could just allow it to error out instead though If that would be preferable
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.
It appears that ldd
exits with a nonzero status code when there's some kind of issue reading the executable (or if it's not a valid executable at all). Unfortunately that StackOverflow answer is all I can find - the ldd
man page doesn't say anything about exit status codes. I suppose we can wait until the executable fails to run since that might give us a more descriptive error
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.
Approved
This test was ran when we knew integration tests would fail, and the error was still not caught earlier.. It seems like more attention is needed on this one |
Looks like I will need to spend more time on this solution... |
@cneill I swapped in the dynamic chrome version fetching and the builds still failed. The interesting part is that the script is working sorta as expected?
That seems out of the scope of this PR. Does the current implementation of check the error codes of |
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.
Looks good! We can circle back on the other issues with installing Chrome in the future
In the event of an exception in the
docker/install_chrome_dependencies.py
file at build time, the exception should not be swallowed, and instead raised to prevent unit tests from churning needlessly[sc-7194]