derrickaw opened a new pull request, #41500: URL: https://github.com/apache/beam/pull/41500
Note: this PR was auto-generated by tooling. Before moving it out of draft, the author has done a full review of the PR, specifically evaluating it on the following criteria: - The PR remediates confirmed, live Code Scanning finding(s) (`CodeQL` / `zizmor`) on `master` without altering intended public API or workflow semantics - The fix is minimal, idiomatic, and avoids suppressing alerts or masking underlying defects - Relevant unit tests, linters, and CI checks have been verified If you have concerns with the PR or with the underlying methodology used to generate this, please comment below - they will be addressed by the author not the tooling :) ## Summary - Resolves CodeQL `py/incomplete-url-substring-sanitization` (`CWE-020`, High/Warning, [alert #71](https://github.com/apache/beam/security/code-scanning/71)) in `sdks/java/container/license_scripts/pull_licenses_java.py`. - Replaces the substring check `'opensource.org' in url` with `urllib.parse.urlparse(url).hostname` validation (`opensource.org` or `*.opensource.org`) and suffix slicing (`url[:-len('-license.php')]`) so non-OpenSource.org URLs containing `opensource.org` in a path or query parameter are not rewritten. ## Verification - `python3 -m py_compile sdks/java/container/license_scripts/pull_licenses_java.py` - Verified URL normalization behavior across `opensource.org`, `www.opensource.org`, `evilopensource.org`, `example.com/opensource.org/foo-license.php`, and `file://` URLs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
