Skip to content

feat(github): Allow to configure which orgs/repos the github auth applies to#175

Merged
athornton merged 3 commits intodatopian:mainfrom
vit-zikmund:restrict_to
Dec 13, 2024
Merged

feat(github): Allow to configure which orgs/repos the github auth applies to#175
athornton merged 3 commits intodatopian:mainfrom
vit-zikmund:restrict_to

Conversation

@vit-zikmund
Copy link
Copy Markdown
Collaborator

@vit-zikmund vit-zikmund commented Dec 11, 2024

This is done via a configuration item restrict_to, which is a dict of Github orgs, potentially containing a list of repos.

restrict_to:
  org1:
  - repo1  # accept org1/repo1
  - repo2  # accept org1/repo2
  org2: []  # accept all repos of that org

Closes: #166

This allows the operator to configure orgs (and repos) that are restricted to the GitHub authentication. Auth attempts for anything outside the list gets rejected.
@vit-zikmund
Copy link
Copy Markdown
Collaborator Author

PR created as promised in #166 (comment).
@athornton this one is easy peasy :)

Comment thread docs/source/auth-providers.md Outdated
* `api_url` (`str` = `"https://api.github.com"`): Base URL for the GitHub API (enterprise servers have API at `"https://<custom-hostname>/api/v3/"`).
* `api_timeout` (`float | tuple[float, float]` = `(10.0, 20.0)`): Timeout for the GitHub API calls ([details](https://requests.readthedocs.io/en/stable/user/advanced/#timeouts)).
* `api_version` (`str | None` = `"2022-11-28"`): Target GitHub API version; set to `None` to use GitHub's latest (rather experimental).
* `restrict_to` (`dict[str, list[str] | None] | None` = `None`): Optional (but very recommended) dictionary of GitHub organizations/users the authentication is restricted to. Each key (organization name) in the dictionary can contain a list of further restricted repository names. When the list is empty (or null), only the organizations are considered.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd say "highly recommended" rather than "very recommended" but honestly everyone will know what it means.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, thanks for correcting my Czenglish! I can't appreciate this enough :)

Copy link
Copy Markdown
Collaborator

@athornton athornton left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@athornton athornton merged commit a87ea84 into datopian:main Dec 13, 2024
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.

Github authentication

2 participants