OAuth Authorization Code Parameter Not URL-Encoded in Token Exchange Request
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- authentication, security
Hướng nghiên cứu
Bắt đầu tại src/asfquart/generics.py:97 và kiểm tra request trao đổi token OAuth xung quanh cùng các cách sử dụng hiện có của urllib.parse.quote(). Chạy test suite liên quan hoặc tìm các bài kiểm thử OAuth. Sau đó, xác minh rằng các ký tự đặc biệt trong authorization code không thể chèn tham số và rằng độ bao phủ của unit test và integration test xác nhận việc mã hóa; xem xét liệu create_secure_session() có cần thiết cho việc hardening TLS đã nêu hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Issue: FINDING-067 - OAuth Authorization Code Parameter Not URL-Encoded in Token Exchange Request
Labels: bug, security, priority:medium, asvs-level:L1, asvs-level:L2
ASVS Level(s): [L1, L2]
Description:
Summary
The OAuth authorization code parameter is not URL-encoded before being interpolated into the token exchange request URL to oauth.apache.org. While urllib.parse.quote() is imported and used extensively in the same file for other OAuth parameters, it is not applied to the 'code' parameter. This allows an attacker to inject additional query parameters into the token exchange request. Per RFC 6749 §4.1.2, authorization codes can contain any printable ASCII character including &, =, ?, and #, which enables parameter injection attacks.
Details
Affected Files and Lines:
src/asfquart/generics.py:97- Code parameter without URL encoding
The authorization code is interpolated directly into the URL without encoding, allowing special characters to inject additional parameters.
Recommended Remediation
Apply urllib.parse.quote() to the OAuth code parameter before URL interpolation:
encoded_code = urllib.parse.quote(code, safe='')
rv = await session.get(OAUTH_URL_CALLBACK % encoded_code)
Additionally, consider using create_secure_session() from atr/util.py instead of plain aiohttp.ClientSession to enforce TLS 1.2+, explicit certificate verification, hostname checking, and secure cipher suite selection for defense-in-depth.
Acceptance Criteria
- Code parameter URL-encoded
- Parameter injection prevented
- Hardened TLS session considered
- Integration test verifies encoding
- Unit test verifying the fix
References
- Source reports: L1:1.2.2.md, L2:1.3.6.md
- Related findings: FINDING-068
- ASVS sections: 1.2.2, 1.3.6
Priority
Medium
- Ngôn ngữ chính
- Python
- Star
- 7
- Fork
- 14
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/infrastructure-asfquart
-
bug priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Document external service endpoints and failure behaviorCó thể đã có người làm @AnKiT-GaRG2 đã nhận 2 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Document OAuth callback consistency rulesCó thể đã có người làm @Marrshal15 đã nhận 20 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/infrastructure-asfquart#126 · 1 bình luận ·
-
ASVS priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
apache/infrastructure-asfquart#85 · 1 bình luận ·
-
Triage and track asfquart issuesCó thể đã có người làm @sbp đã nhận 19 ngày trước. Đang mở
apache/infrastructure-asfquart#134 · 1 người được giao ·
Tất cả issue của apache/infrastructure-asfquart
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
conda-forge/conda-forge-bot#7025 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore(ci): publish.yml's release-job comment counts the hand-created Releases as all of themĐang mởarea:ci
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
catincloud-labs/dagster-dex#149 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
home-assistant/core#188424 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Review backlog (docs-currency): README 'CI run' link lands on a run whose overall badge is cancelledĐang mởagent/reviewer needs-kind needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
projectbluefin/utah#880 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
redis/memtier_benchmark#850 ·
Maintainer thường phản hồi trong vòng 1 ngày