zowe / zowe/api-layer

Fix response message when user revoked using x509 auth

Open
#3,226 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Priority: Medium size/S
Dominant language
Java
Stars
92
Forks
81
Avg merge
1d 9h
Merged PRs (30d)
46

Description

Describe the bug
When using the client cert authentication with a user that got revoked, the identity mapping response from SAF is successful, the pass ticket is successfully generated but eventually z/OSMF is not able to authenticate with the passitcket to obtain the jwt token due to 401 Unauthorized.
DEBUG message from the log:

HTTP/1.1 401 Unauthorized
 <ZWEAGW1:https-jsse-nio-0.0.0.0-60254-exec-1:50726983> ZWESVUSR DEBUG (o.a.http.wire) http-outgoing-174 << "{"returnCode":8,"reasonCode":28,"message":"The user ID was revoked."}[\r][\n]"

However when calling the /login endpoint the REST response is different and misleading:

HTTP/1.1 400 Bad Request
{
    "messages": [
        {
            "messageType": "ERROR",
            "messageNumber": "ZWEAG121E",
            "messageContent": "Authorization header is missing, or the request body is missing or invalid for URL '/gateway/api/v1/auth/login'",
            "messageAction": "Provide valid authentication.",
            "messageReason": "The authorization header is missing, or the request body is missing or invalid.",
            "messageKey": "org.zowe.apiml.security.login.invalidInput"
        }
    ]
}

More clear message should be returned to the user.
The message of user being revoked is visible in the logs, but it's on DEBUG level. Maybe these type of messages should be switched to INFO.

https://github.com/zowe/api-layer/wiki/Issue-management

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the /login endpoint and the x509 authentication flow for a revoked user, using the DEBUG response showing returnCode 8 and reasonCode 28. Reproduce the 401-to-400 behavior and identify where the misleading response and revoked-user log message are produced. Done means the response clearly reports the revoked user, with the intended logging level clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.