accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ACCUMULO-3681) Avoid string format injection problems
Date Sat, 21 Mar 2015 23:36:10 GMT

    [ https://issues.apache.org/jira/browse/ACCUMULO-3681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14373098#comment-14373098
] 

ASF GitHub Bot commented on ACCUMULO-3681:
------------------------------------------

GitHub user EdColeman opened a pull request:

    https://github.com/apache/accumulo/pull/24

    ACCUMULO-3681 modified log statements that take format string (slf4j) from using arbitrary
strings as first argument.

    This should complete ACCUMULO-3681.  Additional clean-up is still required for logging
statements that are using log4j.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/EdColeman/accumulo ACCUMULO-3681

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/accumulo/pull/24.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #24
    
----
commit 26c0cae8c93fde7c7c267bfad41907df0192c6c5
Author: Ed Coleman <dev1@etcoleman.com>
Date:   2015-03-21T23:29:24Z

    ACCUMULO-3681 modified log statements that take format string (slf4j) from using arbitrary
strings as first argument.

----


> Avoid string format injection problems
> --------------------------------------
>
>                 Key: ACCUMULO-3681
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-3681
>             Project: Accumulo
>          Issue Type: Sub-task
>          Components: build
>            Reporter: Christopher Tubbs
>            Assignee: Ed Coleman
>             Fix For: 1.7.0
>
>
> In log4j, we could write {{log.debug(e,e);}}, where {{e}} was an {{Exception}} type,
whenever we didn't have a more specific message to put in. Log4j would convert the first parameter
to a {{String}}.
> With the migration to slf4j, this no longer works. Instead, slf4j requires the first
parameter to be a format string. So, in many places, we've converted these to something like
{{log.debug(e.toString(),e);}}.
> However, the key point here is that it's not just _any_ string, it's specifically a *format*
string. So, this will be problematic if {{e.toString()}} actually contains format instructions
like {{The input "\{\}" is not a valid table name}}.
> To avoid these kinds of problems, we should take care to replace these with a better
option:
> # {{log.debug("Some explicit message", e);}} (preferred)
> # {{log.debug("", e);}}
> # {{log.debug("{}", e.getMessage(), e);}}
> # {{log.debug("{}", e.toString(), e);}}
> # {{log.debug("{}", e, e);}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message