diff --git a/Gemfile b/Gemfile
index 3c2ce0539..72ff366d7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'rails', '4.1.1'
+gem 'rails', '4.1.4'
# Use postgresql as the database for Active Record
gem 'pg'
diff --git a/Gemfile.lock b/Gemfile.lock
index 182f22969..c2a741f8b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,27 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.1.1)
- actionpack (= 4.1.1)
- actionview (= 4.1.1)
+ actionmailer (4.1.4)
+ actionpack (= 4.1.4)
+ actionview (= 4.1.4)
mail (~> 2.5.4)
- actionpack (4.1.1)
- actionview (= 4.1.1)
- activesupport (= 4.1.1)
+ actionpack (4.1.4)
+ actionview (= 4.1.4)
+ activesupport (= 4.1.4)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
- actionview (4.1.1)
- activesupport (= 4.1.1)
+ actionview (4.1.4)
+ activesupport (= 4.1.4)
builder (~> 3.1)
erubis (~> 2.7.0)
- activemodel (4.1.1)
- activesupport (= 4.1.1)
+ activemodel (4.1.4)
+ activesupport (= 4.1.4)
builder (~> 3.1)
- activerecord (4.1.1)
- activemodel (= 4.1.1)
- activesupport (= 4.1.1)
+ activerecord (4.1.4)
+ activemodel (= 4.1.4)
+ activesupport (= 4.1.4)
arel (~> 5.0.0)
- activesupport (4.1.1)
+ activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
@@ -94,19 +94,19 @@ GEM
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
- rails (4.1.1)
- actionmailer (= 4.1.1)
- actionpack (= 4.1.1)
- actionview (= 4.1.1)
- activemodel (= 4.1.1)
- activerecord (= 4.1.1)
- activesupport (= 4.1.1)
+ rails (4.1.4)
+ actionmailer (= 4.1.4)
+ actionpack (= 4.1.4)
+ actionview (= 4.1.4)
+ activemodel (= 4.1.4)
+ activerecord (= 4.1.4)
+ activesupport (= 4.1.4)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.1.1)
+ railties (= 4.1.4)
sprockets-rails (~> 2.0)
- railties (4.1.1)
- actionpack (= 4.1.1)
- activesupport (= 4.1.1)
+ railties (4.1.4)
+ actionpack (= 4.1.4)
+ activesupport (= 4.1.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
@@ -191,7 +191,7 @@ DEPENDENCIES
pg
pry
pry-byebug
- rails (= 4.1.1)
+ rails (= 4.1.4)
rspec-rails (~> 3.0.1)
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
diff --git a/app/controllers/concerns/epp/common.rb b/app/controllers/concerns/epp/common.rb
index 9a16b65fa..429c0100c 100644
--- a/app/controllers/concerns/epp/common.rb
+++ b/app/controllers/concerns/epp/common.rb
@@ -3,6 +3,7 @@ module Epp::Common
included do
protect_from_forgery with: :null_session
+ before_action :validate_request, only: [:proxy]
end
def proxy
@@ -25,4 +26,15 @@ module Epp::Common
def current_epp_user
@current_epp_user ||= EppUser.find(epp_session[:epp_user_id]) if epp_session[:epp_user_id]
end
+
+ def validate_request
+ xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
+ doc = Nokogiri::XML(params[:frame])
+ @extValues = xsd.validate(doc)
+ if @extValues.any?
+ @code = '2001'
+ @msg = 'Command syntax error'
+ render '/epp/error' and return
+ end
+ end
end
diff --git a/app/controllers/epp/errors_controller.rb b/app/controllers/epp/errors_controller.rb
index db4cd6c11..41990e4c6 100644
--- a/app/controllers/epp/errors_controller.rb
+++ b/app/controllers/epp/errors_controller.rb
@@ -2,6 +2,7 @@ class Epp::ErrorsController < ApplicationController
include Epp::Common
def error
+ @code, @msg = params[:code], params[:msg]
render '/epp/error'
end
end
diff --git a/app/views/epp/error.xml.builder b/app/views/epp/error.xml.builder
index f40075a05..7a34da289 100644
--- a/app/views/epp/error.xml.builder
+++ b/app/views/epp/error.xml.builder
@@ -1,9 +1,19 @@
xml.epp_head do
xml.response do
- xml.result('code' => params[:code]) do
- xml.msg(params[:msg], 'lang' => 'en')
+ xml.result('code' => @code) do
+ xml.msg(@msg, 'lang' => 'en')
end
end
+ @extValues.each do |x|
+ xml.extValue do
+ xml.value do
+ # xml.tag!()
+ xml.reason x.to_s
+ end
+ end
+
+ end if @extValues && @extValues.any?
+
xml << render('/epp/shared/trID')
end
diff --git a/doc/schemas/contact-1.0.xsd b/doc/schemas/contact-1.0.xsd
new file mode 100644
index 000000000..993a04450
--- /dev/null
+++ b/doc/schemas/contact-1.0.xsd
@@ -0,0 +1,387 @@
+
+
+
+
+
+
+
+
+
+
+ Extensible Provisioning Protocol v1.0
+ contact provisioning schema.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/schemas/epp-1.0.xsd b/doc/schemas/epp-1.0.xsd
new file mode 100644
index 000000000..1efc25947
--- /dev/null
+++ b/doc/schemas/epp-1.0.xsd
@@ -0,0 +1,443 @@
+
+
+
+
+
+
+
+
+
+ Extensible Provisioning Protocol v1.0 schema.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/schemas/eppcom-1.0.xsd b/doc/schemas/eppcom-1.0.xsd
new file mode 100644
index 000000000..d6ef94b24
--- /dev/null
+++ b/doc/schemas/eppcom-1.0.xsd
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ Extensible Provisioning Protocol v1.0
+ shared structures schema.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spec/epp/contact_spec.rb b/spec/epp/contact_spec.rb
index 8576caff5..563e5486d 100644
--- a/spec/epp/contact_spec.rb
+++ b/spec/epp/contact_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'
describe 'EPP Contact', epp: true do
- let(:server) { Epp::Server.new({server: 'localhost', tag: 'test', password: 'test', port: 701}) }
+ let(:server) { Epp::Server.new({server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701}) }
context 'with valid user' do
before(:each) { Fabricate(:epp_user) }
diff --git a/spec/epp/requests/contacts/create.xml b/spec/epp/requests/contacts/create.xml
index 054183e89..b2ec84a6f 100644
--- a/spec/epp/requests/contacts/create.xml
+++ b/spec/epp/requests/contacts/create.xml
@@ -1,24 +1,34 @@
-
-CID:TEST:10
-
-Test
-Test Street 11-2
-Test City
-123456
-EE
-
-
-+372.5555555
-test@test.com
-37812124567
-
-
-neka005#10-02-08at13:51:37
-
-
+
+
+
+
+
+ sh8013
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+ +1.7035555556
+ jdoe@example.com
+
+ 2fooBAR
+
+
+
+
+
+
+
+ ABC-12345
+
+
diff --git a/spec/epp/requests/login.xml b/spec/epp/requests/login.xml
index 44ea0eabd..0f7b96606 100644
--- a/spec/epp/requests/login.xml
+++ b/spec/epp/requests/login.xml
@@ -2,20 +2,20 @@
- test
- test
+ gitlab
+ ghyt9e4fu
1.0
en
- http://www.nic.cz/xml/epp/contact-1.6
- http://www.nic.cz/xml/epp/nsset-1.2
- http://www.nic.cz/xml/epp/domain-1.4
- http://www.nic.cz/xml/epp/keyset-1.3
-
+ urn:ietf:params:xml:ns:contact-1.0
+
+
+
+
wgyn001#10-02-08at13:58:06
diff --git a/spec/fabricators/epp_user_fabricator.rb b/spec/fabricators/epp_user_fabricator.rb
index 8336c81bd..2631a3147 100644
--- a/spec/fabricators/epp_user_fabricator.rb
+++ b/spec/fabricators/epp_user_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:epp_user) do
- username 'test'
- password 'test'
+ username 'gitlab'
+ password 'ghyt9e4fu'
registrar
active true
end
diff --git a/spec/support/epp.rb b/spec/support/epp.rb
index 798f63a64..a1c3b2282 100644
--- a/spec/support/epp.rb
+++ b/spec/support/epp.rb
@@ -5,21 +5,30 @@ module Epp
# handles connection and login automatically
def epp_request filename
- res = Nokogiri::XML(server.request(read_body(filename)))
- parse_response(res)
+ begin
+ parse_response(server.request(read_body(filename)))
+ rescue Exception => e
+ e
+ end
end
def epp_plain_request filename
- res = Nokogiri::XML(server.send_request(read_body(filename)))
- parse_response(res)
+ begin
+ parse_response(server.send_request(read_body(filename)))
+ rescue Exception => e
+ e
+ end
end
- def parse_response res
+ def parse_response raw
+ res = Nokogiri::XML(raw)
+
{
result_code: res.css('epp response result').first[:code],
msg: res.css('epp response result msg').text,
clTRID: res.css('epp trID clTRID').text,
- parsed: res.remove_namespaces!
+ parsed: res.remove_namespaces!,
+ raw: raw
}
end