[jboss-jira] [JBoss JIRA] (WFCORE-4474) Missing path validation of a log file while update path

Vratislav Marek (Jira) issues at jboss.org
Fri May 17 03:46:00 EDT 2019


    [ https://issues.jboss.org/browse/WFCORE-4474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13734710#comment-13734710 ] 

Vratislav Marek edited comment on WFCORE-4474 at 5/17/19 3:45 AM:
------------------------------------------------------------------

[~jamezp] Before I set an absolute path, the validator correctly rejects the invalid paths with one backslash and slash. 
{noformat}C:\server.log, C:/server.log{noformat}
The absolute path with illegal separator it was evaluated as a file name with an illegal character.
But in case I was set the correct absolute path 
{noformat}C:\\server.log{noformat}
and I try to reconfigure it.
Then was be accept path with missing or invalid separator.




was (Author: vmarek):
[~jamezp] Before I set an absolute path, the validator correctly rejects the invalid paths with one backslash and slash (C:\server.log, C:/server.log).
The absolute path with illegal separator It was evaluated as a file name with illegal character.
But in case I was set the correct absolute path (C:\\server.log) and try to reconfigure it.
Then was be accept path with missing or invalid separator.

> Missing path validation of a log file while update path 
> --------------------------------------------------------
>
>                 Key: WFCORE-4474
>                 URL: https://issues.jboss.org/browse/WFCORE-4474
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: Logging
>    Affects Versions: 9.0.0.Beta4
>            Reporter: Vratislav Marek
>            Assignee: James Perkins
>            Priority: Major
>
> After the first successful set of a valid path, you can set an invalid path.
> It is can be relative to that while "relative-to" parameter is overridden,  the validator doesn't validate it.
> Discovered on Windows.
> A code block is divided, but it is holding sequence to reproduce.
> _This works as expected._
> {code:bash}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:/server.log})
> {
>     "outcome" => "failed",
>     "failure-description" => "WFLYCTL0158: Operation handler failed: java.nio.file.InvalidPathException: Illegal char <
> :> at index 61: D:\\Tests\\clear\\wildfly-17.0.0.Beta1-SNAPSHOT\\standalone\\log\\C:/server.log",
>     "rolled-back" => true
> }
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:\server.log})
> {
>     "outcome" => "failed",
>     "failure-description" => "WFLYCTL0158: Operation handler failed: java.nio.file.InvalidPathException: Illegal char <
> :> at index 61: D:\\Tests\\clear\\wildfly-17.0.0.Beta1-SNAPSHOT\\standalone\\log\\C:server.log",
>     "rolled-back" => true
> }
> {code}
> _Still works as expected. But After this successful write-attribute command, it that changing._
> {code:bash}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:\\server.log})
> {"outcome" => "success"}
> {code}
> *Now there is a problem, it that not works as expected. The validator accepts invalid path.*
> {code:bash}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:/server.log})
> {"outcome" => "success"}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:server.log})
> {"outcome" => "success"}
> {code}
> _But not accept all invalid paths._
> {code:bash}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:*server.log})
> {
>     "outcome" => "failed",
>     "failure-description" => "WFLYCTL0158: Operation handler failed: java.nio.file.InvalidPathException: Illegal char <
> *> at index 2: C:*server.log",
>     "rolled-back" => true
> }
> {code}
> _Verification if the unsuccessful update changes something. But not._
> {code:bash}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:/server.log})
> {"outcome" => "success"}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:server.log})
> {"outcome" => "success"}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:\\server.log})
> {"outcome" => "success"}
> {code}
> _Verification if is really set in the property value. Yes_
> {code:bash}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:read-attribute(name=file)
> {
>     "outcome" => "success",
>     "result" => {"path" => "C:\\server.log"}
> }
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:server.log})
> {"outcome" => "success"}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:read-attribute(name=file)
> {
>     "outcome" => "success",
>     "result" => {"path" => "C:server.log"}
> }
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:/server.log})
> {"outcome" => "success"}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:read-attribute(name=file)
> {
>     "outcome" => "success",
>     "result" => {"path" => "C:/server.log"}
> }
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=file,value={path=C:\server.log})
> {"outcome" => "success"}
> [standalone at localhost:9990 /] /subsystem=logging/periodic-rotating-file-handler=FILE:read-attribute(name=file)
> {
>     "outcome" => "success",
>     "result" => {"path" => "C:server.log"}
> }
> {code}



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list