Skip to content

Commit

Permalink
Delete hard-coded keys from mitmproxy files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Grayson committed Mar 15, 2024
1 parent 7a8e551 commit 0fae6d5
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions backend/worker/test_mitmproxy_sign_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,16 @@
It includes tests for different scenarios such as when a user agent and signature are set, and when they are not set.
"""

# Standard Python Libraries
import os

# Third-Party Libraries
from dotenv import load_dotenv
from mitmproxy.test import taddons, tflow

from .mitmproxy_sign_requests import SignRequests

# This is a test RSA private key and not used in any deployed environment
private_key = """-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF
NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F
UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB
AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA
QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK
kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg
f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u
412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc
mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7
kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA
gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW
G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI
7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA==
-----END RSA PRIVATE KEY-----"""

public_key = """-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCFENGw33yGihy92pDjZQhl0C3
6rPJj+CvfSC8+q28hxA161QFNUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6
Z4UMR7EOcpfdUE9Hf3m/hs+FUR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJw
oYi+1hqp1fIekaxsyQIDAQAB
-----END PUBLIC KEY-----"""
load_dotenv()


def test_user_agent_and_signature():
Expand All @@ -42,8 +24,8 @@ def test_user_agent_and_signature():
"""
sr = SignRequests(
key_id="crossfeed",
public_key=public_key,
private_key=private_key,
public_key=os.getenv("WORKER_SIGNATURE_PUBLIC_KEY"),
private_key=os.getenv("WORKER_SIGNATURE_PRIVATE_KEY"),
user_agent="custom user agent",
)
with taddons.context():
Expand Down

0 comments on commit 0fae6d5

Please sign in to comment.