Skip to content

Commit 825d2d9

Browse files
committed
change default html error output to false, remove oauth error text from error messages
1 parent 11322b0 commit 825d2d9

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

server/src/main/java/password/pwm/http/servlet/oauth/OAuthConsumerServlet.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected void processAction( final PwmRequest pwmRequest )
104104
pwmRequest.sendRedirect( nextUrl );
105105
return;
106106
}
107-
final String errorMsg = "oauth consumer reached, but oauth authentication has not yet been initiated.";
107+
final String errorMsg = "oauth consumer reached, but oauth authentication has not yet been initiated";
108108
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, errorMsg );
109109
pwmRequest.respondWithError( errorInformation );
110110
LOGGER.error( pwmRequest, () -> errorMsg );
@@ -117,9 +117,9 @@ protected void processAction( final PwmRequest pwmRequest )
117117
final String oauthRequestError = pwmRequest.readParameterAsString( "error" );
118118
if ( oauthRequestError != null && !oauthRequestError.isEmpty() )
119119
{
120-
final String errorMsg = "incoming request from remote oauth server is indicating an error: " + oauthRequestError;
121-
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, errorMsg, "Remote Error: " + oauthRequestError, null );
122-
LOGGER.error( pwmRequest, () -> errorMsg );
120+
final String errorMsg = "incoming request from remote oauth server is indicating an error";
121+
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, errorMsg );
122+
LOGGER.error( pwmRequest, () -> errorMsg + ": " + oauthRequestError );
123123
pwmRequest.respondWithError( errorInformation );
124124
return;
125125
}
@@ -189,10 +189,10 @@ protected void processAction( final PwmRequest pwmRequest )
189189
}
190190
catch ( final PwmUnrecoverableException e )
191191
{
192-
final String errorMsg = "unexpected error redirecting user to oauth page: " + e.toString();
192+
final String errorMsg = "unexpected error redirecting user to oauth page";
193+
LOGGER.error( pwmRequest, () -> errorMsg + ": " + e.getMessage() );
193194
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, errorMsg );
194195
setLastError( pwmRequest, errorInformation );
195-
LOGGER.error( () -> errorInformation.toDebugStr() );
196196
}
197197
}
198198

@@ -206,10 +206,10 @@ protected void processAction( final PwmRequest pwmRequest )
206206
}
207207
catch ( final PwmException e )
208208
{
209-
final String errorMsg = "unexpected error communicating with oauth server: " + e.toString();
210-
final ErrorInformation errorInformation = new ErrorInformation( e.getError(), errorMsg );
209+
final String errorMsg = "unexpected error communicating with oauth server";
210+
LOGGER.error( pwmRequest, () -> errorMsg + ": " + e.getMessage() );
211+
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, errorMsg );
211212
setLastError( pwmRequest, errorInformation );
212-
LOGGER.error( () -> errorInformation.toDebugStr() );
213213
return;
214214
}
215215

@@ -271,9 +271,9 @@ protected void processAction( final PwmRequest pwmRequest )
271271
}
272272
catch ( final PwmOperationalException e )
273273
{
274-
final String errorMsg = "error while examining incoming oauth code for already authenticated session: " + e.getMessage();
274+
final String errorMsg = "error while examining incoming oauth code for already authenticated session";
275275
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, errorMsg );
276-
LOGGER.error( pwmRequest, () -> errorMsg );
276+
LOGGER.error( pwmRequest, () -> errorMsg + ": " + e.getMessage() );
277277
pwmRequest.respondWithError( errorInformation );
278278
return;
279279
}
@@ -297,8 +297,9 @@ protected void processAction( final PwmRequest pwmRequest )
297297
}
298298
catch ( final PwmException e )
299299
{
300-
LOGGER.error( pwmRequest, () -> "error during OAuth authentication attempt: " + e.getMessage() );
301-
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, e.getMessage() );
300+
final String errorMsg = "error during OAuth authentication attempt";
301+
LOGGER.error( pwmRequest, () -> errorMsg + ": " + e.getMessage() );
302+
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_OAUTH_ERROR, errorMsg );
302303
pwmRequest.respondWithError( errorInformation );
303304
return;
304305
}

server/src/main/resources/password/pwm/AppProperty.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ http.resources.pathNonceEnable=true
122122
http.resources.pathNoncePrefix=nonce-
123123
http.resources.zipFiles=[]
124124
http.gzip.enable=true
125-
http.errors.allowHtml=true
125+
http.errors.allowHtml=false
126126
http.basicAuth.charset=UTF-8
127127
http.body.maxReadLength=10485760
128128
http.client.alwaysLogEntities=false

0 commit comments

Comments
 (0)