From 0f8a14fc6a1204a9fe8a4f9cba2dc01947f3f774 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 21 Feb 2025 02:29:20 +0400 Subject: [PATCH 1/2] feat: view secret value permission compatability --- infisical_sdk/api_types.py | 1 + infisical_sdk/client.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/infisical_sdk/api_types.py b/infisical_sdk/api_types.py index de5bd4e..467673e 100644 --- a/infisical_sdk/api_types.py +++ b/infisical_sdk/api_types.py @@ -74,6 +74,7 @@ class BaseSecret(BaseModel): createdAt: str updatedAt: str secretMetadata: Optional[Dict[str, Any]] = None + secretValueHidden: Optional[bool] = False secretReminderNote: Optional[str] = None secretReminderRepeatDays: Optional[int] = None skipMultilineEncoding: Optional[bool] = False diff --git a/infisical_sdk/client.py b/infisical_sdk/client.py index e830a5f..1cdac38 100644 --- a/infisical_sdk/client.py +++ b/infisical_sdk/client.py @@ -209,6 +209,7 @@ def list_secrets( environment_slug: str, secret_path: str, expand_secret_references: bool = True, + view_secret_value: bool = True, recursive: bool = False, include_imports: bool = True, tag_filters: List[str] = []) -> ListSecretsResponse: @@ -217,6 +218,7 @@ def list_secrets( "workspaceId": project_id, "environment": environment_slug, "secretPath": secret_path, + "viewSecretValue": str(view_secret_value).lower(), "expandSecretReferences": str(expand_secret_references).lower(), "recursive": str(recursive).lower(), "include_imports": str(include_imports).lower(), @@ -241,10 +243,12 @@ def get_secret_by_name( secret_path: str, expand_secret_references: bool = True, include_imports: bool = True, + view_secret_value: bool = True, version: str = None) -> BaseSecret: params = { "workspaceId": project_id, + "viewSecretValue": str(view_secret_value).lower(), "environment": environment_slug, "secretPath": secret_path, "expandSecretReferences": str(expand_secret_references).lower(), From cb35c037feddbad01f2a0cac3ba1c827960c28a0 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 21 Feb 2025 02:44:26 +0400 Subject: [PATCH 2/2] Update README.md --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2b6f847..5be3f5b 100644 --- a/README.md +++ b/README.md @@ -82,10 +82,11 @@ secrets = client.secrets.list_secrets( project_id="", environment_slug="dev", secret_path="/", - expand_secret_references=True, - recursive=False, - include_imports=True, - tag_filters=[] + expand_secret_references=True, # Optional + view_secret_value=True, # Optional + recursive=False, # Optional + include_imports=True, # Optional + tag_filters=[] # Optional ) ``` @@ -94,6 +95,7 @@ secrets = client.secrets.list_secrets( - `environment_slug` (str): The environment in which to list secrets (e.g., "dev"). - `secret_path` (str): The path to the secrets. - `expand_secret_references` (bool): Whether to expand secret references. +- `view_secret_value` (bool): Whether or not to include the secret value in the response. If set to false, the `secretValue` will be masked with ``. Defaults to true. - `recursive` (bool): Whether to list secrets recursively. - `include_imports` (bool): Whether to include imported secrets. - `tag_filters` (List[str]): Tags to filter secrets. @@ -171,9 +173,10 @@ secret = client.secrets.get_secret_by_name( project_id="", environment_slug="dev", secret_path="/", - expand_secret_references=True, - include_imports=True, - version=None # Optional + expand_secret_references=True, # Optional + view_secret_value=True, # Optional + include_imports=True, # Optional + version=None # Optional ) ``` @@ -183,6 +186,7 @@ secret = client.secrets.get_secret_by_name( - `environment_slug` (str): The environment in which to retrieve the secret. - `secret_path` (str): The path to the secret. - `expand_secret_references` (bool): Whether to expand secret references. +- `view_secret_value` (bool): Whether or not to include the secret value in the response. If set to false, the `secretValue` will be masked with ``. Defaults to true. - `include_imports` (bool): Whether to include imported secrets. - `version` (str, optional): The version of the secret to retrieve. Fetches the latest by default.