diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f886aed --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,37 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "06:00" + timezone: "Europe/Warsaw" + open-pull-requests-limit: 10 + labels: + - "dependencies" + - "python" + + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "06:15" + timezone: "Europe/Warsaw" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "docker" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "06:30" + timezone: "Europe/Warsaw" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "github-actions" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..fc4aff6 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,73 @@ +name: CodeQL Advanced + +on: + push: + branches: + - main + - master + - dev + pull_request: + branches: + - main + - master + - dev + schedule: + - cron: '23 3 * * 1' + workflow_dispatch: + +permissions: + actions: read + contents: read + packages: read + security-events: write + +concurrency: + group: codeql-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + include: + - language: python + build-mode: none + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-and-quality + config: | + paths-ignore: + - media/** + - '**/__pycache__/**' + - '**/*.md' + + - name: Set up Python + if: matrix.language == 'python' + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies (Python) + if: matrix.language == 'python' + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: /language:${{ matrix.language }} diff --git a/core/interceptor.py b/core/interceptor.py index 8f56e6e..70a08da 100644 --- a/core/interceptor.py +++ b/core/interceptor.py @@ -558,9 +558,7 @@ class TLSContextFactory: @classmethod def client_context(cls, alpn: List[str] = None) -> ssl.SSLContext: - ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - ctx.check_hostname = False - ctx.verify_mode = ssl.CERT_NONE + ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) ctx.minimum_version = ssl.TLSVersion.TLSv1_2 try: ctx.set_ciphers(cls.CIPHERS) @@ -574,8 +572,6 @@ def client_context(cls, alpn: List[str] = None) -> ssl.SSLContext: def server_context(cls, cert_path: str, key_path: str, alpn: List[str] = None) -> ssl.SSLContext: ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ctx.load_cert_chain(certfile=cert_path, keyfile=key_path) - ctx.check_hostname = False - ctx.verify_mode = ssl.CERT_NONE ctx.minimum_version = ssl.TLSVersion.TLSv1_2 try: ctx.set_ciphers(cls.CIPHERS)