feat: add license filtering with compliance check#1379
feat: add license filtering with compliance check#1379behnazh-w merged 6 commits intooracle:mainfrom
Conversation
There was a problem hiding this comment.
@RuchitAgrawal Thank you for contributing to our project.
To test this check end-to-end, please add the line to the one of the integration tests to make sure the new check passes. Here is one candidate:
tests/integration/cases/pypi_arrow/policy.dl
Policy("has-hosted-build", component_id, "Require a hosted build and publishing service.") :-
check_passed(component_id, "mcn_build_as_code_1"),
check_passed(component_id, "mcn_license_1").
This should pass as arrow uses the Apache 2.0 license.
|
Thank you for the review and Feedback. I've gone through your comments and noted the required adjustments. I'll get those changes implemented and pushed by tonight. |
|
Hi @behnazh-w, I have implemented the fixes based on your suggestions and feedback. Could you kindly review these changes? I’m happy to make further improvements if anything else is needed. |
|
@RuchitAgrawal thanks for the changes, they look good! A few more things:
|
- Add [license] section to defaults.ini with enabled, allowed_licenses, and require_license options - Add GhAPIClient.get_license() using GitHub REST API endpoint - Implement LicenseCheck (mcn_license_1) with GitHub API detection and filesystem fallback - Add unit tests covering all detection and policy scenarios Fixes oracle#729 Signed-off-by: ruchitagrawal <rragrawal16@gmail.com>
Signed-off-by: ruchitagrawal <rragrawal16@gmail.com>
Signed-off-by: ruchitagrawal <rragrawal16@gmail.com>
5aaa8dd to
abea8ca
Compare
|
@behnazh-w, thank you for the guidance and feedback! I have added the check to the table and tested locally to ensure make docs compiles properly. I also made sure to verify and sign all my commits. |
That looks good, thanks. I just added a comment about using an allow list vs deny list. |
Signed-off-by: ruchitagrawal <rragrawal16@gmail.com>
213ef09 to
0c71e96
Compare
|
Thank you for the suggestion. I have updated the implementation to use deny list instead of allowed list for a better license check. I've also updated the tests and docs accordingly. Please let me know if this looks good! |
Summary
Implements license filtering for Macaron. Adds a new check that detects a repository's license via the GitHub API and validates it against a user-configured SPDX allow-list.
Description of changes
defaults.iniwith options to enable the check, define allowed SPDX identifiers, and require a license to be present.get_license()to GhAPIClient using the GitHub REST API to fetch license data.mcn_license_1which detects the repository license via the GitHub API, falls back to the cloned filesystem, and reports PASSED or FAILED based on the configured allow-list.Related issues
Fixes #729
Checklist
verifiedlabel should appear next to all of your commits on GitHub.