Skip to content

Commit d1c5655

Browse files
authored
Fixed Secrets sharing (#154)
* fixed secrets sharing * fixed ruff
1 parent 712da17 commit d1c5655

7 files changed

Lines changed: 449 additions & 19 deletions

File tree

exosphere-runtimes/cloud-storage-runtime/nodes/list_s3_files.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import boto3
2-
import os
3-
42
from exospherehost import BaseNode
53
from typing import List
64
from pydantic import BaseModel
@@ -18,18 +16,17 @@ class Outputs(BaseModel):
1816
key: str
1917

2018
class Secrets(BaseModel):
21-
aws_access_key_id: str = os.getenv("S3_ACCESS_KEY_ID")
22-
aws_secret_access_key: str = os.getenv("S3_SECRET_ACCESS_KEY")
23-
aws_region: str = os.getenv("S3_REGION")
19+
aws_access_key_id: str
20+
aws_secret_access_key: str
21+
aws_region: str
2422

2523
async def execute(self) -> List[Outputs]:
26-
print(self.inputs)
2724

2825
s3_client = boto3.client(
2926
's3',
30-
aws_access_key_id=os.getenv("S3_ACCESS_KEY_ID"),
31-
aws_secret_access_key=os.getenv("S3_SECRET_ACCESS_KEY"),
32-
region_name=os.getenv("S3_REGION")
27+
aws_access_key_id=self.secrets.aws_access_key_id,
28+
aws_secret_access_key=self.secrets.aws_secret_access_key,
29+
region_name=self.secrets.aws_region
3330
)
3431
response = s3_client.list_objects_v2(Bucket=self.inputs.bucket_name, Prefix=self.inputs.prefix)
3532

exosphere-runtimes/cloud-storage-runtime/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [
88
"boto3>=1.40.1",
9+
"exospherehost==0.0.7b3",
910
"python-dotenv>=1.1.1",
1011
]

exosphere-runtimes/cloud-storage-runtime/uv.lock

Lines changed: 438 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "0.0.7b3"
1+
version = "0.0.7b4"

python-sdk/exospherehost/runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ async def _worker(self):
306306
try:
307307
node = self._node_mapping[state["node_name"]]
308308
secrets = await self._get_secrets(state["state_id"])
309-
outputs = await node()._execute(node.Inputs(**state["inputs"]), node.Secrets(**secrets))
309+
outputs = await node()._execute(node.Inputs(**state["inputs"]), node.Secrets(**secrets["secrets"]))
310310

311311
if outputs is None:
312312
outputs = []

state-manager/app/models/db/graph_template_model.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import re
21
import base64
32

43
from .base import BaseDatabaseModel
@@ -47,12 +46,7 @@ def _validate_secret_value(cls, secret_value: str) -> None:
4746
# 12 bytes nonce + minimum ciphertext + base64 encoding
4847
if len(secret_value) < 32: # Minimum length for encrypted string
4948
raise ValueError("Value appears to be too short for an encrypted string")
50-
51-
# Check if the string contains only URL-safe base64 characters
52-
url_safe_base64_pattern = r'^[A-Za-z0-9_-]+$'
53-
if not re.match(url_safe_base64_pattern, secret_value):
54-
raise ValueError("Value must be URL-safe base64 encoded")
55-
49+
5650
# Try to decode as base64 to ensure it's valid
5751
try:
5852
decoded = base64.urlsafe_b64decode(secret_value)

state-manager/app/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async def errored_state_route(namespace_name: str, state_id: str, body: ErroredR
115115

116116

117117
@router.put(
118-
"/graph-templates/{graph_name}",
118+
"/graph/{graph_name}",
119119
response_model=UpsertGraphTemplateResponse,
120120
status_code=status.HTTP_201_CREATED,
121121
response_description="Graph template upserted successfully",

0 commit comments

Comments
 (0)