Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consul UI forms use Content-Type: application/x-www-form-urlencoded without any encoding #3804

Closed
Cardds opened this issue Jan 15, 2018 · 3 comments
Labels
archived/webui This was used for v1/ui type/bug Feature does not function as expected
Milestone

Comments

@Cardds
Copy link

Cardds commented Jan 15, 2018

Description of the Issue (and unexpected/desired result)

The Key/Value PUT update in the UI is sent with content-type "application/x-www-form-urlencoded;charset=UTF-8" , but does not encode the body with URL encoding, as per the definition of the content-type. It appears to, instead, treat these packets as content-type 'text/plain'.

In isolation, this does not affect Consul, since it neither encodes or decodes URI encoding nor expects such encoding. However, if Consul is placed behind a reverse proxy, e.g. Zuul, that must parse and reconstruct the message according to its Content-Type, in this case, "application/x-www-form-urlencoded", the packet cannot be appropriately passed on due to not adhering to the specification for the content type.

Reproduction steps

  1. Access the HTTP UI of the Consul Server in a browser.
  2. Access KEY/VALUE tab
  3. Ensure packets are being captured in the packet capture tool of choice
  4. Add a new Key Value. Ensure the value has a character that would be encoded under URI encoding, such as a newline

Example:
"Hello
World"

  1. Click Update
  2. Check packet capture of the PUT associated with the Key/Value update (step Bootstrapping unclear in docs #5).

Actual:

  • Packet content-type set to "application/x-www-form-urlencoded;charset=UTF-8"
  • No URL encoding of characters in the body of the PUT request.

Expected:

Either:
 - Packet content-type set to "application/x-www-form-urlencoded"
 - URL encoding of characters in the body of the PUT request.
Or:
 - Packet content-type set to "text/plain;charset=UTF-8"
 - Characters in the body of the PUT request are not encoded.

Second options seems most preferable.

consul version for both Client and Server

Server: Consul v1.0.2

consul info for Server

agent:
        check_monitors = 0
        check_ttls = 0
        checks = 0
        services = 0
build:
        prerelease =
        revision = b55059f
        version = 1.0.2
consul:
        bootstrap = false
        known_datacenters = 1
        leader = true
        leader_addr = 127.0.0.1:8300
        server = true
raft:
        applied_index = 20186
        commit_index = 20186
        fsm_pending = 0
        last_contact = 0
        last_log_index = 20186
        last_log_term = 2
        last_snapshot_index = 16384
        last_snapshot_term = 2
        latest_configuration = [{Suffrage:Voter ID:e33e8680-9b63-82ca-aae4-f0c313e0f20e Address:127.0.0.1:8300}]
        latest_configuration_index = 1
        num_peers = 0
        protocol_version = 3
        protocol_version_max = 3
        protocol_version_min = 0
        snapshot_version_max = 1
        snapshot_version_min = 0
        state = Leader
        term = 2
runtime:
        arch = amd64
        cpu_count = 2
        goroutines = 74
        max_procs = 2
        os = linux
        version = go1.9.2
serf_lan:
        coordinate_resets = 0
        encrypted = false
        event_queue = 1
        event_time = 2
        failed = 0
        health_score = 0
        intent_queue = 0
        left = 0
        member_time = 1
        members = 1
        query_queue = 0
        query_time = 1
serf_wan:
        coordinate_resets = 0
        encrypted = false
        event_queue = 0
        event_time = 1
        failed = 0
        health_score = 0
        intent_queue = 0
        left = 0
        member_time = 1
        members = 1
        query_queue = 0
        query_time = 1
@slackpad slackpad added type/bug Feature does not function as expected archived/webui This was used for v1/ui labels Jan 25, 2018
@slackpad slackpad added this to the Next milestone Jan 25, 2018
@slackpad
Copy link
Contributor

We are currently doing a rewrite of the web UI so this will be addressed then, though if this is a quick fix we can probably update the old UI in the meantime.

@johncowen
Copy link
Contributor

Hi @Cardds

I'm just checking in with you to see if you've managed to try out our new UI for Consul?

Does using the new UI resolve your issue?

If so, feel free to close the issue, otherwise I'll probably close it myself over the next few days, I'm pretty sure the new UI covers the above.

Let me know if not and I can take another look.

Thanks

@pearkes
Copy link
Contributor

pearkes commented Oct 26, 2018

Given the new UI is the default now, I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archived/webui This was used for v1/ui type/bug Feature does not function as expected
Projects
None yet
Development

No branches or pull requests

4 participants