@tdk-landscape/tdk-cli-core 1.3.15 → 1.3.22
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.
- package/Tiltfile +144 -0
- package/discovery/AGENTS.md +362 -0
- package/discovery/TILT_DISCOVERY.star +424 -0
- package/discovery/Tiltfile +58 -0
- package/discovery/config.star +258 -0
- package/discovery/constants.star +127 -0
- package/discovery/deterministic.star +211 -0
- package/discovery/discovery_daemon.star +191 -0
- package/discovery/discovery_orchestrator.star +460 -0
- package/discovery/filtering.star +5 -0
- package/discovery/identity-management-backend/service.yaml +26 -0
- package/discovery/identity-management-frontend/service.yaml +29 -0
- package/discovery/identity-sdk/service.yaml +9 -0
- package/discovery/incremental_discovery.star +213 -0
- package/discovery/indexing.star +7 -0
- package/discovery/json_manifest_scanner.star +51 -0
- package/discovery/libraries.star +46 -0
- package/discovery/loading.star +23 -0
- package/discovery/manifest/constants.star +104 -0
- package/discovery/manifest/loading.star +386 -0
- package/discovery/manifest/normalize.star +281 -0
- package/discovery/manifest/validation.star +108 -0
- package/discovery/normalization.star +11 -0
- package/discovery/registry.star +544 -0
- package/discovery/resource_snapshot.py +382 -0
- package/discovery/resource_snapshot.star +143 -0
- package/discovery/schemas.star +1 -0
- package/discovery/services/platform/cdc/debezium/nats-connector/service.yaml +9 -0
- package/discovery/services/platform/cdc/nats-http-bridge/service.yaml +9 -0
- package/discovery/services/platform/orchestrator/orchestrator-glue-backend/service.yaml +26 -0
- package/discovery/services/platform/synthetic-monitor/service.yaml +9 -0
- package/discovery/test_resource_snapshot.py +251 -0
- package/discovery/validation.star +78 -0
- package/discovery/versioning.star +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +11 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +1 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/project.d.ts.map +1 -1
- package/dist/commands/project.js +36 -41
- package/dist/commands/project.js.map +1 -1
- package/dist/commands/resource.d.ts.map +1 -1
- package/dist/commands/resource.js +51 -55
- package/dist/commands/resource.js.map +1 -1
- package/dist/commands/stack.d.ts.map +1 -1
- package/dist/commands/stack.js +22 -24
- package/dist/commands/stack.js.map +1 -1
- package/dist/commands/ui.d.ts.map +1 -1
- package/dist/commands/ui.js +1 -2
- package/dist/commands/ui.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +1 -2
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/upgrade.d.ts +8 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +59 -18
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/generator/extension-fetch.d.ts +19 -0
- package/dist/generator/extension-fetch.d.ts.map +1 -1
- package/dist/generator/extension-fetch.js +71 -5
- package/dist/generator/extension-fetch.js.map +1 -1
- package/dist/generator/template-engine.d.ts +1 -0
- package/dist/generator/template-engine.d.ts.map +1 -1
- package/dist/generator/template-engine.js +50 -6
- package/dist/generator/template-engine.js.map +1 -1
- package/dist/utils/command-helpers.d.ts.map +1 -1
- package/dist/utils/command-helpers.js +7 -9
- package/dist/utils/command-helpers.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +1 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/project-features.d.ts.map +1 -1
- package/dist/utils/project-features.js +1 -1
- package/dist/utils/project-features.js.map +1 -1
- package/dist/utils/resource-features.d.ts.map +1 -1
- package/dist/utils/resource-features.js +2 -2
- package/dist/utils/resource-features.js.map +1 -1
- package/dist/utils/tar.js +4 -4
- package/dist/utils/tar.js.map +1 -1
- package/dist/utils/validation.d.ts +7 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +9 -0
- package/dist/utils/validation.js.map +1 -1
- package/engine/AGENTS.md +705 -0
- package/engine/README.md +29 -0
- package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
- package/engine/Tiltfile +80 -0
- package/engine/assets/docker/golden-layers.Dockerfile +221 -0
- package/engine/assets/scripts/cleanup-completed-migrator-images.sh +37 -0
- package/engine/assets/scripts/cleanup-tilt-images.sh +120 -0
- package/engine/assets/scripts/mac-m1-resource-monitor.sh +121 -0
- package/engine/config.star +3 -0
- package/engine/docs/AUTODISCOVERY_TEST.md +182 -0
- package/engine/docs/C4-ARCHITECTURE-operations.md +396 -0
- package/engine/docs/C4-ARCHITECTURE-overview.md +284 -0
- package/engine/docs/C4-ARCHITECTURE.md +17 -0
- package/engine/docs/GOLDEN_IMAGE_INTEGRATION.md +349 -0
- package/engine/docs/MANIFEST_DRIVEN_ARCHITECTURE.md +357 -0
- package/engine/docs/README.md +284 -0
- package/engine/entrypoint.star +97 -0
- package/engine/lifecycle/orchestrator.star +260 -0
- package/engine/paths.star +717 -0
- package/engine/schemas/manifest-schema.json +301 -0
- package/engine/schemas/service-schema.json +301 -0
- package/engine/scripts/README.md +89 -0
- package/engine/scripts/build-and-publish-lib.sh +205 -0
- package/engine/scripts/check-lib-publish.sh +85 -0
- package/engine/scripts/debug-container.sh +258 -0
- package/engine/scripts/generate-manifest.sh +197 -0
- package/engine/spec.master +702 -0
- package/engine/spec.master.example +341 -0
- package/engine/topologies/README.md +34 -0
- package/engine/topologies/platform/docker/AGENTS.md +59 -0
- package/engine/topologies/platform/docker/auth/auth.star +167 -0
- package/engine/topologies/platform/docker/build/golden_image.star +37 -0
- package/engine/topologies/platform/docker/build/golden_image_build.star +82 -0
- package/engine/topologies/platform/docker/build/golden_image_constants.star +93 -0
- package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +291 -0
- package/engine/topologies/platform/docker/compose/compose.star +636 -0
- package/engine/topologies/platform/docker/compose/compose_helpers.star +52 -0
- package/engine/topologies/platform/docker/compose/traefik_standalone.star +53 -0
- package/engine/topologies/platform/docker/config/bunignore.star +142 -0
- package/engine/topologies/platform/docker/config/dockerignore.star +150 -0
- package/engine/topologies/platform/docker/constants.star +170 -0
- package/engine/topologies/platform/docker/dockerfile/dockerfile.star +54 -0
- package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +73 -0
- package/engine/topologies/platform/docker/index.star +27 -0
- package/engine/topologies/platform/docker/layers/bun_helpers.star +23 -0
- package/engine/topologies/platform/docker/layers/infisical/index.star +40 -0
- package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +262 -0
- package/engine/topologies/platform/docker/layers/l1_base_layers.star +87 -0
- package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +125 -0
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +209 -0
- package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +214 -0
- package/engine/topologies/platform/docker/layers/prisma/constants.star +135 -0
- package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +96 -0
- package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +109 -0
- package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +98 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +126 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +161 -0
- package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +119 -0
- package/engine/topologies/platform/docker/networking/api_path_constants.star +230 -0
- package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +27 -0
- package/engine/topologies/platform/docker/networking/traefik.star +232 -0
- package/engine/topologies/platform/docker/networking/traefik_constants.star +146 -0
- package/engine/topologies/platform/docker/networking/traefik_helpers.star +160 -0
- package/engine/topologies/platform/docker/secrets/infisical.star +135 -0
- package/engine/topologies/platform/net/proxy.star +4 -0
- package/engine/topologies/platform/registries/local.star +4 -0
- package/engine/topologies/platform/security/secrets.star +239 -0
- package/engine/topologies/platform/state/relational.star +4 -0
- package/engine/topologies/tilt/common/AGENTS.md +59 -0
- package/engine/topologies/tilt/common/utils.star +364 -0
- package/engine/topologies/tilt/common/utils_debug.star +69 -0
- package/engine/topologies/tilt/common/utils_deterministic.star +168 -0
- package/engine/topologies/tilt/common/utils_docker_networks.star +46 -0
- package/engine/topologies/tilt/common/utils_env.star +43 -0
- package/engine/topologies/tilt/common/utils_output.star +97 -0
- package/engine/topologies/tilt/config/AGENTS.md +68 -0
- package/engine/topologies/tilt/config/defaults.star +3 -0
- package/engine/topologies/tilt/config/feature_flags.star +10 -0
- package/engine/topologies/tilt/config/global.star +55 -0
- package/engine/topologies/tilt/config/profiles.star +382 -0
- package/engine/topologies/tilt/generators/agents_md.star +62 -0
- package/engine/topologies/tilt/generators/api_gateway.star +145 -0
- package/engine/topologies/tilt/generators/index.star +124 -0
- package/engine/topologies/tilt/generators/infisical/README.md +424 -0
- package/engine/topologies/tilt/generators/infisical/examples.star +312 -0
- package/engine/topologies/tilt/generators/infisical/index.star +57 -0
- package/engine/topologies/tilt/generators/infisical/machine_identity.star +420 -0
- package/engine/topologies/tilt/generators/infisical/organization.star +534 -0
- package/engine/topologies/tilt/generators/infisical/path_manager.star +476 -0
- package/engine/topologies/tilt/generators/infisical/secrets_generator.star +420 -0
- package/engine/topologies/tilt/generators/nginx_conf.star +143 -0
- package/engine/topologies/tilt/generators/npmrc.star +111 -0
- package/engine/topologies/tilt/generators/tsconfig.star +23 -0
- package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +71 -0
- package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +124 -0
- package/engine/topologies/tilt/generators/typescript/common.star +7 -0
- package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +76 -0
- package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +110 -0
- package/engine/topologies/tilt/generators/typescript/include.star +23 -0
- package/engine/topologies/tilt/generators/typescript/playwright_config.star +40 -0
- package/engine/topologies/tilt/generators/typescript/prisma_config.star +49 -0
- package/engine/topologies/tilt/generators/validators.star +853 -0
- package/engine/topologies/tilt/generators/vite/backend.star +78 -0
- package/engine/topologies/tilt/generators/vite/frontend.star +98 -0
- package/engine/topologies/tilt/generators/vite/generators.star +43 -0
- package/engine/topologies/tilt/generators/vite/helpers.star +244 -0
- package/engine/topologies/tilt/generators/vite/library.star +65 -0
- package/engine/topologies/tilt/generators/vite/sdk.star +73 -0
- package/engine/topologies/tilt/generators/vite/templates.star +737 -0
- package/engine/topologies/tilt/generators/vite_config.star +22 -0
- package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
- package/engine/topologies/tilt/manifest/README.md +693 -0
- package/engine/topologies/tilt/manifest/__init__.star +218 -0
- package/engine/topologies/tilt/manifest/constants.star +252 -0
- package/engine/topologies/tilt/manifest/errors.star +266 -0
- package/engine/topologies/tilt/manifest/integration.star +339 -0
- package/engine/topologies/tilt/manifest/json_to_yaml.py +54 -0
- package/engine/topologies/tilt/manifest/loader.star +214 -0
- package/engine/topologies/tilt/manifest/mapper.star +227 -0
- package/engine/topologies/tilt/manifest/parser.star +400 -0
- package/engine/topologies/tilt/manifest/schema.star +462 -0
- package/engine/topologies/tilt/manifest/tests/test_integration.star +276 -0
- package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +397 -0
- package/engine/topologies/tilt/manifest/tests/test_manifest.star +316 -0
- package/engine/topologies/tilt/manifest/tests/test_validator.star +470 -0
- package/engine/topologies/tilt/manifest/validator.star +717 -0
- package/engine/topologies/tilt/manifest/yaml_to_json.py +18 -0
- package/engine/topologies/tilt/resources/AGENTS.md +71 -0
- package/engine/topologies/tilt/resources/conditions.star +3 -0
- package/engine/topologies/tilt/resources/databases.star +244 -0
- package/engine/topologies/tilt/resources/declaration.star +3 -0
- package/engine/topologies/tilt/resources/deps.star +3 -0
- package/engine/topologies/tilt/resources/infra-loader.star +437 -0
- package/engine/topologies/tilt/resources/libs.star +30 -0
- package/engine/topologies/tilt/resources/libs_discovery.star +102 -0
- package/engine/topologies/tilt/resources/libs_paths.star +79 -0
- package/engine/topologies/tilt/resources/libs_resource_definition.star +151 -0
- package/engine/topologies/tilt/resources/libs_setup.star +164 -0
- package/engine/topologies/tilt/resources/libs_tsconfig.star +37 -0
- package/engine/topologies/tilt/resources/orchestrator/apply.star +77 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +431 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +81 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +148 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +36 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +44 -0
- package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +164 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +21 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +134 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/env.star +258 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +169 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +524 -0
- package/engine/topologies/tilt/resources/orchestrator/helpers.star +33 -0
- package/engine/topologies/tilt/resources/orchestrator.star +54 -0
- package/engine/topologies/tilt/resources/ordering.star +3 -0
- package/engine/topologies/tilt/resources/triggers.star +3 -0
- package/engine/topologies/tilt/resources/watchers.star +299 -0
- package/engine/where-things-live.star +717 -0
- package/ext/Tiltfile +66 -0
- package/ext/ide-components/README.md +219 -0
- package/ext/ide-components/code_executor/server.py +268 -0
- package/ext/ide-components/code_viewer/server.py +206 -0
- package/ext/ide-components/config_inspector/server.py +1050 -0
- package/ext/ide-components/file_browser/server.py +285 -0
- package/ext/ide-components/shared/config_service.py +469 -0
- package/ext/ide-components/shared/file_utils.py +298 -0
- package/ext/ide-components/shared/http_utils.py +232 -0
- package/ext/ide-components/shared/static/styles.css +1334 -0
- package/ext/ide-components/shared/syntax_highlighter.py +140 -0
- package/ext/ide-components/shared/template_engine.py +123 -0
- package/ext/ide-components/shared/templates/base.html +121 -0
- package/ext/ide-components/shared/test_config_service.py +326 -0
- package/ext/ide-components/shared/tilt_integration.py +158 -0
- package/ext/ui-enhancements/cron-status-server.sh +49 -0
- package/ext/ui-enhancements/cron-status-tracker.sh +146 -0
- package/ext/ui-enhancements/extension.yaml +36 -0
- package/ext/ui-enhancements/tiltfile.py +99 -0
- package/ext/ui-enhancements/ui/cron-jobs-tab.css +396 -0
- package/ext/ui-enhancements/ui/help-panel.css +279 -0
- package/ext/ui-enhancements/ui/icons.css +125 -0
- package/ext/ui-enhancements/ui/tooltips.css +114 -0
- package/package.json +13 -9
- package/specs/specs/TILT_SERVICE_DEFAULTS.star +205 -0
- package/specs/specs/TILT_TECH_STACK.star +159 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 🤖 INFISICAL MACHINE IDENTITY MANAGER
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Manages Infisical Machine Identity configuration and authentication
|
|
5
|
+
# Replaces: Shell scripts for machine identity setup
|
|
6
|
+
# =============================================================================
|
|
7
|
+
#
|
|
8
|
+
# This module provides:
|
|
9
|
+
# - Machine Identity configuration generation
|
|
10
|
+
# - Authentication method definitions (Universal Auth, OIDC, etc.)
|
|
11
|
+
# - Client ID/Secret management patterns
|
|
12
|
+
# - Token lifecycle management
|
|
13
|
+
#
|
|
14
|
+
# Usage:
|
|
15
|
+
# load("./infisical/machine_identity.star", "MachineIdentity")
|
|
16
|
+
# config = MachineIdentity.generate_universal_auth("my-machine", "/services/user")
|
|
17
|
+
# =============================================================================
|
|
18
|
+
|
|
19
|
+
def _get_timestamp():
|
|
20
|
+
"""Get current timestamp string"""
|
|
21
|
+
return str(local("date +%Y-%m-%dT%H:%M:%S", quiet=True)).strip()
|
|
22
|
+
|
|
23
|
+
# =============================================================================
|
|
24
|
+
# Machine Identity Types
|
|
25
|
+
# =============================================================================
|
|
26
|
+
|
|
27
|
+
AUTH_METHODS = {
|
|
28
|
+
"universal-auth": {
|
|
29
|
+
"name": "Universal Auth",
|
|
30
|
+
"description": "Client ID and Client Secret authentication",
|
|
31
|
+
"env_vars": ["INFISICAL_CLIENT_ID", "INFISICAL_CLIENT_SECRET"],
|
|
32
|
+
"supported": True,
|
|
33
|
+
"recommended": True,
|
|
34
|
+
},
|
|
35
|
+
"oidc-auth": {
|
|
36
|
+
"name": "OIDC Auth",
|
|
37
|
+
"description": "OpenID Connect authentication for cloud providers",
|
|
38
|
+
"env_vars": ["INFISICAL_OIDC_TOKEN"],
|
|
39
|
+
"supported": True,
|
|
40
|
+
"recommended": False,
|
|
41
|
+
},
|
|
42
|
+
"token-auth": {
|
|
43
|
+
"name": "Token Auth",
|
|
44
|
+
"description": "Service Token authentication (legacy)",
|
|
45
|
+
"env_vars": ["INFISICAL_TOKEN"],
|
|
46
|
+
"supported": True,
|
|
47
|
+
"recommended": False,
|
|
48
|
+
"deprecated": True,
|
|
49
|
+
},
|
|
50
|
+
"kubernetes-auth": {
|
|
51
|
+
"name": "Kubernetes Auth",
|
|
52
|
+
"description": "Kubernetes service account authentication",
|
|
53
|
+
"env_vars": ["INFISICAL_KUBERNETES_TOKEN"],
|
|
54
|
+
"supported": False,
|
|
55
|
+
"recommended": False,
|
|
56
|
+
},
|
|
57
|
+
"aws-auth": {
|
|
58
|
+
"name": "AWS IAM Auth",
|
|
59
|
+
"description": "AWS IAM role authentication",
|
|
60
|
+
"env_vars": ["AWS_ROLE_ARN", "AWS_WEB_IDENTITY_TOKEN_FILE"],
|
|
61
|
+
"supported": False,
|
|
62
|
+
"recommended": False,
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# =============================================================================
|
|
67
|
+
# Default Configuration
|
|
68
|
+
# =============================================================================
|
|
69
|
+
|
|
70
|
+
DEFAULT_MACHINE_CONFIG = {
|
|
71
|
+
"auth_method": "universal-auth",
|
|
72
|
+
"token_ttl_seconds": 3600, # 1 hour
|
|
73
|
+
"max_uses": 0, # Unlimited
|
|
74
|
+
"access_level": "service", # service, project, organization
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# =============================================================================
|
|
78
|
+
# Universal Auth Configuration
|
|
79
|
+
# =============================================================================
|
|
80
|
+
|
|
81
|
+
def _generate_universal_auth_config(identity_name, access_paths=None, project_id=None, environment="dev"):
|
|
82
|
+
"""
|
|
83
|
+
Generate Universal Auth (Client ID + Client Secret) configuration.
|
|
84
|
+
|
|
85
|
+
This is the recommended authentication method for services.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
identity_name: Name of the machine identity (e.g., "machine1")
|
|
89
|
+
access_paths: List of Infisical paths this identity can access
|
|
90
|
+
project_id: Project ID for access
|
|
91
|
+
environment: Environment (dev, staging, prod)
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Dict with Universal Auth configuration
|
|
95
|
+
"""
|
|
96
|
+
if not access_paths:
|
|
97
|
+
access_paths = ["/services/*"]
|
|
98
|
+
|
|
99
|
+
# Normalize paths
|
|
100
|
+
normalized_paths = []
|
|
101
|
+
for path in access_paths:
|
|
102
|
+
if not path.startswith("/"):
|
|
103
|
+
path = "/" + path
|
|
104
|
+
normalized_paths.append(path)
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
"identity_name": identity_name,
|
|
108
|
+
"auth_method": "universal-auth",
|
|
109
|
+
"method_info": AUTH_METHODS["universal-auth"],
|
|
110
|
+
"environment_variables": {
|
|
111
|
+
"INFISICAL_CLIENT_ID": "${INFISICAL_CLIENT_ID}",
|
|
112
|
+
"INFISICAL_CLIENT_SECRET": "${INFISICAL_CLIENT_SECRET}",
|
|
113
|
+
},
|
|
114
|
+
"config": {
|
|
115
|
+
"project_id": project_id or "${INFISICAL_PROJECT_ID}",
|
|
116
|
+
"environment": environment,
|
|
117
|
+
"access_paths": normalized_paths,
|
|
118
|
+
"token_ttl_seconds": DEFAULT_MACHINE_CONFIG["token_ttl_seconds"],
|
|
119
|
+
"max_uses": DEFAULT_MACHINE_CONFIG["max_uses"],
|
|
120
|
+
},
|
|
121
|
+
"cli_command": "infisical login --method universal-auth --client-id <id> --client-secret <secret>",
|
|
122
|
+
"docker_compose": {
|
|
123
|
+
"INFISICAL_CLIENT_ID": "${INFISICAL_CLIENT_ID}",
|
|
124
|
+
"INFISICAL_CLIENT_SECRET": "${INFISICAL_CLIENT_SECRET}",
|
|
125
|
+
"INFISICAL_PROJECT_ID": project_id or "${INFISICAL_PROJECT_ID}",
|
|
126
|
+
"INFISICAL_ENVIRONMENT": environment,
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
def _generate_oidc_auth_config(identity_name, oidc_issuer=None, allowed_audiences=None):
|
|
131
|
+
"""
|
|
132
|
+
Generate OIDC Auth configuration.
|
|
133
|
+
|
|
134
|
+
For cloud provider authentication (AWS, GCP, Azure).
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
identity_name: Name of the machine identity
|
|
138
|
+
oidc_issuer: OIDC issuer URL
|
|
139
|
+
allowed_audiences: List of allowed audience claims
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Dict with OIDC Auth configuration
|
|
143
|
+
"""
|
|
144
|
+
return {
|
|
145
|
+
"identity_name": identity_name,
|
|
146
|
+
"auth_method": "oidc-auth",
|
|
147
|
+
"method_info": AUTH_METHODS["oidc-auth"],
|
|
148
|
+
"environment_variables": {
|
|
149
|
+
"INFISICAL_OIDC_TOKEN": "${INFISICAL_OIDC_TOKEN}",
|
|
150
|
+
},
|
|
151
|
+
"config": {
|
|
152
|
+
"oidc_issuer": oidc_issuer or "${OIDC_ISSUER}",
|
|
153
|
+
"allowed_audiences": allowed_audiences or [],
|
|
154
|
+
},
|
|
155
|
+
"cli_command": "infisical login --method oidc-auth --oidc-token <token>",
|
|
156
|
+
"docker_compose": {
|
|
157
|
+
"INFISICAL_OIDC_TOKEN": "${INFISICAL_OIDC_TOKEN}",
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
def _generate_token_auth_config(identity_name, token=None):
|
|
162
|
+
"""
|
|
163
|
+
Generate Token Auth configuration (legacy).
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
identity_name: Name of the machine identity
|
|
167
|
+
token: Service token (or env var reference)
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
Dict with Token Auth configuration
|
|
171
|
+
"""
|
|
172
|
+
return {
|
|
173
|
+
"identity_name": identity_name,
|
|
174
|
+
"auth_method": "token-auth",
|
|
175
|
+
"method_info": AUTH_METHODS["token-auth"],
|
|
176
|
+
"deprecated": True,
|
|
177
|
+
"environment_variables": {
|
|
178
|
+
"INFISICAL_TOKEN": token or "${INFISICAL_TOKEN}",
|
|
179
|
+
},
|
|
180
|
+
"config": {},
|
|
181
|
+
"cli_command": "infisical login --method token --token <token>",
|
|
182
|
+
"docker_compose": {
|
|
183
|
+
"INFISICAL_TOKEN": token or "${INFISICAL_TOKEN}",
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
# =============================================================================
|
|
188
|
+
# Machine Identity Templates
|
|
189
|
+
# =============================================================================
|
|
190
|
+
|
|
191
|
+
def _generate_development_machine(identity_name="dev-machine", project_id=None):
|
|
192
|
+
"""Generate a development machine identity with broad access."""
|
|
193
|
+
return _generate_universal_auth_config(
|
|
194
|
+
identity_name=identity_name,
|
|
195
|
+
access_paths=[
|
|
196
|
+
"/services/*",
|
|
197
|
+
"/platform/*",
|
|
198
|
+
"/shared/*",
|
|
199
|
+
],
|
|
200
|
+
project_id=project_id,
|
|
201
|
+
environment="dev",
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
def _generate_production_machine(identity_name="prod-machine", project_id=None, resource_paths=None):
|
|
205
|
+
"""Generate a production machine identity with restricted access."""
|
|
206
|
+
if not resource_paths:
|
|
207
|
+
resource_paths = ["/services/${RESOURCE_NAME}"]
|
|
208
|
+
|
|
209
|
+
return _generate_universal_auth_config(
|
|
210
|
+
identity_name=identity_name,
|
|
211
|
+
access_paths=resource_paths,
|
|
212
|
+
project_id=project_id,
|
|
213
|
+
environment="prod",
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
def _generate_ci_machine(identity_name="ci-machine", project_id=None):
|
|
217
|
+
"""Generate a CI/CD machine identity for GitHub Actions."""
|
|
218
|
+
return _generate_universal_auth_config(
|
|
219
|
+
identity_name=identity_name,
|
|
220
|
+
access_paths=[
|
|
221
|
+
"/services/*",
|
|
222
|
+
"/platform/*",
|
|
223
|
+
],
|
|
224
|
+
project_id=project_id,
|
|
225
|
+
environment="dev",
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
def _generate_resource_specific_machine(resource_name, project_id=None):
|
|
229
|
+
"""Generate a machine identity for a specific service only."""
|
|
230
|
+
path = "/services/{}".format(resource_name)
|
|
231
|
+
|
|
232
|
+
return _generate_universal_auth_config(
|
|
233
|
+
identity_name="{}-machine".format(resource_name),
|
|
234
|
+
access_paths=[path, "{}/*".format(path)],
|
|
235
|
+
project_id=project_id,
|
|
236
|
+
environment="dev",
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
# =============================================================================
|
|
240
|
+
# Machine Identity Registry
|
|
241
|
+
# =============================================================================
|
|
242
|
+
|
|
243
|
+
# Predefined machine identity configurations
|
|
244
|
+
PREDEFINED_MACHINES = {
|
|
245
|
+
"machine1": {
|
|
246
|
+
"name": "machine1",
|
|
247
|
+
"display_name": "Machine Identity 1",
|
|
248
|
+
"description": "Primary machine identity for local development",
|
|
249
|
+
"auth_method": "universal-auth",
|
|
250
|
+
"access_level": "project",
|
|
251
|
+
"environments": ["dev", "staging"],
|
|
252
|
+
"access_paths": ["/services/*", "/platform/*"],
|
|
253
|
+
},
|
|
254
|
+
"tilt-local": {
|
|
255
|
+
"name": "tilt-local",
|
|
256
|
+
"display_name": "Tilt Local Development",
|
|
257
|
+
"description": "Machine identity for Tilt local development",
|
|
258
|
+
"auth_method": "universal-auth",
|
|
259
|
+
"access_level": "project",
|
|
260
|
+
"environments": ["dev"],
|
|
261
|
+
"access_paths": ["/services/*"],
|
|
262
|
+
},
|
|
263
|
+
"github-actions": {
|
|
264
|
+
"name": "github-actions",
|
|
265
|
+
"display_name": "GitHub Actions CI/CD",
|
|
266
|
+
"description": "Machine identity for GitHub Actions workflows",
|
|
267
|
+
"auth_method": "universal-auth",
|
|
268
|
+
"access_level": "project",
|
|
269
|
+
"environments": ["dev", "staging", "prod"],
|
|
270
|
+
"access_paths": ["/services/*", "/platform/*"],
|
|
271
|
+
},
|
|
272
|
+
"production-deployer": {
|
|
273
|
+
"name": "production-deployer",
|
|
274
|
+
"display_name": "Production Deployment",
|
|
275
|
+
"description": "Machine identity for production deployments",
|
|
276
|
+
"auth_method": "universal-auth",
|
|
277
|
+
"access_level": "project",
|
|
278
|
+
"environments": ["prod"],
|
|
279
|
+
"access_paths": ["/services/*"],
|
|
280
|
+
},
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
def _get_predefined_machine(machine_name):
|
|
284
|
+
"""Get predefined machine configuration."""
|
|
285
|
+
return PREDEFINED_MACHINES.get(machine_name)
|
|
286
|
+
|
|
287
|
+
def _register_machine(machine_name, config):
|
|
288
|
+
"""Register a new machine identity configuration."""
|
|
289
|
+
PREDEFINED_MACHINES[machine_name] = config
|
|
290
|
+
return config
|
|
291
|
+
|
|
292
|
+
# =============================================================================
|
|
293
|
+
# Environment Variable Generation
|
|
294
|
+
# =============================================================================
|
|
295
|
+
|
|
296
|
+
def _generate_env_file_content(machine_config, include_secrets=False):
|
|
297
|
+
"""
|
|
298
|
+
Generate .env file content for a machine identity.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
machine_config: Machine identity configuration
|
|
302
|
+
include_secrets: If True, includes placeholder secret values
|
|
303
|
+
|
|
304
|
+
Returns:
|
|
305
|
+
String content for .env file
|
|
306
|
+
"""
|
|
307
|
+
lines = [
|
|
308
|
+
"# Infisical Machine Identity Configuration",
|
|
309
|
+
"# Identity: {}".format(machine_config.get("identity_name", "unknown")),
|
|
310
|
+
"# Generated: {}".format(_get_timestamp()),
|
|
311
|
+
"#",
|
|
312
|
+
"# ⚠️ SECURITY WARNING: Do not commit this file to Git!",
|
|
313
|
+
"",
|
|
314
|
+
"# Authentication Method",
|
|
315
|
+
"INFISICAL_AUTH_METHOD={}".format(machine_config.get("auth_method", "universal-auth")),
|
|
316
|
+
"",
|
|
317
|
+
]
|
|
318
|
+
|
|
319
|
+
# Add method-specific variables
|
|
320
|
+
env_vars = machine_config.get("environment_variables", {})
|
|
321
|
+
for key, value in env_vars.items():
|
|
322
|
+
if include_secrets:
|
|
323
|
+
lines.append("{}={}".format(key, value))
|
|
324
|
+
else:
|
|
325
|
+
lines.append("{}=__replace_with_actual_value__".format(key))
|
|
326
|
+
|
|
327
|
+
# Add config variables
|
|
328
|
+
config = machine_config.get("config", {})
|
|
329
|
+
if "project_id" in config:
|
|
330
|
+
lines.append("INFISICAL_PROJECT_ID={}".format(config["project_id"]))
|
|
331
|
+
if "environment" in config:
|
|
332
|
+
lines.append("INFISICAL_ENVIRONMENT={}".format(config["environment"]))
|
|
333
|
+
|
|
334
|
+
lines.extend([
|
|
335
|
+
"",
|
|
336
|
+
"# API Configuration",
|
|
337
|
+
"INFISICAL_API_URL=http://localhost:8089",
|
|
338
|
+
])
|
|
339
|
+
|
|
340
|
+
return "\n".join(lines)
|
|
341
|
+
|
|
342
|
+
# =============================================================================
|
|
343
|
+
# Validation
|
|
344
|
+
# =============================================================================
|
|
345
|
+
|
|
346
|
+
def _validate_auth_method(method):
|
|
347
|
+
"""Validate authentication method."""
|
|
348
|
+
if method in AUTH_METHODS:
|
|
349
|
+
info = AUTH_METHODS[method]
|
|
350
|
+
return {
|
|
351
|
+
"valid": True,
|
|
352
|
+
"supported": info["supported"],
|
|
353
|
+
"deprecated": info.get("deprecated", False),
|
|
354
|
+
"message": None,
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return {
|
|
358
|
+
"valid": False,
|
|
359
|
+
"supported": False,
|
|
360
|
+
"deprecated": False,
|
|
361
|
+
"message": "Unknown auth method: {}".format(method),
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
def _validate_machine_config(config):
|
|
365
|
+
"""Validate machine identity configuration."""
|
|
366
|
+
errors = []
|
|
367
|
+
warnings = []
|
|
368
|
+
|
|
369
|
+
# Check required fields
|
|
370
|
+
if not config.get("identity_name"):
|
|
371
|
+
errors.append("Missing identity_name")
|
|
372
|
+
|
|
373
|
+
auth_method = config.get("auth_method", "universal-auth")
|
|
374
|
+
method_validation = _validate_auth_method(auth_method)
|
|
375
|
+
|
|
376
|
+
if not method_validation["valid"]:
|
|
377
|
+
errors.append(method_validation["message"])
|
|
378
|
+
elif method_validation.get("deprecated"):
|
|
379
|
+
warnings.append("Auth method '{}' is deprecated".format(auth_method))
|
|
380
|
+
elif not method_validation["supported"]:
|
|
381
|
+
warnings.append("Auth method '{}' not yet supported".format(auth_method))
|
|
382
|
+
|
|
383
|
+
return {
|
|
384
|
+
"valid": len(errors) == 0,
|
|
385
|
+
"errors": errors,
|
|
386
|
+
"warnings": warnings,
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
# =============================================================================
|
|
390
|
+
# Main API
|
|
391
|
+
# =============================================================================
|
|
392
|
+
|
|
393
|
+
MachineIdentity = struct(
|
|
394
|
+
# Configuration generators
|
|
395
|
+
generate_universal_auth=_generate_universal_auth_config,
|
|
396
|
+
generate_oidc_auth=_generate_oidc_auth_config,
|
|
397
|
+
generate_token_auth=_generate_token_auth_config,
|
|
398
|
+
|
|
399
|
+
# Templates
|
|
400
|
+
generate_development_machine=_generate_development_machine,
|
|
401
|
+
generate_production_machine=_generate_production_machine,
|
|
402
|
+
generate_ci_machine=_generate_ci_machine,
|
|
403
|
+
generate_resource_specific_machine=_generate_resource_specific_machine,
|
|
404
|
+
|
|
405
|
+
# Registry
|
|
406
|
+
get_predefined_machine=_get_predefined_machine,
|
|
407
|
+
register_machine=_register_machine,
|
|
408
|
+
predefined_machines=PREDEFINED_MACHINES,
|
|
409
|
+
|
|
410
|
+
# Environment
|
|
411
|
+
generate_env_file_content=_generate_env_file_content,
|
|
412
|
+
|
|
413
|
+
# Validation
|
|
414
|
+
validate_auth_method=_validate_auth_method,
|
|
415
|
+
validate_machine_config=_validate_machine_config,
|
|
416
|
+
|
|
417
|
+
# Constants
|
|
418
|
+
AUTH_METHODS=AUTH_METHODS,
|
|
419
|
+
DEFAULT_MACHINE_CONFIG=DEFAULT_MACHINE_CONFIG,
|
|
420
|
+
)
|