From 4dd911c0c41d72ad8b6ee65b2af0bf9ca735b347 Mon Sep 17 00:00:00 2001 From: AnassNaouchi Date: Mon, 7 Sep 2026 05:46:40 +0300 Subject: [PATCH 1/2] Protect production urls from manipulation --- .github/copilot-instructions.md | 42 ++++++++++++++++++++++++++++++ .gitleaks.toml | 33 +++++++++++++++++++++++ .pre-commit-config.yaml | 12 +++++++++ omise/test/test_production_urls.py | 9 +++++++ 4 files changed, 96 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 .gitleaks.toml create mode 100644 .pre-commit-config.yaml create mode 100644 omise/test/test_production_urls.py diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..019210d --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,42 @@ +# Omise Python SDK — Security & Code Review Instructions + +## Code Review Checklist + +When reviewing PRs or commits, Copilot should automatically flag: + +### 1. Non-Production Omise Hosts (CRITICAL) + +Flag any committed code containing Omise domains that do NOT match the official +production domain pattern `*.omise.co`. This includes: + +- Omise domains with any prefix other than `api`, `vault`, or other official production services +- Any `localhost` or `internal` patterns referencing Omise +- Any non-production environment hosts + +## Critical Files Requiring Strict Review + +These files contain Omise endpoint/host constants and require additional scrutiny: + +### `omise/__init__.py` — CRITICAL SECURITY FILE + +This file defines the base URLs used throughout the Omise Python SDK for API +and vault calls. It contains the production endpoint constants. + +**Changes to Block (Red Flag):** + +- Any change introducing a non-omise.co domain for production endpoints +- Hardcoding non-production Omise URLs in production code paths (regex: `https?://[a-zA-Z0-9.-]*omise[a-zA-Z0-9.-]*(? Date: Wed, 9 Sep 2026 05:56:35 +0300 Subject: [PATCH 2/2] Modify regex to scan both domain and full url for api scans and set gitleaks scan to local system --- .github/copilot-instructions.md | 2 +- .gitleaks.toml | 2 +- .pre-commit-config.yaml | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 019210d..7e9acef 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -24,7 +24,7 @@ and vault calls. It contains the production endpoint constants. **Changes to Block (Red Flag):** -- Any change introducing a non-omise.co domain for production endpoints +- Any change introducing a non omise.co domain for production endpoints - Hardcoding non-production Omise URLs in production code paths (regex: `https?://[a-zA-Z0-9.-]*omise[a-zA-Z0-9.-]*(?