Giter Club home page Giter Club logo

Comments (14)

Bo98 avatar Bo98 commented on June 16, 2024 2

One option would be to use the licensee gem that GitHub use themselves for that API, which would have the bonus of working with not-GitHub sources. But it would require having the source downloaded and I don't think any of our audits do that.

Given we do have metadata file copying however, we could make it an installed keg check and read those files.

from brew.

SMillerDev avatar SMillerDev commented on June 16, 2024 2

If @issyl0 managed to make the license API work for branches I think that should be good enough at least for cases like this. I don't really know of any cases where an install time check would be better.

from brew.

apainintheneck avatar apainintheneck commented on June 16, 2024 1

It seems like we use a Github API endpoint to fetch this information which doesn't provide any way to specify the version of the repo.

def self.get_repo_license(user, repo)
response = API.open_rest("#{API_URL}/repos/#{user}/#{repo}/license")
return unless response.key?("license")
response["license"]["spdx_id"]
rescue API::HTTPNotFoundError
nil
rescue API::AuthenticationFailedError => e
raise unless e.message.match?(API::GITHUB_IP_ALLOWLIST_ERROR)
end

from brew.

Bo98 avatar Bo98 commented on June 16, 2024 1

I think we have a license mismatch allowlist we can use here? It might get forgotten though.

We do and are using that for now. But allowlists really should be for genuine exceptions rather than silencing a buggy audit.

from brew.

SMillerDev avatar SMillerDev commented on June 16, 2024 1

And did you fix it when you found out? 😅

from brew.

issyl0 avatar issyl0 commented on June 16, 2024 1

@SMillerDev I have a PR open, it's waiting on the team who actually works on this stuff to tell me how I should have done it. 😂

from brew.

SMillerDev avatar SMillerDev commented on June 16, 2024

We check files in the install all the time. Should be disable to add license

from brew.

carlocab avatar carlocab commented on June 16, 2024

I think we have a license mismatch allowlist we can use here? It might get forgotten though.

from brew.

issyl0 avatar issyl0 commented on June 16, 2024

Are we saying that the license could change between a release branch and the main branch? Feels like something the /repos/license endpoint should be able to handle (personal opinion).

EDIT: Hmm, tested this and gh api "repos/issyl0/rl-testing/license" returns MIT. I noticed it might take a ref query parameter, but gh api "repos/issyl0/rl-testing/license?ref=test-new-license" still returns MIT (despite the other fields saying that it's definitely on the new branch).

Maybe it only computes licenses on the main branch?

from brew.

SMillerDev avatar SMillerDev commented on June 16, 2024

Yeah, I'd expect the same of the endpoint

from brew.

issyl0 avatar issyl0 commented on June 16, 2024

You've successfully nerd-sniped me into figuring out why /repos/.../license?ref=blah doesn't work. 🙃

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on June 16, 2024

We check files in the install all the time. Should be disable to add license

Agreed. I don't think we should do this always but it would be nice to have some sort of license audit here that can handle the case where the tarball output is correct even if the upstream repo is not.

from brew.

SMillerDev avatar SMillerDev commented on June 16, 2024

Okay, I now see that comment was different than what I meant, which was:

We check files in the install all the time. Should be possible to add a license check

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on June 16, 2024

@SMillerDev Yeh, I agree with that too. My thinking is that we'll need to do something clever so that the install time license check is only used some of the time when we know there's problems and a mismatch otherwise (rather than moving all license checks to always be install time)

from brew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.