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: Github fallback for empty PURL for license exclusion #848

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions __tests__/licenses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,29 @@ test('it does not fail when the packages dont have a valid PURL', async () => {
expect(invalidLicenses.forbidden.length).toEqual(1)
})

test('it does not filter out changes that are on the exclusions list with empty PURL fallback', async () => {
const emptyPurlChange = {
...pipChange,
package_url: '',
source_repository_url: 'https://github.com/some-owner/some-repo'
}

const changes: Changes = [emptyPurlChange, npmChange, rubyChange]
const licensesConfig = {
allow: ['BSD-3-Clause'],
licenseExclusions: [
'pkg:npm/[email protected]',
'pkg:github/some-owner/some-repo'
]
}

const invalidLicenses = await getInvalidLicenseChanges(
changes,
licensesConfig
)
expect(invalidLicenses.forbidden.length).toEqual(0)
})

test('it does filters out changes if they are not on the exclusions list', async () => {
const changes: Changes = [pipChange, npmChange, rubyChange]
const licensesConfig = {
Expand Down
Loading