Skip to content

Commit

Permalink
Send frame as request paramater as well
Browse files Browse the repository at this point in the history
Here's what happens: When a client sends simple command without any
values in XML, registry can drop the `raw_frame` parameter
completely. If so, it relies on `frame` parameter being passed on to
create XML document.

https://github.com/internetee/registry/blame/ad823391b75509d5be20ee6ef217aa4f35a4c994/lib/epp_constraint.rb#L14

Fix involves sending the XML string twice, as `frame` and
`raw_frame`, the same as `mod_epp` did.
  • Loading branch information
Maciej Szlosarczyk committed Jul 17, 2019
1 parent f00a17b commit e99733a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
15 changes: 15 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ Login
</command>
</epp>
Logout without any parameters
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<command>
<logout/>
</command>
</epp>
Logout
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
Expand All @@ -44,6 +52,13 @@ Logout
</command>
</epp>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<command>
<logout/>
</command>
</epp>
Poll
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ The application listens on predefined TCP port for formatted EPP frames and tran
HTTP requests according to the following matrix. Application performs regex search for clTRID and an
XPATH search for command name. It does not check against any XSD schema.

| EPP Command | HTTP request | Parameters | Headers | Payload Type | Cookies |
|-------------|----------------------------------|---------------------|---------------------------------------------------------------------|----------------|---------|
| hello | `GET /epp_session_url/hello` | | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | | session |
| login | `POST /epp_session_url/login` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| logout | `POST /epp_session_url/logout` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| poll | `POST /epp_command_url/poll` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| check | `POST /epp_command_url/check` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| info | `POST /epp_command_url/info` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| create | `POST /epp_command_url/create` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| delete | `POST /epp_command_url/delete` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| renew | `POST /epp_command_url/renew` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| update | `POST /epp_command_url/update` | `raw_frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| ANY (error) | `GET /epp_error_url` | `msg, code, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | query params | session |
| EPP Command | HTTP request | Parameters | Headers | Payload Type | Cookies |
|-------------|----------------------------------|----------------------------|---------------------------------------------------------------------|----------------|---------|
| hello | `GET /epp_session_url/hello` | | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | | session |
| login | `POST /epp_session_url/login` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| logout | `POST /epp_session_url/logout` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| poll | `POST /epp_command_url/poll` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| check | `POST /epp_command_url/check` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| info | `POST /epp_command_url/info` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| create | `POST /epp_command_url/create` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| delete | `POST /epp_command_url/delete` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| renew | `POST /epp_command_url/renew` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| update | `POST /epp_command_url/update` | `raw_frame, frame, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | form/multipart | session |
| ANY (error) | `GET /epp_error_url` | `msg, code, clTRID` | SSL-CLIENT-CERT, SSL-CLIENT-S-DN-CN, User-Agent, X-Forwarded-for | query params | session |

Error route is used in case EPP frame is malformed.

Expand Down
5 changes: 4 additions & 1 deletion apps/epp_proxy/priv/test_backend_app/epp_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class EppServer < Roda
end

r.post "logout" do
render("session/logout")
# Additional check if passes empty frame
if r.params['frame']
render("session/logout")
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions apps/epp_proxy/src/epp_http_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ request_from_map(#{command := Command,
%% Return form data or an empty list.
request_body(?helloCommand, _, _) -> "";
request_body(_Command, RawFrame, nomatch) ->
{multipart, [{<<"raw_frame">>, RawFrame}]};
{multipart, [{<<"raw_frame">>, RawFrame}, {<<"frame">>, RawFrame}]};
request_body(_Command, RawFrame, ClTRID) ->
{multipart,
[{<<"raw_frame">>, RawFrame}, {<<"clTRID">>, ClTRID}]}.
[{<<"raw_frame">>, RawFrame}, {<<"frame">>, RawFrame}, {<<"clTRID">>, ClTRID}]}.

%% Return a list of properties that each represent a query part in a query string.
%% [{"user", "eis"}]} becomes later https://example.com?user=eis
Expand Down
2 changes: 2 additions & 0 deletions apps/epp_proxy/test/epp_http_client_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ command_request_builder_test_case(_Config) ->
"http://localhost:9292/command/create",
{multipart,
[{<<"raw_frame">>,"Some XML here"},
{<<"frame">>,"Some XML here"},
{<<"clTRID">>,"EE-123456789"}]},
[<<"session=Random; Version=1">>],
[{"User-Agent",<<"EPP proxy">>}], "create"},
Expand All @@ -74,6 +75,7 @@ registry_unreachable_test_case(_Config) ->
"http://localhost:9999/someurl",
{multipart,
[{<<"raw_frame">>,"Some XML here"},
{<<"frame">>,"Some XML here"},
{<<"clTRID">>,"EE-123456789"}]},
[<<"session=Random; Version=1">>],
[{"User-Agent",<<"EPP proxy">>}], "create"},
Expand Down

0 comments on commit e99733a

Please sign in to comment.