[BUG] Keycloak provider substitutes 'no-audience-provided', so every login fails audience validation
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- authentication
Hướng nghiên cứu
Read lib/crewai-core/src/crewai_core/auth/providers/keycloak.py and compare KeycloakProvider.get_audience() with the providers named in the issue. Trace how the audience reaches _get_device_code and validate_jwt_token to understand the failure. Done means a missing audience is reported before browser login, with a focused test covering the Keycloak behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
KeycloakProvider.get_audience() in lib/crewai-core/src/crewai_core/auth/providers/keycloak.py returns the literal string "no-audience-provided" when no audience is configured:
def get_audience(self) -> str:
return self.settings.audience or "no-audience-provided"
That value is not a placeholder kept local to the provider: it is sent as the audience of the device-code request (crewai_core/auth/oauth2.py, _get_device_code) and then passed to PyJWT as the expected aud when the token is validated (_validate_and_save_token -> auth/utils.py::validate_jwt_token, which calls jwt.decode(..., audience=audience, ...)).
A Keycloak access token's aud is its client id or account; it can never equal "no-audience-provided". A Keycloak user who does not configure an audience therefore completes the browser step and then gets:
Exception: Invalid token audience. Got: 'account'. Expected: 'no-audience-provided'
get_required_fields() for Keycloak lists only realm, so nothing rejects the configuration earlier, and unlike Auth0/Okta/Entra ID (auth0.py, okta.py, entra_id.py all raise ValueError("Audience is required. ...") from get_audience()), Keycloak silently substitutes a value that cannot validate.
Steps to Reproduce
from crewai_core.auth.oauth2 import Oauth2Settings
from crewai_core.auth.providers.keycloak import KeycloakProvider
provider = KeycloakProvider(
Oauth2Settings(
provider="keycloak",
domain="keycloak.example.com",
client_id="crewai-cli",
audience=None,
extra={"realm": "my-realm"},
)
)
print(provider.get_audience())
Actual output:
no-audience-provided
Expected Behavior
get_audience() should report the missing setting, as the other providers do, instead of returning a value that makes every login fail at the last step with a misleading error. crewai enterprise login should say that an audience is required before opening the browser.
AI assistance
I used an AI coding agent to investigate, reproduce, and prepare this report, and reviewed its results. Per CONTRIBUTING.md, please apply the llm-generated label; external contributors cannot add it with my current permissions.
- Ngôn ngữ chính
- Python
- Star
- 61.2k
- Fork
- 9.2k
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 180
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 crewAIInc/crewAI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM providerCó thể đã có người làm @HashimSyedUBC đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missingCó thể đã có người làm @basil-k-aji-dev đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Native Azure provider ignores the seed settingCó thể đã có người làm @basil-k-aji-dev đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
crewAIInc/crewAI#9787 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summaryCó thể đã có người làm @basil-k-aji-dev đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của crewAIInc/crewAI
Issue tương tự
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
linuxserver/docker-healthchecks#137 · 1 bình luận ·
-
RequirementAgent treats list -> add -> list as a tool call cycle and drops the second list call (Python)Có thể đã có người làm @chaitanya0305 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
i-am-bee/beeai-framework#2049 · 1 reaction ·
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 78/100
fedora-infra/anitya#2272 ·
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 80/100
unitaryfoundation/mitiq#3205 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
[Bug]: Index worker test drops empty Git config values on WindowsCó thể đã có người làm @xiaoyesoso đã nhận hôm nay. Đang mởtriage/confirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
agentscope-ai/agentscope#4377 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày