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: Repo license check #9

Merged
merged 6 commits into from Jul 27, 2023
Merged

feat: Repo license check #9

merged 6 commits into from Jul 27, 2023

Conversation

Anush008
Copy link
Member

@Anush008 Anush008 commented Jul 26, 2023

Description

This PR updates the dependencies in the Cargo.lock file. It removes the actix-tls package and updates the versions of actix-utils, rustls, tokio-rustls, and tokio packages. The changes in the Cargo.toml file include removing the feature flag for rustls in the actix-web package. Additionally, this PR introduces a new function is_indexing_allowed in the github/mod.rs file to check if indexing is allowed based on the repository's license. The function is used in the embeddings route in the routes/mod.rs file to validate the repository's license before processing the request. The PR also includes tests for the new function.

Generated using OpenSauced.

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • πŸ“¦ Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Resolves #7.

Mobile & Desktop Screenshots/Recordings

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

  • πŸ“œ README.md
  • πŸ““ docs.opensauced.pizza
  • πŸ• dev.to/opensauced
  • πŸ“• storybook
  • πŸ™… no documentation needed

Copy link
Member

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

Tested with the https://github.com/grafana/grafana repo (which is copy left AGPL-3)

{
	"owner": "grafana",
	"name": "grafana",
	"branch": "main"
}

And this gives a 403 response:

Impermissible repository license

Could we decorate this error alittle bit? Maybe something like

Error: Impermissible repository license for
https://api.github.com/repos/grafana/grafana/license
Found: AGPL-3.0 license

just so the user has abit more info one what's going on?

src/github/mod.rs Outdated Show resolved Hide resolved
src/github/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thanks for the turnaround. I have been slowly sharing this repo with folks, and this has come as a concern.

Be sure to commit John's spelling fix before merging.

@Anush008
Copy link
Member Author

Could we decorate this error alittle bit? Maybe something like

Error: Impermissible repository license for
https://api.github.com/repos/grafana/grafana/license
Found: AGPL-3.0 license

just so the user has abit more info one what's going on?

New 403 response:

{
   "license":{
      "name":"GNU Affero General Public License v3.0",
      "url":"https://github.com/grafana/grafana/blob/main/LICENSE"
   },
   "message":"Impermissible repository license"
}

Copy link
Member

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ‘πŸΌ πŸ‘πŸΌ πŸ‘πŸΌ

src/routes/mod.rs Show resolved Hide resolved
@jpmcb jpmcb merged commit a995738 into alpha Jul 27, 2023
1 check passed
@Anush008 Anush008 deleted the repo-license-check branch July 30, 2023 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Error on projects without a permissible license
3 participants