Skip to content

Commit 125ce99

Browse files
committed
Change HuggingFace Space default visibility to private for security
Changed the default value of `private` parameter from False to True to follow security best practices. Private by default prevents accidental exposure of deployment information. Changes: - Set private=True as default in HuggingFaceDeployerSettings - Updated docstring to indicate default is True for security - Updated documentation to reflect new default value - Removed redundant private=True from code example (now default) - Updated security section to mention both private and public Spaces - Clarified that secure secrets handling protects credentials even in public Spaces Users can still explicitly set private=False to make Spaces publicly visible, but the safer default protects users who don't explicitly configure visibility.
1 parent 5a3595b commit 125ce99

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

docs/book/component-guide/deployers/huggingface.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ For additional configuration of the Hugging Face deployer, you can pass the foll
103103

104104
* `space_hardware` (default: `None`): Hardware tier for the Space (e.g., `'cpu-basic'`, `'cpu-upgrade'`, `'t4-small'`, `'t4-medium'`, `'a10g-small'`, `'a10g-large'`). If not specified, uses free CPU tier. See [Hugging Face Spaces GPU documentation](https://huggingface.co/docs/hub/spaces-gpus) for available options and pricing.
105105
* `space_storage` (default: `None`): Persistent storage tier for the Space (e.g., `'small'`, `'medium'`, `'large'`). If not specified, no persistent storage is allocated.
106-
* `private` (default: `False`): Whether to create the Space as private. Public Spaces are visible to everyone.
106+
* `private` (default: `True`): Whether to create the Space as private. Set to `False` to make the Space publicly visible to everyone.
107107
* `app_port` (default: `8000`): Port number where your deployment server listens. Defaults to 8000 (ZenML server default). Hugging Face Spaces will route traffic to this port.
108108

109109
Check out [this docs page](https://docs.zenml.io/concepts/steps_and_pipelines/configuration) for more information on how to specify settings.
@@ -116,7 +116,7 @@ from zenml.integrations.huggingface.deployers import HuggingFaceDeployerSettings
116116
huggingface_settings = HuggingFaceDeployerSettings(
117117
space_hardware="t4-small",
118118
space_storage="small",
119-
private=True,
119+
# private=True is the default for security
120120
)
121121

122122
@pipeline(
@@ -167,12 +167,12 @@ The Hugging Face deployer handles secrets and environment variables **securely**
167167
- **Nothing is baked into the Dockerfile** - no risk of leaked credentials even in public Spaces
168168

169169
**What this means:**
170-
- ✅ Safe to use with public Spaces (the default)
171-
- ✅ Secrets remain encrypted and hidden from public view
170+
- ✅ Safe to use with both private and public Spaces
171+
- ✅ Secrets remain encrypted and hidden from view
172172
- ✅ Environment variables are managed through HF's secure API
173173
- ✅ No credentials exposed in Dockerfile or repository files
174174

175-
This is especially important since Hugging Face Spaces are **public by default** (`private: bool = False`). Without this secure approach, any secrets would be visible to anyone viewing your Space's repository.
175+
This secure approach ensures that if you choose to make your Space public (`private=False`), credentials remain protected and are never visible to anyone viewing your Space's repository.
176176

177177
### Container Registry Requirement
178178

src/zenml/integrations/huggingface/deployers/huggingface_deployer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ class HuggingFaceDeployerSettings(BaseDeployerSettings):
6565
Attributes:
6666
space_hardware: Hardware tier for the Space (e.g., 'cpu-basic', 't4-small')
6767
space_storage: Persistent storage tier (e.g., 'small', 'medium', 'large')
68-
private: Whether to create a private Space
68+
private: Whether to create a private Space (default: True for security)
6969
app_port: Port the container exposes (default 8000 for ZenML server)
7070
"""
7171

7272
space_hardware: Optional[str] = None
7373
space_storage: Optional[str] = None
74-
private: bool = False
74+
private: bool = True
7575
app_port: int = 8000
7676

7777

0 commit comments

Comments
 (0)