You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by GitBox <gi...@apache.org> on 2022/07/25 09:24:40 UTC

[GitHub] [shiro] sebastianfrey opened a new pull request, #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

sebastianfrey opened a new pull request, #369:
URL: https://github.com/apache/shiro/pull/369

   Fixes SHIRO-887.
   
   This PR fixes an issue where passwords which start and/or end with spaces are trimmed by the FormAuthenticationFilter, which prevents login for users with such passwords.
   
   <!--
   For Security Vulnerabilities, please email: security@shiro.apache.org
   For more details on how to report a vulnerablity see: https://www.apache.org/security/
   -->
   
   Following this checklist to help us incorporate your contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SHIRO) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[SHIRO-XXX] - Fixes bug in SessionManager`,
          where you replace `SHIRO-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean install apache-rat:check` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
    - [x] If you have a group of commits related to the same change, please squash your commits into one and force push your branch using `git rebase -i`. 
    
   Trivial changes like typos do not require a JIRA issue (javadoc, comments...). 
   In this case, just format the pull request title like `(DOC) - Add javadoc in SessionManager`.
    
   If this is your first contribution, you have to read the [Contribution Guidelines](https://github.com/apache/shiro/blob/master/CONTRIBUTING.md)
   
   If your pull request is about ~20 lines of code you don't need to sign an [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) 
   if you are unsure please ask on the developers list.
   
   To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
    - [x] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] bmarwell commented on pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
bmarwell commented on PR #369:
URL: https://github.com/apache/shiro/pull/369#issuecomment-1194414757

   Kindly re-target against 1.9.x instead. I cannot just change the branch here.
   
   Rationale: detect signature change of public methods.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] sebastianfrey commented on a diff in pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
sebastianfrey commented on code in PR #369:
URL: https://github.com/apache/shiro/pull/369#discussion_r954604540


##########
web/src/main/java/org/apache/shiro/web/util/WebUtils.java:
##########
@@ -616,7 +616,20 @@ public static boolean isTrue(ServletRequest request, String paramName) {
      * @return the clean param value, or null if the param does not exist or is empty.
      */
     public static String getCleanParam(ServletRequest request, String paramName) {
-        return StringUtils.clean(request.getParameter(paramName));
+        return getCleanParam(request, paramName, true);
+    }
+
+    /**
+     * Convenience method that returns a request parameter value, first running it through
+     * {@link StringUtils#clean(String)}.
+     *
+     * @param request   the servlet request.
+     * @param paramName the parameter name.
+     * @param trim specifies whether the parameter value shoudl be trimmed or not

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] fpapon commented on pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
fpapon commented on PR #369:
URL: https://github.com/apache/shiro/pull/369#issuecomment-1194612951

   > 这是自动回复邮件。你好,您的邮件已经发送到我的邮箱,我看过后会尽快给您回复。
   
   please write in english


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] sunshineandy commented on pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
sunshineandy commented on PR #369:
URL: https://github.com/apache/shiro/pull/369#issuecomment-1193803393

   这是自动回复邮件。你好,您的邮件已经发送到我的邮箱,我看过后会尽快给您回复。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] sebastianfrey commented on a diff in pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
sebastianfrey commented on code in PR #369:
URL: https://github.com/apache/shiro/pull/369#discussion_r933807562


##########
web/src/main/java/org/apache/shiro/web/util/WebUtils.java:
##########
@@ -616,7 +616,20 @@ public static boolean isTrue(ServletRequest request, String paramName) {
      * @return the clean param value, or null if the param does not exist or is empty.
      */
     public static String getCleanParam(ServletRequest request, String paramName) {
-        return StringUtils.clean(request.getParameter(paramName));
+        return getCleanParam(request, paramName, true);
+    }
+
+    /**
+     * Convenience method that returns a request parameter value, first running it through
+     * {@link StringUtils#clean(String)}.
+     *
+     * @param request   the servlet request.
+     * @param paramName the parameter name.
+     * @param trim specifies whether the parameter value shoudl be trimmed or not

Review Comment:
   Typo `shoudl`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] bmarwell commented on a diff in pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #369:
URL: https://github.com/apache/shiro/pull/369#discussion_r929152234


##########
lang/src/main/java/org/apache/shiro/lang/util/StringUtils.java:
##########
@@ -139,13 +139,16 @@ public static boolean startsWithIgnoreCase(String str, String prefix) {
      * is returned.
      *
      * @param in the input String to clean.
+     * @param trim specifies whether the input String should be trimmed or not
      * @return a populated-but-trimmed String or <code>null</code> otherwise
      */
-    public static String clean(String in) {

Review Comment:
   
   Please re-target your PR against 1.9.x or 1.10.x (upcoming), so we can detect API changes via CI.
   I see this is okay due to the following method, though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] bmarwell commented on a diff in pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #369:
URL: https://github.com/apache/shiro/pull/369#discussion_r929184925


##########
lang/src/main/java/org/apache/shiro/lang/util/StringUtils.java:
##########
@@ -139,13 +139,16 @@ public static boolean startsWithIgnoreCase(String str, String prefix) {
      * is returned.
      *
      * @param in the input String to clean.
+     * @param trim specifies whether the input String should be trimmed or not
      * @return a populated-but-trimmed String or <code>null</code> otherwise
      */
-    public static String clean(String in) {

Review Comment:
   Here you go: https://github.com/apache/shiro/tree/1.10.x



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] sebastianfrey commented on a diff in pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
sebastianfrey commented on code in PR #369:
URL: https://github.com/apache/shiro/pull/369#discussion_r929532494


##########
lang/src/main/java/org/apache/shiro/lang/util/StringUtils.java:
##########
@@ -139,13 +139,16 @@ public static boolean startsWithIgnoreCase(String str, String prefix) {
      * is returned.
      *
      * @param in the input String to clean.
+     * @param trim specifies whether the input String should be trimmed or not
      * @return a populated-but-trimmed String or <code>null</code> otherwise
      */
-    public static String clean(String in) {

Review Comment:
   As requested, the PR has been re-targeted against 1.10.x.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shiro] bdemers merged pull request #369: [SHIRO-887] Do not trim passwords in FormAuthenticationFilter

Posted by GitBox <gi...@apache.org>.
bdemers merged PR #369:
URL: https://github.com/apache/shiro/pull/369


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org