Skip to content

Commit 0b68aa9

Browse files
committed
refactor: clean up environment variables and update internal service URL handling
1 parent e60a35c commit 0b68aa9

3 files changed

Lines changed: 6 additions & 21 deletions

File tree

.env.example

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,3 @@ DEBUG=false
2020
# RT_EPOCH_LENGTH=1200
2121
RT_STORAGE_API_URL="https://storage-api.theredteam.io"
2222

23-
24-
## -- Challenge configs -- ##
25-
# CHALLENGE_API_KEY="changeme"
26-
# CHALLENGE_VERIFICATION_API_KEY="changeme"
27-
# RT_CHALLENGE_LOGS_DIR=volumes/storage/agent.miner/logs
28-
# CHALLENGE_VERIFICATION_ENDPOINT="http://localhost:8000/verify"
29-
# CHALLENGE_VERIFICATION_STARTUP_URL="http://localhost:8000/startup"
30-
31-
## -- AAD Challenge configs -- ##
32-
# AAD_CHALLENGE_NSTBROWSER_API_KEY="changeme"
33-
# AAD_CHALLENGE_NSTBROWSER_HOST=localhost
34-
# AAD_CHALLENGE_NSTBROWSER_PORT=9222
35-
# AAD_CHALLENGE_NSTBROWSER_PROTOCOL=http
36-
37-
## -- DFP Challenge configs -- ##
38-
# DFP_CHALLENGE_PROXY_INTER_BASE_URL=http://192.193.123.01:8000
39-
# DFP_API_DEVICES_PATH=/src/challenges/dev_fingerprinter/devices.json

src/redteam_core/challenge_pool/controller.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ def _validate_miner_submission(self, miner_commit: MinerChallengeCommit) -> bool
371371
payload = {
372372
"miner_script": _miner_script,
373373
}
374-
_internal_services_url = constants.INTERNAL_SERVICES.API_URL
374+
_internal_services_url = str(constants.INTERNAL_SERVICES.API_URL).rstrip(
375+
"/"
376+
)
375377
_validator_endpoint = f"{_internal_services_url}/check/challenge/{self.challenge_info.get('challenge_type', 'default')}/"
376378
headers = {
377379
"Content-Type": "application/json",
@@ -506,9 +508,9 @@ def _compare_with_baseline(self, miner_commit: MinerChallengeCommit):
506508
"Content-Type": "application/json",
507509
"X-API-KEY": constants.INTERNAL_SERVICES.API_KEY,
508510
}
509-
511+
_internal_service_url = str(constants.INTERNAL_SERVICES.API_URL).rstrip("/")
510512
response = requests.post(
511-
f"{constants.INTERNAL_SERVICES.API_URL}/compare/baseline-scripts",
513+
f"{_internal_service_url}/compare/baseline-scripts",
512514
timeout=self.challenge_info.get("challenge_compare_timeout", 150),
513515
verify=False,
514516
json=payload,

0 commit comments

Comments
 (0)