Skip to content

Commit 5208ab1

Browse files
mithroclaude
andcommitted
Fix CI failures: gitleaks path pattern and code formatting
Fixed two CI failures blocking PR #43: 1. Gitleaks false positives: - Changed path pattern from '/tests/' to 'tests/' (no leading slash) - File paths in gitleaks are relative to repo root without leading slash - Now correctly excludes all test files with placeholder secrets 2. Code formatting (ruff): - Auto-formatted test and view files to use modern Django patterns - Changed request.META["HTTP_*"] to request.headers.get() - Consolidated multi-line function calls where appropriate Verified locally: - gitleaks detect: PASS (no leaks found) - make lint: PASS - make type-check: PASS 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f7825b2 commit 5208ab1

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

.gitleaks.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ paths = [
2222
'''\.github/workflows/ci\.yml$''', # CI workflow has example connection strings
2323
'''deployment/scripts/''', # Deployment scripts that generate secrets (not contain them)
2424
'''\.gitleaks\.toml$''', # This config file contains example patterns
25-
'''/tests/''', # All test files (browser tests, unit tests with test fixtures)
25+
'''tests/''', # All test files (browser tests, unit tests with test fixtures)
2626
]
2727

2828
# Common patterns for test files with fake credentials

wafer_space/projects/tests/test_views_compliance.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,7 @@ def test_post_captures_user_agent(self):
351351

352352
# Set HTTP_USER_AGENT
353353
response = self.client.post(
354-
url,
355-
data=form_data,
356-
HTTP_USER_AGENT="Mozilla/5.0 Test Browser",
354+
url, data=form_data, headers={"user-agent": "Mozilla/5.0 Test Browser"}
357355
)
358356

359357
assert response.status_code == HTTP_FOUND
@@ -392,7 +390,7 @@ def test_post_updates_existing_certification(self):
392390
url,
393391
data=form_data,
394392
REMOTE_ADDR="203.0.113.195",
395-
HTTP_USER_AGENT="New Browser",
393+
headers={"user-agent": "New Browser"},
396394
)
397395

398396
assert response.status_code == HTTP_FOUND

wafer_space/projects/views_compliance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def get_client_ip(request):
2323
Returns:
2424
str: Validated IP address or None if invalid
2525
"""
26-
x_forwarded_for = request.META.get("HTTP_X_FORWARDED_FOR")
26+
x_forwarded_for = request.headers.get("x-forwarded-for")
2727
if x_forwarded_for:
2828
# Get first IP from comma-separated list
2929
potential_ip = x_forwarded_for.split(",")[0].strip()
@@ -97,7 +97,7 @@ def compliance_certification_create(request, pk):
9797

9898
# Capture IP address and user agent
9999
certification.ip_address = get_client_ip(request)
100-
certification.user_agent = request.META.get("HTTP_USER_AGENT", "")
100+
certification.user_agent = request.headers.get("user-agent", "")
101101
certification.save()
102102

103103
messages.success(

0 commit comments

Comments
 (0)