xenfra 0.4.3__py3-none-any.whl → 0.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xenfra/commands/__init__.py +3 -3
- xenfra/commands/auth.py +144 -144
- xenfra/commands/auth_device.py +164 -164
- xenfra/commands/deployments.py +1133 -973
- xenfra/commands/intelligence.py +503 -412
- xenfra/commands/projects.py +204 -204
- xenfra/commands/security_cmd.py +233 -233
- xenfra/main.py +76 -75
- xenfra/utils/__init__.py +3 -3
- xenfra/utils/auth.py +374 -374
- xenfra/utils/codebase.py +169 -169
- xenfra/utils/config.py +459 -436
- xenfra/utils/errors.py +116 -116
- xenfra/utils/file_sync.py +286 -286
- xenfra/utils/security.py +336 -336
- xenfra/utils/validation.py +234 -234
- xenfra-0.4.4.dist-info/METADATA +113 -0
- xenfra-0.4.4.dist-info/RECORD +21 -0
- xenfra-0.4.3.dist-info/METADATA +0 -118
- xenfra-0.4.3.dist-info/RECORD +0 -21
- {xenfra-0.4.3.dist-info → xenfra-0.4.4.dist-info}/WHEEL +0 -0
- {xenfra-0.4.3.dist-info → xenfra-0.4.4.dist-info}/entry_points.txt +0 -0
xenfra/commands/security_cmd.py
CHANGED
|
@@ -1,233 +1,233 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Security configuration commands for Xenfra CLI.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import os
|
|
6
|
-
|
|
7
|
-
import click
|
|
8
|
-
from rich.console import Console
|
|
9
|
-
from rich.panel import Panel
|
|
10
|
-
from rich.table import Table
|
|
11
|
-
|
|
12
|
-
from ..utils.security import ALLOWED_DOMAINS, security_config, validate_and_get_api_url
|
|
13
|
-
|
|
14
|
-
console = Console()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@click.group(hidden=True)
|
|
18
|
-
def security():
|
|
19
|
-
"""Security and configuration management (for debugging/advanced users)."""
|
|
20
|
-
pass
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@security.command()
|
|
24
|
-
def check():
|
|
25
|
-
"""Display current security configuration."""
|
|
26
|
-
# Get current API URL
|
|
27
|
-
try:
|
|
28
|
-
api_url = validate_and_get_api_url()
|
|
29
|
-
except click.Abort:
|
|
30
|
-
api_url = os.getenv("XENFRA_API_URL", "Not set")
|
|
31
|
-
|
|
32
|
-
# Display configuration
|
|
33
|
-
console.print("\n[bold cyan]🔒 Xenfra CLI Security Configuration[/bold cyan]\n")
|
|
34
|
-
|
|
35
|
-
# API URL
|
|
36
|
-
console.print(f"[bold]API URL:[/bold] {api_url}")
|
|
37
|
-
|
|
38
|
-
# Environment
|
|
39
|
-
env_color = "green" if security_config.is_production() else "yellow"
|
|
40
|
-
console.print(
|
|
41
|
-
f"[bold]Environment:[/bold] [{env_color}]{security_config.environment}[/{env_color}]"
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
console.print()
|
|
45
|
-
|
|
46
|
-
# Security features table
|
|
47
|
-
table = Table(title="Security Features", show_header=True)
|
|
48
|
-
table.add_column("Feature", style="cyan")
|
|
49
|
-
table.add_column("Status", style="white")
|
|
50
|
-
table.add_column("Description", style="dim")
|
|
51
|
-
|
|
52
|
-
features = [
|
|
53
|
-
(
|
|
54
|
-
"HTTPS Enforcement",
|
|
55
|
-
"✅ Enabled" if security_config.enforce_https else "⚠️ Disabled",
|
|
56
|
-
"Blocks HTTP connections (except localhost)",
|
|
57
|
-
),
|
|
58
|
-
(
|
|
59
|
-
"Domain Whitelist",
|
|
60
|
-
"✅ Enforced" if security_config.enforce_whitelist else "⚠️ Warning Only",
|
|
61
|
-
"Restricts connections to approved domains",
|
|
62
|
-
),
|
|
63
|
-
(
|
|
64
|
-
"HTTP Warning",
|
|
65
|
-
"✅ Enabled" if security_config.warn_on_http else "❌ Disabled",
|
|
66
|
-
"Warns when using insecure HTTP",
|
|
67
|
-
),
|
|
68
|
-
(
|
|
69
|
-
"Certificate Pinning",
|
|
70
|
-
"✅ Enabled" if security_config.enable_cert_pinning else "❌ Disabled",
|
|
71
|
-
"Validates SSL certificate fingerprints",
|
|
72
|
-
),
|
|
73
|
-
]
|
|
74
|
-
|
|
75
|
-
for feature, status, description in features:
|
|
76
|
-
table.add_row(feature, status, description)
|
|
77
|
-
|
|
78
|
-
console.print(table)
|
|
79
|
-
console.print()
|
|
80
|
-
|
|
81
|
-
# Whitelisted domains
|
|
82
|
-
console.print("[bold]Whitelisted Domains:[/bold]")
|
|
83
|
-
for domain in ALLOWED_DOMAINS:
|
|
84
|
-
console.print(f" • {domain}")
|
|
85
|
-
|
|
86
|
-
console.print()
|
|
87
|
-
|
|
88
|
-
# Environment variables
|
|
89
|
-
console.print("[bold]Configuration via Environment Variables:[/bold]")
|
|
90
|
-
env_vars = [
|
|
91
|
-
("XENFRA_ENV", os.getenv("XENFRA_ENV", "development")),
|
|
92
|
-
("XENFRA_API_URL", os.getenv("XENFRA_API_URL", "http://localhost:8000")),
|
|
93
|
-
("XENFRA_ENFORCE_HTTPS", os.getenv("XENFRA_ENFORCE_HTTPS", "auto")),
|
|
94
|
-
("XENFRA_ENFORCE_WHITELIST", os.getenv("XENFRA_ENFORCE_WHITELIST", "auto")),
|
|
95
|
-
("XENFRA_ENABLE_CERT_PINNING", os.getenv("XENFRA_ENABLE_CERT_PINNING", "auto")),
|
|
96
|
-
("XENFRA_WARN_ON_HTTP", os.getenv("XENFRA_WARN_ON_HTTP", "true")),
|
|
97
|
-
]
|
|
98
|
-
|
|
99
|
-
for var, value in env_vars:
|
|
100
|
-
console.print(f" {var}=[cyan]{value}[/cyan]")
|
|
101
|
-
|
|
102
|
-
console.print()
|
|
103
|
-
|
|
104
|
-
# Security recommendations
|
|
105
|
-
if not security_config.is_production():
|
|
106
|
-
console.print(
|
|
107
|
-
Panel(
|
|
108
|
-
"[yellow]⚠️ Development Mode Active[/yellow]\n\n"
|
|
109
|
-
"For production use:\n"
|
|
110
|
-
"1. Set XENFRA_ENV=production\n"
|
|
111
|
-
"2. Use HTTPS API URL\n"
|
|
112
|
-
"3. All security features will auto-enable",
|
|
113
|
-
title="Recommendation",
|
|
114
|
-
border_style="yellow",
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
else:
|
|
118
|
-
console.print(
|
|
119
|
-
Panel(
|
|
120
|
-
"[green]✅ Production Security Enabled[/green]\n\n"
|
|
121
|
-
"All security features are active.\n"
|
|
122
|
-
"Your credentials and data are protected.",
|
|
123
|
-
title="Status",
|
|
124
|
-
border_style="green",
|
|
125
|
-
)
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
@security.command()
|
|
130
|
-
@click.argument("url")
|
|
131
|
-
def validate(url):
|
|
132
|
-
"""Validate an API URL against security policies."""
|
|
133
|
-
console.print(f"\n[cyan]Validating URL:[/cyan] {url}\n")
|
|
134
|
-
|
|
135
|
-
try:
|
|
136
|
-
validated_url = validate_and_get_api_url(url)
|
|
137
|
-
console.print("[bold green]✅ URL is valid and passed all security checks![/bold green]")
|
|
138
|
-
console.print(f"[dim]Validated URL: {validated_url}[/dim]")
|
|
139
|
-
except click.Abort:
|
|
140
|
-
console.print("[bold red]❌ URL failed security validation[/bold red]")
|
|
141
|
-
except Exception as e:
|
|
142
|
-
console.print(f"[bold red]❌ Validation error: {e}[/bold red]")
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
@security.command()
|
|
146
|
-
def docs():
|
|
147
|
-
"""Show security documentation."""
|
|
148
|
-
docs_text = """
|
|
149
|
-
[bold cyan]Xenfra CLI Security Guide[/bold cyan]
|
|
150
|
-
|
|
151
|
-
[bold]Environment Detection:[/bold]
|
|
152
|
-
The CLI automatically adjusts security based on the environment:
|
|
153
|
-
|
|
154
|
-
• [green]production[/green]: All security features enforced
|
|
155
|
-
• [yellow]staging[/yellow]: HTTPS required, whitelist warnings
|
|
156
|
-
• [blue]development[/blue]: Permissive (localhost allowed)
|
|
157
|
-
|
|
158
|
-
[bold]Security Features:[/bold]
|
|
159
|
-
|
|
160
|
-
1. [cyan]URL Validation[/cyan]
|
|
161
|
-
- Prevents malicious URL patterns
|
|
162
|
-
- Blocks URLs with embedded credentials
|
|
163
|
-
- Validates scheme (http/https only)
|
|
164
|
-
|
|
165
|
-
2. [cyan]Domain Whitelist[/cyan]
|
|
166
|
-
- Restricts connections to approved domains
|
|
167
|
-
- Prevents credential theft via fake APIs
|
|
168
|
-
- Can be disabled for self-hosted instances
|
|
169
|
-
|
|
170
|
-
3. [cyan]HTTPS Enforcement[/cyan]
|
|
171
|
-
- Requires encrypted connections in production
|
|
172
|
-
- Warns on insecure HTTP (non-localhost)
|
|
173
|
-
- Protects credentials and data in transit
|
|
174
|
-
|
|
175
|
-
4. [cyan]Certificate Pinning[/cyan]
|
|
176
|
-
- Validates SSL certificate fingerprints
|
|
177
|
-
- Prevents man-in-the-middle attacks
|
|
178
|
-
- Optional (enabled in production by default)
|
|
179
|
-
|
|
180
|
-
[bold]Configuration Examples:[/bold]
|
|
181
|
-
|
|
182
|
-
[yellow]Development (default):[/yellow]
|
|
183
|
-
$ xenfra login
|
|
184
|
-
# Uses http://localhost:8000
|
|
185
|
-
|
|
186
|
-
[yellow]Self-hosted instance:[/yellow]
|
|
187
|
-
$ export XENFRA_API_URL=https://xenfra.mycompany.com
|
|
188
|
-
$ export XENFRA_ENFORCE_WHITELIST=false
|
|
189
|
-
$ xenfra login
|
|
190
|
-
|
|
191
|
-
[yellow]Production (strict):[/yellow]
|
|
192
|
-
$ export XENFRA_ENV=production
|
|
193
|
-
$ xenfra login
|
|
194
|
-
# All security features enabled
|
|
195
|
-
|
|
196
|
-
[bold]Environment Variables:[/bold]
|
|
197
|
-
|
|
198
|
-
XENFRA_ENV
|
|
199
|
-
Values: production | staging | development
|
|
200
|
-
Default: development
|
|
201
|
-
|
|
202
|
-
XENFRA_API_URL
|
|
203
|
-
Default: http://localhost:8000 (dev), https://api.xenfra.tech (prod)
|
|
204
|
-
|
|
205
|
-
XENFRA_ENFORCE_HTTPS
|
|
206
|
-
Values: true | false
|
|
207
|
-
Default: false (dev), true (prod)
|
|
208
|
-
|
|
209
|
-
XENFRA_ENFORCE_WHITELIST
|
|
210
|
-
Values: true | false
|
|
211
|
-
Default: false (dev), true (prod)
|
|
212
|
-
|
|
213
|
-
XENFRA_ENABLE_CERT_PINNING
|
|
214
|
-
Values: true | false
|
|
215
|
-
Default: false (dev), true (prod)
|
|
216
|
-
|
|
217
|
-
XENFRA_WARN_ON_HTTP
|
|
218
|
-
Values: true | false
|
|
219
|
-
Default: true
|
|
220
|
-
|
|
221
|
-
[bold]Security Best Practices:[/bold]
|
|
222
|
-
|
|
223
|
-
1. Always use HTTPS in production
|
|
224
|
-
2. Never disable security features without understanding risks
|
|
225
|
-
3. Keep whitelisted domains list updated
|
|
226
|
-
4. Rotate credentials if you suspect compromise
|
|
227
|
-
5. Use environment-specific configurations
|
|
228
|
-
6. Enable all features for production deployments
|
|
229
|
-
|
|
230
|
-
[dim]For more information: https://docs.xenfra.tech/security[/dim]
|
|
231
|
-
"""
|
|
232
|
-
|
|
233
|
-
console.print(Panel(docs_text, border_style="cyan", padding=(1, 2)))
|
|
1
|
+
"""
|
|
2
|
+
Security configuration commands for Xenfra CLI.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
from rich.table import Table
|
|
11
|
+
|
|
12
|
+
from ..utils.security import ALLOWED_DOMAINS, security_config, validate_and_get_api_url
|
|
13
|
+
|
|
14
|
+
console = Console()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@click.group(hidden=True)
|
|
18
|
+
def security():
|
|
19
|
+
"""Security and configuration management (for debugging/advanced users)."""
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@security.command()
|
|
24
|
+
def check():
|
|
25
|
+
"""Display current security configuration."""
|
|
26
|
+
# Get current API URL
|
|
27
|
+
try:
|
|
28
|
+
api_url = validate_and_get_api_url()
|
|
29
|
+
except click.Abort:
|
|
30
|
+
api_url = os.getenv("XENFRA_API_URL", "Not set")
|
|
31
|
+
|
|
32
|
+
# Display configuration
|
|
33
|
+
console.print("\n[bold cyan]🔒 Xenfra CLI Security Configuration[/bold cyan]\n")
|
|
34
|
+
|
|
35
|
+
# API URL
|
|
36
|
+
console.print(f"[bold]API URL:[/bold] {api_url}")
|
|
37
|
+
|
|
38
|
+
# Environment
|
|
39
|
+
env_color = "green" if security_config.is_production() else "yellow"
|
|
40
|
+
console.print(
|
|
41
|
+
f"[bold]Environment:[/bold] [{env_color}]{security_config.environment}[/{env_color}]"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
console.print()
|
|
45
|
+
|
|
46
|
+
# Security features table
|
|
47
|
+
table = Table(title="Security Features", show_header=True)
|
|
48
|
+
table.add_column("Feature", style="cyan")
|
|
49
|
+
table.add_column("Status", style="white")
|
|
50
|
+
table.add_column("Description", style="dim")
|
|
51
|
+
|
|
52
|
+
features = [
|
|
53
|
+
(
|
|
54
|
+
"HTTPS Enforcement",
|
|
55
|
+
"✅ Enabled" if security_config.enforce_https else "⚠️ Disabled",
|
|
56
|
+
"Blocks HTTP connections (except localhost)",
|
|
57
|
+
),
|
|
58
|
+
(
|
|
59
|
+
"Domain Whitelist",
|
|
60
|
+
"✅ Enforced" if security_config.enforce_whitelist else "⚠️ Warning Only",
|
|
61
|
+
"Restricts connections to approved domains",
|
|
62
|
+
),
|
|
63
|
+
(
|
|
64
|
+
"HTTP Warning",
|
|
65
|
+
"✅ Enabled" if security_config.warn_on_http else "❌ Disabled",
|
|
66
|
+
"Warns when using insecure HTTP",
|
|
67
|
+
),
|
|
68
|
+
(
|
|
69
|
+
"Certificate Pinning",
|
|
70
|
+
"✅ Enabled" if security_config.enable_cert_pinning else "❌ Disabled",
|
|
71
|
+
"Validates SSL certificate fingerprints",
|
|
72
|
+
),
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
for feature, status, description in features:
|
|
76
|
+
table.add_row(feature, status, description)
|
|
77
|
+
|
|
78
|
+
console.print(table)
|
|
79
|
+
console.print()
|
|
80
|
+
|
|
81
|
+
# Whitelisted domains
|
|
82
|
+
console.print("[bold]Whitelisted Domains:[/bold]")
|
|
83
|
+
for domain in ALLOWED_DOMAINS:
|
|
84
|
+
console.print(f" • {domain}")
|
|
85
|
+
|
|
86
|
+
console.print()
|
|
87
|
+
|
|
88
|
+
# Environment variables
|
|
89
|
+
console.print("[bold]Configuration via Environment Variables:[/bold]")
|
|
90
|
+
env_vars = [
|
|
91
|
+
("XENFRA_ENV", os.getenv("XENFRA_ENV", "development")),
|
|
92
|
+
("XENFRA_API_URL", os.getenv("XENFRA_API_URL", "http://localhost:8000")),
|
|
93
|
+
("XENFRA_ENFORCE_HTTPS", os.getenv("XENFRA_ENFORCE_HTTPS", "auto")),
|
|
94
|
+
("XENFRA_ENFORCE_WHITELIST", os.getenv("XENFRA_ENFORCE_WHITELIST", "auto")),
|
|
95
|
+
("XENFRA_ENABLE_CERT_PINNING", os.getenv("XENFRA_ENABLE_CERT_PINNING", "auto")),
|
|
96
|
+
("XENFRA_WARN_ON_HTTP", os.getenv("XENFRA_WARN_ON_HTTP", "true")),
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
for var, value in env_vars:
|
|
100
|
+
console.print(f" {var}=[cyan]{value}[/cyan]")
|
|
101
|
+
|
|
102
|
+
console.print()
|
|
103
|
+
|
|
104
|
+
# Security recommendations
|
|
105
|
+
if not security_config.is_production():
|
|
106
|
+
console.print(
|
|
107
|
+
Panel(
|
|
108
|
+
"[yellow]⚠️ Development Mode Active[/yellow]\n\n"
|
|
109
|
+
"For production use:\n"
|
|
110
|
+
"1. Set XENFRA_ENV=production\n"
|
|
111
|
+
"2. Use HTTPS API URL\n"
|
|
112
|
+
"3. All security features will auto-enable",
|
|
113
|
+
title="Recommendation",
|
|
114
|
+
border_style="yellow",
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
else:
|
|
118
|
+
console.print(
|
|
119
|
+
Panel(
|
|
120
|
+
"[green]✅ Production Security Enabled[/green]\n\n"
|
|
121
|
+
"All security features are active.\n"
|
|
122
|
+
"Your credentials and data are protected.",
|
|
123
|
+
title="Status",
|
|
124
|
+
border_style="green",
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@security.command()
|
|
130
|
+
@click.argument("url")
|
|
131
|
+
def validate(url):
|
|
132
|
+
"""Validate an API URL against security policies."""
|
|
133
|
+
console.print(f"\n[cyan]Validating URL:[/cyan] {url}\n")
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
validated_url = validate_and_get_api_url(url)
|
|
137
|
+
console.print("[bold green]✅ URL is valid and passed all security checks![/bold green]")
|
|
138
|
+
console.print(f"[dim]Validated URL: {validated_url}[/dim]")
|
|
139
|
+
except click.Abort:
|
|
140
|
+
console.print("[bold red]❌ URL failed security validation[/bold red]")
|
|
141
|
+
except Exception as e:
|
|
142
|
+
console.print(f"[bold red]❌ Validation error: {e}[/bold red]")
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@security.command()
|
|
146
|
+
def docs():
|
|
147
|
+
"""Show security documentation."""
|
|
148
|
+
docs_text = """
|
|
149
|
+
[bold cyan]Xenfra CLI Security Guide[/bold cyan]
|
|
150
|
+
|
|
151
|
+
[bold]Environment Detection:[/bold]
|
|
152
|
+
The CLI automatically adjusts security based on the environment:
|
|
153
|
+
|
|
154
|
+
• [green]production[/green]: All security features enforced
|
|
155
|
+
• [yellow]staging[/yellow]: HTTPS required, whitelist warnings
|
|
156
|
+
• [blue]development[/blue]: Permissive (localhost allowed)
|
|
157
|
+
|
|
158
|
+
[bold]Security Features:[/bold]
|
|
159
|
+
|
|
160
|
+
1. [cyan]URL Validation[/cyan]
|
|
161
|
+
- Prevents malicious URL patterns
|
|
162
|
+
- Blocks URLs with embedded credentials
|
|
163
|
+
- Validates scheme (http/https only)
|
|
164
|
+
|
|
165
|
+
2. [cyan]Domain Whitelist[/cyan]
|
|
166
|
+
- Restricts connections to approved domains
|
|
167
|
+
- Prevents credential theft via fake APIs
|
|
168
|
+
- Can be disabled for self-hosted instances
|
|
169
|
+
|
|
170
|
+
3. [cyan]HTTPS Enforcement[/cyan]
|
|
171
|
+
- Requires encrypted connections in production
|
|
172
|
+
- Warns on insecure HTTP (non-localhost)
|
|
173
|
+
- Protects credentials and data in transit
|
|
174
|
+
|
|
175
|
+
4. [cyan]Certificate Pinning[/cyan]
|
|
176
|
+
- Validates SSL certificate fingerprints
|
|
177
|
+
- Prevents man-in-the-middle attacks
|
|
178
|
+
- Optional (enabled in production by default)
|
|
179
|
+
|
|
180
|
+
[bold]Configuration Examples:[/bold]
|
|
181
|
+
|
|
182
|
+
[yellow]Development (default):[/yellow]
|
|
183
|
+
$ xenfra login
|
|
184
|
+
# Uses http://localhost:8000
|
|
185
|
+
|
|
186
|
+
[yellow]Self-hosted instance:[/yellow]
|
|
187
|
+
$ export XENFRA_API_URL=https://xenfra.mycompany.com
|
|
188
|
+
$ export XENFRA_ENFORCE_WHITELIST=false
|
|
189
|
+
$ xenfra login
|
|
190
|
+
|
|
191
|
+
[yellow]Production (strict):[/yellow]
|
|
192
|
+
$ export XENFRA_ENV=production
|
|
193
|
+
$ xenfra login
|
|
194
|
+
# All security features enabled
|
|
195
|
+
|
|
196
|
+
[bold]Environment Variables:[/bold]
|
|
197
|
+
|
|
198
|
+
XENFRA_ENV
|
|
199
|
+
Values: production | staging | development
|
|
200
|
+
Default: development
|
|
201
|
+
|
|
202
|
+
XENFRA_API_URL
|
|
203
|
+
Default: http://localhost:8000 (dev), https://api.xenfra.tech (prod)
|
|
204
|
+
|
|
205
|
+
XENFRA_ENFORCE_HTTPS
|
|
206
|
+
Values: true | false
|
|
207
|
+
Default: false (dev), true (prod)
|
|
208
|
+
|
|
209
|
+
XENFRA_ENFORCE_WHITELIST
|
|
210
|
+
Values: true | false
|
|
211
|
+
Default: false (dev), true (prod)
|
|
212
|
+
|
|
213
|
+
XENFRA_ENABLE_CERT_PINNING
|
|
214
|
+
Values: true | false
|
|
215
|
+
Default: false (dev), true (prod)
|
|
216
|
+
|
|
217
|
+
XENFRA_WARN_ON_HTTP
|
|
218
|
+
Values: true | false
|
|
219
|
+
Default: true
|
|
220
|
+
|
|
221
|
+
[bold]Security Best Practices:[/bold]
|
|
222
|
+
|
|
223
|
+
1. Always use HTTPS in production
|
|
224
|
+
2. Never disable security features without understanding risks
|
|
225
|
+
3. Keep whitelisted domains list updated
|
|
226
|
+
4. Rotate credentials if you suspect compromise
|
|
227
|
+
5. Use environment-specific configurations
|
|
228
|
+
6. Enable all features for production deployments
|
|
229
|
+
|
|
230
|
+
[dim]For more information: https://docs.xenfra.tech/security[/dim]
|
|
231
|
+
"""
|
|
232
|
+
|
|
233
|
+
console.print(Panel(docs_text, border_style="cyan", padding=(1, 2)))
|
xenfra/main.py
CHANGED
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Xenfra CLI - Main entry point.
|
|
3
|
-
|
|
4
|
-
A modern, AI-powered CLI for deploying Python apps to DigitalOcean.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import os
|
|
8
|
-
|
|
9
|
-
import click
|
|
10
|
-
from rich.console import Console
|
|
11
|
-
|
|
12
|
-
from .commands.auth import auth
|
|
13
|
-
from .commands.deployments import deploy, logs, report, status
|
|
14
|
-
from .commands.intelligence import analyze, diagnose, init
|
|
15
|
-
from .commands.projects import projects
|
|
16
|
-
from .commands.security_cmd import security
|
|
17
|
-
|
|
18
|
-
console = Console()
|
|
19
|
-
|
|
20
|
-
# Production-ready: API URL is hardcoded as https://api.xenfra.tech
|
|
21
|
-
# No configuration needed - works out of the box after pip install
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@click.group()
|
|
25
|
-
@click.version_option(version="0.2.9")
|
|
26
|
-
def cli():
|
|
27
|
-
"""
|
|
28
|
-
Xenfra CLI: Deploy Python apps to DigitalOcean with zero configuration.
|
|
29
|
-
|
|
30
|
-
Quick Start:
|
|
31
|
-
xenfra auth login # Authenticate with Xenfra
|
|
32
|
-
xenfra init # Initialize your project (AI-powered)
|
|
33
|
-
xenfra deploy # Deploy to DigitalOcean
|
|
34
|
-
|
|
35
|
-
Commands:
|
|
36
|
-
auth Authentication (login, logout, whoami)
|
|
37
|
-
projects Manage projects (list, show, delete)
|
|
38
|
-
init Smart project initialization (AI-powered)
|
|
39
|
-
diagnose Diagnose deployment failures (AI-powered)
|
|
40
|
-
analyze Analyze codebase without creating config
|
|
41
|
-
|
|
42
|
-
For help on a specific command:
|
|
43
|
-
xenfra <command> --help
|
|
44
|
-
"""
|
|
45
|
-
# Configure keyring backend
|
|
46
|
-
os.environ["KEYRING_BACKEND"] = "keyrings.alt.file.PlaintextKeyring"
|
|
47
|
-
|
|
48
|
-
# Security works silently in the background
|
|
49
|
-
# Only shows warnings if there's an actual security issue
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
# Register command groups
|
|
53
|
-
cli.add_command(auth)
|
|
54
|
-
cli.add_command(projects)
|
|
55
|
-
cli.add_command(security)
|
|
56
|
-
|
|
57
|
-
# Register intelligence commands at root level
|
|
58
|
-
cli.add_command(init)
|
|
59
|
-
cli.add_command(diagnose)
|
|
60
|
-
cli.add_command(analyze)
|
|
61
|
-
|
|
62
|
-
# Register deployment commands at root level
|
|
63
|
-
cli.add_command(deploy)
|
|
64
|
-
cli.add_command(status)
|
|
65
|
-
cli.add_command(logs)
|
|
66
|
-
cli.add_command(report)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
"""
|
|
2
|
+
Xenfra CLI - Main entry point.
|
|
3
|
+
|
|
4
|
+
A modern, AI-powered CLI for deploying Python apps to DigitalOcean.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
|
|
12
|
+
from .commands.auth import auth
|
|
13
|
+
from .commands.deployments import delete, deploy, logs, report, status
|
|
14
|
+
from .commands.intelligence import analyze, diagnose, init
|
|
15
|
+
from .commands.projects import projects
|
|
16
|
+
from .commands.security_cmd import security
|
|
17
|
+
|
|
18
|
+
console = Console()
|
|
19
|
+
|
|
20
|
+
# Production-ready: API URL is hardcoded as https://api.xenfra.tech
|
|
21
|
+
# No configuration needed - works out of the box after pip install
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@click.group()
|
|
25
|
+
@click.version_option(version="0.2.9")
|
|
26
|
+
def cli():
|
|
27
|
+
"""
|
|
28
|
+
Xenfra CLI: Deploy Python apps to DigitalOcean with zero configuration.
|
|
29
|
+
|
|
30
|
+
Quick Start:
|
|
31
|
+
xenfra auth login # Authenticate with Xenfra
|
|
32
|
+
xenfra init # Initialize your project (AI-powered)
|
|
33
|
+
xenfra deploy # Deploy to DigitalOcean
|
|
34
|
+
|
|
35
|
+
Commands:
|
|
36
|
+
auth Authentication (login, logout, whoami)
|
|
37
|
+
projects Manage projects (list, show, delete)
|
|
38
|
+
init Smart project initialization (AI-powered)
|
|
39
|
+
diagnose Diagnose deployment failures (AI-powered)
|
|
40
|
+
analyze Analyze codebase without creating config
|
|
41
|
+
|
|
42
|
+
For help on a specific command:
|
|
43
|
+
xenfra <command> --help
|
|
44
|
+
"""
|
|
45
|
+
# Configure keyring backend
|
|
46
|
+
os.environ["KEYRING_BACKEND"] = "keyrings.alt.file.PlaintextKeyring"
|
|
47
|
+
|
|
48
|
+
# Security works silently in the background
|
|
49
|
+
# Only shows warnings if there's an actual security issue
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# Register command groups
|
|
53
|
+
cli.add_command(auth)
|
|
54
|
+
cli.add_command(projects)
|
|
55
|
+
cli.add_command(security)
|
|
56
|
+
|
|
57
|
+
# Register intelligence commands at root level
|
|
58
|
+
cli.add_command(init)
|
|
59
|
+
cli.add_command(diagnose)
|
|
60
|
+
cli.add_command(analyze)
|
|
61
|
+
|
|
62
|
+
# Register deployment commands at root level
|
|
63
|
+
cli.add_command(deploy)
|
|
64
|
+
cli.add_command(status)
|
|
65
|
+
cli.add_command(logs)
|
|
66
|
+
cli.add_command(report)
|
|
67
|
+
cli.add_command(delete)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def main():
|
|
71
|
+
"""Main entry point."""
|
|
72
|
+
cli()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
main()
|
xenfra/utils/__init__.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Utility functions for Xenfra CLI.
|
|
3
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Utility functions for Xenfra CLI.
|
|
3
|
+
"""
|