Skip to content

feat: add trusted orgs and flag#512

Merged
drbh merged 11 commits intomainfrom
add-trusted-orgs
May 4, 2026
Merged

feat: add trusted orgs and flag#512
drbh merged 11 commits intomainfrom
add-trusted-orgs

Conversation

@drbh
Copy link
Copy Markdown
Collaborator

@drbh drbh commented Apr 29, 2026

This PR adds a trust_remote_code and hardcoded list of trusted orgs

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

sayakpaul
sayakpaul previously approved these changes May 1, 2026
Comment thread kernels/src/kernels/utils.py Outdated

KNOWN_BACKENDS = {"cpu", "cuda", "metal", "neuron", "rocm", "xpu", "npu"}

TRUSTED_KERNEL_ORGS = {"kernels-community", "kernels-test", "sglang"}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
TRUSTED_KERNEL_ORGS = {"kernels-community", "kernels-test", "sglang"}
TRUSTED_KERNEL_ORGS = {"kernels-community", "kernels-staging", "kernels-test", "sglang"}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please rely on the hub api for this, so it's consistent with the UI:

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

{"kernels-community", "kernels-staging", "kernels-test", "sglang"}

Can we ensure the above list is consistent with the Hub?

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.

thanks for the feedback, i've updated _check_trust_remote_code to check the repo_info response for the trustedPublisher attribute.

full logic is:

  1. if trust_remote_code=True, skip all checks
  2. check the hardcoded list (just "kernels-test" for now)
  3. fetch the repo_info and check attribute

Copy link
Copy Markdown

@krampstudio krampstudio May 2, 2026

Choose a reason for hiding this comment

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

{"kernels-community", "kernels-staging", "kernels-test", "sglang"}

Can we ensure the above list is consistent with the Hub?

Here is the list configured on the Hub:

Screenshot 2026-05-02 at 15 27 58

Comment thread kernels/src/kernels/__init__.py Outdated
Comment thread kernels/tests/test_basic.py Outdated
Comment thread kernels/tests/test_basic.py Outdated
Co-authored-by: Daniël de Kok <me@danieldk.eu>
Comment thread kernels/src/kernels/utils.py Outdated
)

org = repo_id.split("/", 1)[0]
if org in _ALWAYS_TRUSTED_ORGS:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this, since kernels-test is already a trusted org. That way, this would get properly tested during tests as well.

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.

nope this is unneeded now (just ran into some CI issues without this special case earlier). it looks like kernels-test are returning the trustedPublisher attribute now after some spot checks.

removed in latest

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.

ahh the issue is now we surface a untrusted publisher if the repo info cannot be fetched since the check depends on the repo info. need to revisit with a better solution

Comment thread kernels/tests/test_basic.py Outdated
Comment thread kernels/tests/test_basic.py Outdated
Co-authored-by: Daniël de Kok <me@danieldk.eu>
@drbh drbh merged commit 658395e into main May 4, 2026
67 of 68 checks passed
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.

6 participants