[JBoss JIRA] (WFWIP-270) Configured headers can override headers added by the corresponding endpoint
by Darran Lofthouse (Jira)
[ https://issues.jboss.org/browse/WFWIP-270?page=com.atlassian.jira.plugin.... ]
Darran Lofthouse commented on WFWIP-270:
----------------------------------------
TBH no I don't believe it is an important use case, however as I have mentioned it in the analysis testing has been performed.
The primary use case for this RFE is to set headers we don't presently set at all.
In the analysis and community docs I think I will add that call out to say the override is not guaranteed / unspecified - when I added the line in the analysis I was more trying to cover the scenario that we can not prevent the endpoint overriding the header rather than offering a guarantee.
The only two headers for now that are confirmed problematic are "Connection" and "Date" so I will just restrict those.
> Configured headers can override headers added by the corresponding endpoint
> ---------------------------------------------------------------------------
>
> Key: WFWIP-270
> URL: https://issues.jboss.org/browse/WFWIP-270
> Project: WildFly WIP
> Issue Type: Bug
> Components: Security
> Reporter: Tomas Terem
> Assignee: Darran Lofthouse
> Priority: Blocker
> Labels: management
>
> [Analysis document|https://github.com/wildfly/wildfly-proposals/pull/263] says that
> 'Configured headers will not override any headers added by the corresponding endpoint.'
> However, I was able to override Connection and Date headers on /management endpoint.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 8 months
[JBoss JIRA] (WFWIP-270) Configured headers can override headers added by the corresponding endpoint
by Brian Stansberry (Jira)
[ https://issues.jboss.org/browse/WFWIP-270?page=com.atlassian.jira.plugin.... ]
Brian Stansberry commented on WFWIP-270:
----------------------------------------
[~dlofthouse]+1 to your last paragraph in your long comment.
Is the user attempting to specify a header that the endpoint already sets an important use case? On an analysis comment you mention:
"A number of headers that we already set are known to be problematic"
Do you mean the values we set may not be what the user wants from a security POV, i.e. our current behavior is a problem? Or is 'problematic' just referring to this issue of not having clear control over override behavior?
I suggest going further than saying non-override behavior is 'not guaranteed' and go all the way to 'unspecified', e.g.
"If a constant-header is configured whose name is the same as one the endpoint provides without that configuration, whether the configured value will be used is unspecified and may change from release to release. Overriding the endpoint's headers is not encouraged."
Validation to reject ones we know shouldn't be set sounds good.
> Configured headers can override headers added by the corresponding endpoint
> ---------------------------------------------------------------------------
>
> Key: WFWIP-270
> URL: https://issues.jboss.org/browse/WFWIP-270
> Project: WildFly WIP
> Issue Type: Bug
> Components: Security
> Reporter: Tomas Terem
> Assignee: Darran Lofthouse
> Priority: Blocker
> Labels: management
>
> [Analysis document|https://github.com/wildfly/wildfly-proposals/pull/263] says that
> 'Configured headers will not override any headers added by the corresponding endpoint.'
> However, I was able to override Connection and Date headers on /management endpoint.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 8 months
[JBoss JIRA] (WFWIP-270) Configured headers can override headers added by the corresponding endpoint
by Darran Lofthouse (Jira)
[ https://issues.jboss.org/browse/WFWIP-270?page=com.atlassian.jira.plugin.... ]
Darran Lofthouse commented on WFWIP-270:
----------------------------------------
We may change the definition slightly in the analysis.
If we want we can identify some headers which we will prevent from being defined, 'Connection' and 'Date' are two candidates for this list.
The implementation of path based headers relies on being early in the handler chain, as a request is received we get in there immediately and set the configured headers.
The headers are the first thing written in any HTTP response, once the request is processed by it's target handler there is always the possibility it will cause the response to start to be written (headers first) - if this happens we loose the opportunity to retrospectively set any headers so we can not set our headers after processing is complete as that can be too late.
A further complication is how individual handlers are implemented, if after our handler is called the target handler just calls put with a header the value set by the handler will replace the value we previously set. Undertow does not provide us a way to protect against that. However some handlers will check if a header has already been set before setting one itself, that is the case for the two examples here which is why the configuration is overriding.
It is impossible for us to come up with a complete list of headers that will only be set if not already set as the deployed contexts are dynamic so we don't know how the other contexts could implement their header handling, additionally it will be very hard to prevent subsequent changes to those handlers.
I think if we add some validation that prevents 'Connection' and 'Date' being set it would leave us with something that can be expanded in the future. In other cases we will just make sure it is clear that this non-override statement is not guaranteed as it will depend on the individual endpoint.
> Configured headers can override headers added by the corresponding endpoint
> ---------------------------------------------------------------------------
>
> Key: WFWIP-270
> URL: https://issues.jboss.org/browse/WFWIP-270
> Project: WildFly WIP
> Issue Type: Bug
> Components: Security
> Reporter: Tomas Terem
> Assignee: Darran Lofthouse
> Priority: Blocker
> Labels: management
>
> [Analysis document|https://github.com/wildfly/wildfly-proposals/pull/263] says that
> 'Configured headers will not override any headers added by the corresponding endpoint.'
> However, I was able to override Connection and Date headers on /management endpoint.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 8 months
[JBoss JIRA] (WFWIP-272) Specifying header name containing '\'n in constant-headers causes fatal error
by Darran Lofthouse (Jira)
[ https://issues.jboss.org/browse/WFWIP-272?page=com.atlassian.jira.plugin.... ]
Darran Lofthouse resolved WFWIP-272.
------------------------------------
Resolution: Done
https://github.com/darranl/wildfly-core/commit/134d0ec26641efce676c877468...
> Specifying header name containing '\'n in constant-headers causes fatal error
> -----------------------------------------------------------------------------
>
> Key: WFWIP-272
> URL: https://issues.jboss.org/browse/WFWIP-272
> Project: WildFly WIP
> Issue Type: Bug
> Components: Security
> Reporter: Tomas Terem
> Assignee: Darran Lofthouse
> Priority: Blocker
> Labels: management
>
> Specifying header name containing '\'n in constant-headers causes fatal error:
> {code:java}
> 10:02:36,853 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service org.wildfly.management.http.extensible: org.jboss.msc.service.StartException in service org.wildfly.management.http.extensible: WFLYSRV0083: Failed to start the http-interface service
> at org.jboss.as.server.mgmt.UndertowHttpManagementService.start(UndertowHttpManagementService.java:393)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
> at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
> at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
> at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
> at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.IllegalArgumentException: UT000149: HttpString is not allowed to contain newlines. value: A
> B
> at io.undertow.util.HttpString.checkForNewlines(HttpString.java:126)
> at io.undertow.util.HttpString.<init>(HttpString.java:120)
> at io.undertow.util.HttpString.<init>(HttpString.java:103)
> at org.jboss.as.domain.http.server.StaticHeadersHandler$HeaderConstant.<init>(StaticHeadersHandler.java:70)
> at org.jboss.as.domain.http.server.StaticHeadersHandler.addHeader(StaticHeadersHandler.java:61)
> at org.jboss.as.domain.http.server.ManagementHttpServer.setupOpenListener(ManagementHttpServer.java:369)
> at org.jboss.as.domain.http.server.ManagementHttpServer.create(ManagementHttpServer.java:279)
> at org.jboss.as.domain.http.server.ManagementHttpServer.access$2600(ManagementHttpServer.java:111)
> at org.jboss.as.domain.http.server.ManagementHttpServer$Builder.build(ManagementHttpServer.java:666)
> at org.jboss.as.server.mgmt.UndertowHttpManagementService.start(UndertowHttpManagementService.java:351)
> ... 8 more
> 10:02:36,856 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
> ("core-service" => "management"),
> ("management-interface" => "http-interface")
> ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.management.http.extensible" => "WFLYSRV0083: Failed to start the http-interface service
> Caused by: java.lang.IllegalArgumentException: UT000149: HttpString is not allowed to contain newlines. value: A
> B"}}
> 10:02:36,856 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
> ("core-service" => "management"),
> ("management-interface" => "http-interface")
> ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.management.http.extensible" => "WFLYSRV0083: Failed to start the http-interface service
> Caused by: java.lang.IllegalArgumentException: UT000149: HttpString is not allowed to contain newlines. value: A
> B"}}
> 10:02:36,868 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
> 10:02:36,875 INFO [org.jboss.as] (MSC service thread 1-5) WFLYSRV0050: WildFly Core 11.0.0.Beta3-SNAPSHOT stopped in 3ms
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years, 8 months