From ce6c329cef6c31a8a4db7ffa1203456b3df1faf6 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow <156889717+saileshwar-skyflow@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:03:18 +0530 Subject: [PATCH 1/5] SK-1407: Added pr review template (#142) --- .github/workflows/pull_request_template.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/pull_request_template.md diff --git a/.github/workflows/pull_request_template.md b/.github/workflows/pull_request_template.md new file mode 100644 index 00000000..c1922bec --- /dev/null +++ b/.github/workflows/pull_request_template.md @@ -0,0 +1,22 @@ +Start with a concise summary of the PR. The first three sections are required. The questions present in each section is there to help you guide you what to add. They are meant to be overwritten by your comments. +## Why +- Why are you making the change? +- What is the underlying issue that you are trying to case, in case of fix? +- Why is it needed by the feature you are working on? +- What is the intent behind making the change? + +## Goal +- What is the intended outcome? +- What part of the feature should start working? +- What are the non-goals or will be covered in future PR? + +## Testing +- How was the code tested? +- If you haven't written unit tests, why? +- What more testing is needed? Do you intend to manually test it after deployment? +- Do you have any concerns if this changed is released to prod? + +## Tech debt +- Is the PR adding to tech debt in any way? +- Are you addressing some Tech debt in this PR? +- If both the above are false, feel free to remove this section. \ No newline at end of file From a19d35373c007c079a9bdb9a0085c1d084f77ca6 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Wed, 8 Jan 2025 12:58:56 +0530 Subject: [PATCH 2/5] SK-1731: Fix api key inconsistency --- skyflow/utils/validations/_validations.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/skyflow/utils/validations/_validations.py b/skyflow/utils/validations/_validations.py index ee569f2a..c3026e75 100644 --- a/skyflow/utils/validations/_validations.py +++ b/skyflow/utils/validations/_validations.py @@ -1,5 +1,4 @@ import json -import re from skyflow.service_account import is_expired from skyflow.utils.enums import LogLevel, Env, RedactionType, TokenMode from skyflow.error import SkyflowError @@ -45,12 +44,15 @@ def validate_required_field(logger, config, field_name, expected_type, empty_err raise SkyflowError(empty_error, invalid_input_error_code) def validate_api_key(api_key: str, logger = None) -> bool: + if not api_key.startswith('sky-'): + log_error_log(SkyflowMessages.ErrorLogs.INVALID_API_KEY.value, logger=logger) + return False + if len(api_key) != 42: log_error_log(SkyflowMessages.ErrorLogs.INVALID_API_KEY.value, logger = logger) return False - api_key_pattern = re.compile(r'^sky-[a-zA-Z0-9]{5}-[a-fA-F0-9]{32}$') - return bool(api_key_pattern.match(api_key)) + return True def validate_credentials(logger, credentials, config_id_type=None, config_id=None): key_present = [k for k in ["path", "token", "credentials_string", "api_key"] if credentials.get(k)] From f07bc1f104cc7d699f45df264c9eeb3ff886e8c7 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Wed, 8 Jan 2025 14:21:56 +0530 Subject: [PATCH 3/5] SK-1731: Fix env creds inconsistency --- skyflow/utils/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skyflow/utils/_utils.py b/skyflow/utils/_utils.py index cc400b29..d682eac0 100644 --- a/skyflow/utils/_utils.py +++ b/skyflow/utils/_utils.py @@ -2,6 +2,7 @@ import json import urllib.parse from dotenv import load_dotenv +import dotenv from requests.sessions import PreparedRequest from requests.models import HTTPError import requests @@ -13,7 +14,6 @@ from skyflow.generated.rest import V1UpdateRecordResponse, V1BulkDeleteRecordResponse, \ V1DetokenizeResponse, V1TokenizeResponse, V1GetQueryResponse, V1BulkGetRecordResponse from skyflow.utils.logger import log_error, log_error_log - from . import SkyflowMessages, SDK_VERSION from .enums import Env, ContentType, EnvUrls from skyflow.vault.data import InsertResponse, UpdateResponse, DeleteResponse, QueryResponse, GetResponse @@ -24,7 +24,7 @@ invalid_input_error_code = SkyflowMessages.ErrorCodes.INVALID_INPUT.value def get_credentials(config_level_creds = None, common_skyflow_creds = None, logger = None): - dotenv_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), ".env") + dotenv_path = dotenv.find_dotenv(usecwd=True) if dotenv_path: load_dotenv(dotenv_path) env_skyflow_credentials = os.getenv("SKYFLOW_CREDENTIALS") From f2159b3518702f0b8b5e6436dd94dad02eb52f1d Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Wed, 8 Jan 2025 14:27:05 +0530 Subject: [PATCH 4/5] SK-1731: Removed pull request template --- .github/workflows/pull_request_template.md | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .github/workflows/pull_request_template.md diff --git a/.github/workflows/pull_request_template.md b/.github/workflows/pull_request_template.md deleted file mode 100644 index c1922bec..00000000 --- a/.github/workflows/pull_request_template.md +++ /dev/null @@ -1,22 +0,0 @@ -Start with a concise summary of the PR. The first three sections are required. The questions present in each section is there to help you guide you what to add. They are meant to be overwritten by your comments. -## Why -- Why are you making the change? -- What is the underlying issue that you are trying to case, in case of fix? -- Why is it needed by the feature you are working on? -- What is the intent behind making the change? - -## Goal -- What is the intended outcome? -- What part of the feature should start working? -- What are the non-goals or will be covered in future PR? - -## Testing -- How was the code tested? -- If you haven't written unit tests, why? -- What more testing is needed? Do you intend to manually test it after deployment? -- Do you have any concerns if this changed is released to prod? - -## Tech debt -- Is the PR adding to tech debt in any way? -- Are you addressing some Tech debt in this PR? -- If both the above are false, feel free to remove this section. \ No newline at end of file From 3db24b1bc29049c3ea0feb4982e64c034ca2d2f4 Mon Sep 17 00:00:00 2001 From: saileshwar-skyflow Date: Wed, 8 Jan 2025 14:54:27 +0530 Subject: [PATCH 5/5] SK-1731: Fix env creds inconsistency --- skyflow/utils/_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/skyflow/utils/_utils.py b/skyflow/utils/_utils.py index d682eac0..5002956a 100644 --- a/skyflow/utils/_utils.py +++ b/skyflow/utils/_utils.py @@ -24,6 +24,7 @@ invalid_input_error_code = SkyflowMessages.ErrorCodes.INVALID_INPUT.value def get_credentials(config_level_creds = None, common_skyflow_creds = None, logger = None): + dotenv.load_dotenv() dotenv_path = dotenv.find_dotenv(usecwd=True) if dotenv_path: load_dotenv(dotenv_path)