Repository navigation
Conversation
2322a9d to
83a64cc
Compare
…resent When AuthenticationFilter.doFilter receives a request with no Authorization header (the first request in a SPNEGO/Kerberos handshake), respond 401 with WWW-Authenticate headers listing all registered auth schemes. This lets a SPNEGO client (e.g. curl --negotiate) receive the challenge and respond with its Kerberos token. Previously the filter returned a bare 401 with no WWW-Authenticate header, so the SPNEGO handshake was broken at the very first step (error: 'No auth scheme matched for null'). Also fix the scheme list in the supportedSchemes documentation (celeborn.master.http.auth.supportedSchemes and celeborn.worker.http.auth.supportedSchemes): the Kerberos scheme was listed as 'SPNEGO' but the enumeration value is 'NEGOTIATE'. Update CelebornConf.scala, docs/configuration/master.md and docs/configuration/worker.md for consistency with the ConfigurationSuite golden-file check.
|
Could we include a realm in the Basic challenge, e.g. RFC 7617 requires a realm for Basic authentication. I verified with Python’s The existing It would also be helpful to add regression tests for missing/empty Authorization headers and multiple configured schemes. AI-assisted review by OpenAI Codex (GPT-6). |
There was a problem hiding this comment.
🟡 Changes recommended
The core unauthenticated challenge behavior lacks automated regression coverage.
1 open finding
What changed in this PR
Adds authentication challenges for unauthenticated HTTP requests, enabling SPNEGO clients to initiate Kerberos negotiation.
Changes:
- Returns all configured
WWW-Authenticateschemes with 401 responses. - Corrects SPNEGO configuration terminology to
NEGOTIATE.
| File | Description |
|---|---|
AuthenticationFilter.scala |
Adds authentication challenges for missing headers. |
CelebornConf.scala |
Corrects supported-scheme documentation. |
docs/configuration/master.md |
Updates generated master configuration docs. |
docs/configuration/worker.md |
Updates generated worker configuration docs. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| authSchemeHandlers.keys.foreach { scheme => | ||
| httpResponse.addHeader("WWW-Authenticate", scheme.toString) |

What changes were proposed in this pull request?
When
AuthenticationFilter.doFilterreceives a request with noAuthorizationheader (the first request in a SPNEGO/Kerberos handshake), respond401withWWW-Authenticateheaders listing all registered auth schemes, so a SPNEGO client (e.g.curl --negotiate) can receive the challenge and respond with its Kerberos token. If anAuthorizationheader is present but matches no handler, the original error message is preserved.Also fix the scheme name in the
supportedSchemesdocumentation (celeborn.master.http.auth.supportedSchemes/celeborn.worker.http.auth.supportedSchemes): the Kerberos scheme was listed asSPNEGObut the enumeration value isNEGOTIATE. UpdatedCelebornConf.scala,docs/configuration/master.mdanddocs/configuration/worker.mdfor consistency with theConfigurationSuitegolden-file check.Files:
service/src/main/scala/org/apache/celeborn/server/common/http/authentication/AuthenticationFilter.scalacommon/src/main/scala/org/apache/celeborn/common/CelebornConf.scaladocs/configuration/master.mddocs/configuration/worker.mdWhy are the changes needed?
Previously the filter returned a bare
401with noWWW-Authenticateheader, so the SPNEGO handshake was broken at the very first step (error: "No auth scheme matched for null"). A SPNEGO client never receives the challenge and cannot send its Kerberos token.Does this PR resolve a correctness bug?
Does this PR introduce any user-facing change?
How was this patch tested?
Verified with
curl --negotiateagainst a Celeborn server configured with:celeborn.master.http.auth.supportedSchemes NEGOTIATEceleborn.master.http.spnego.keytab /path/to/keytabceleborn.master.http.spnego.principal HTTP/host@REALMBefore:
401withoutWWW-Authenticateheader, curl never sends the token.After:
401withWWW-Authenticate: NEGOTIATE, curl completes the SPNEGO handshake and returns200.