epics 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -19
- data/lib/epics/generic_upload_request.rb +4 -8
- data/lib/epics/version.rb +1 -1
- data/spec/upload_digest_spec.rb +24 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f51f635b331253de3ad314121ac6e0cf657a285415ae7811e986fb6e718649a4
|
|
4
|
+
data.tar.gz: 7889e2e42721731b46886fee4e47b20bdfb0b7a1ed892aace84886aa25edaf47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a9213441874971f2d932f36eb0032ef1ecc2063bc9567f5cd036c7dca596088e1e372caf3c10eb7ce0da749015781ad2838cc458433cbf684ecfacc5cc42e3f
|
|
7
|
+
data.tar.gz: 7deab543f728a21a132d63972ef8d8dcbfb659ff22ecccbf2e89f78c1b2666814475c89caace7b485168b08132a5c400bf030e2f1d34610cc6cd25c8e76dd836
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
### Unreleased
|
|
2
2
|
|
|
3
|
+
### 3.0.1
|
|
4
|
+
|
|
5
|
+
- [FIX] Upload order data was transmitted with all CR and LF removed, not as given. Any
|
|
6
|
+
content hashed by the caller no longer matched, so container uploads (e.g. `CCS`, `CDS`,
|
|
7
|
+
`C2S` with a `conxml` container whose `HashValue` covers the canonical pain message) were
|
|
8
|
+
rejected by the bank, and line breaks inside text values were lost. As in 2.x, the order
|
|
9
|
+
data is now sent unchanged and CR and LF are removed only to form the ES (electronic
|
|
10
|
+
signature) hash, as EBICS specifies; the bank removes them the same way before verifying.
|
|
11
|
+
This reverts the 3.0.0.rc1 entry "Upload order data is now normalized once"
|
|
12
|
+
|
|
3
13
|
### 3.0.0
|
|
4
14
|
|
|
5
15
|
- [FIX] H005 uploads were sent without `SignatureFlag` in `BTUOrderParams`, although they
|
|
@@ -38,6 +48,24 @@ rewrite of request building into builders/factories/handlers.
|
|
|
38
48
|
- [BREAKING] On H005, `Client#HAA` and `Client#order_types` return an array of service
|
|
39
49
|
hashes (`service_name`, `scope`, `service_option`, `container`, `msg_name`) instead of
|
|
40
50
|
an array of order-type strings
|
|
51
|
+
- [BREAKING] `XEK`, `YCT` and `ZSR` raise `Epics::VersionSupportError` on H003/H004
|
|
52
|
+
instead of `NotImplementedError`, matching every other version mismatch
|
|
53
|
+
- [BREAKING] `order_id:` is validated against the EBICS `OrderIDType` range (`A000` to
|
|
54
|
+
`ZZZZ`). Values below `A000` rendered as e.g. `0002`, which violates the
|
|
55
|
+
`[A-Z][A-Z0-9]{3}` pattern; they now raise `ArgumentError`. The protocol form
|
|
56
|
+
(`order_id: 'A000'`) is accepted alongside the integer
|
|
57
|
+
- [BREAKING] Removed `Epics::Builders::MutableBuilder#add_receipt_code`, which emitted
|
|
58
|
+
`ReceiptCode` inside `mutable` where the schema does not allow it. `ReceiptCode`
|
|
59
|
+
belongs to `TransferReceipt`, which `TransferReceiptBuilder` already builds
|
|
60
|
+
- [BREAKING] Upload order data is now normalized once, on the way in, so the bytes
|
|
61
|
+
hashed for the electronic signature are the bytes transmitted. Until 3.0 the digest
|
|
62
|
+
was taken over the normalized document while the raw one was sent, which only
|
|
63
|
+
verifies against banks that normalize before checking the ES
|
|
64
|
+
- [BREAKING] Passing only one date-range bound (e.g. `client.STA(from)`) silently
|
|
65
|
+
omitted the range and fetched the bank's full retention window. Both bounds are
|
|
66
|
+
mandatory within `DateRange`, so this now raises `ArgumentError`
|
|
67
|
+
- [BREAKING] Removed `Epics::Services::CryptService#sign`, which had no callers and
|
|
68
|
+
disagreed with `#encrypt` on how an A005 signature is formed
|
|
41
69
|
|
|
42
70
|
**Fixes**
|
|
43
71
|
|
|
@@ -52,17 +80,12 @@ rewrite of request building into builders/factories/handlers.
|
|
|
52
80
|
when the key they need was not loaded; they now raise `Epics::MissingKeyError` naming
|
|
53
81
|
it. `#digest_valid?` no longer needs a key at all — it is a plain SHA-256 over the
|
|
54
82
|
authenticated nodes
|
|
55
|
-
- [BREAKING] Removed `Epics::Builders::MutableBuilder#add_receipt_code`, which emitted
|
|
56
|
-
`ReceiptCode` inside `mutable` where the schema does not allow it. `ReceiptCode`
|
|
57
|
-
belongs to `TransferReceipt`, which `TransferReceiptBuilder` already builds
|
|
58
83
|
- [FIX] Removed the `container_flag:` order parameter, which emitted a `ContainerFlag`
|
|
59
84
|
element that exists in no EBICS schema. The container is expressed by `Container`
|
|
60
85
|
with a `containerType` attribute, which `container_type:` already emits
|
|
61
86
|
- [ENHANCEMENT] Added the H005-only order types `XEK` (account statements as PDF),
|
|
62
87
|
`ZSR` (payment status reports) and `YCT` (multi-currency credit transfer). Their BTF
|
|
63
88
|
mappings existed in the V3 factory but had no order class or client method
|
|
64
|
-
- [BREAKING] `XEK`, `YCT` and `ZSR` raise `Epics::VersionSupportError` on H003/H004
|
|
65
|
-
instead of `NotImplementedError`, matching every other version mismatch
|
|
66
89
|
- [ENHANCEMENT] `XEK`, `ZSR`, `Z01`, `Z52`, `Z53` and `Z54` accept `scope:`,
|
|
67
90
|
`service_option:`, `msg_name_version:` and `container_type:`. Defaults are unchanged;
|
|
68
91
|
Swiss market practice requires a `Scope` and only `ZSR` sent one, so a bank-specific
|
|
@@ -74,11 +97,6 @@ rewrite of request building into builders/factories/handlers.
|
|
|
74
97
|
keyring slots, so a `host_id` that no longer matched the stored prefix destroyed the
|
|
75
98
|
bank's public keys on save. Unrecognised entries are now carried through unchanged,
|
|
76
99
|
and a warning names each one instead of the failure being swallowed
|
|
77
|
-
- [BREAKING] `order_id:` is validated against the EBICS `OrderIDType` range (`A000` to
|
|
78
|
-
`ZZZZ`). Values below `A000` rendered as e.g. `0002`, which violates the
|
|
79
|
-
`[A-Z][A-Z0-9]{3}` pattern; they now raise `ArgumentError`. The protocol form
|
|
80
|
-
(`order_id: 'A000'`) is accepted alongside the integer
|
|
81
|
-
|
|
82
100
|
- [FIX] `XCT` sent the wrong order type: `CD1` on H003/H004 and the DTAZV service on
|
|
83
101
|
H005, filing credit transfers as direct debits. It now sends `XCT` on H003/H004.
|
|
84
102
|
EBICS 3.0 defines no counterpart for XCT, so on H005 it raises
|
|
@@ -86,25 +104,16 @@ rewrite of request building into builders/factories/handlers.
|
|
|
86
104
|
- [FIX] The electronic signature over order data is again formed with line separators
|
|
87
105
|
removed, matching 2.x. The refactor had signed the raw document, changing the ES for
|
|
88
106
|
every upload
|
|
89
|
-
- [BREAKING] Upload order data is now normalized once, on the way in, so the bytes
|
|
90
|
-
hashed for the electronic signature are the bytes transmitted. Until 3.0 the digest
|
|
91
|
-
was taken over the normalized document while the raw one was sent, which only
|
|
92
|
-
verifies against banks that normalize before checking the ES
|
|
93
107
|
- [FIX] H005 `DataDigest` carried an RSA-PSS signature (256 bytes, non-reproducible)
|
|
94
108
|
instead of the SHA-256 hash of the order data
|
|
95
109
|
- [FIX] `Response#business_error?` treated every `01`-prefixed return code as
|
|
96
110
|
informational, reporting `011001` (negative acknowledgement) and `011101` (segment
|
|
97
111
|
number not reached) as success. It now uses an explicit allow-list
|
|
98
|
-
- [BREAKING] Passing only one date-range bound (e.g. `client.STA(from)`) silently
|
|
99
|
-
omitted the range and fetched the bank's full retention window. Both bounds are
|
|
100
|
-
mandatory within `DateRange`, so this now raises `ArgumentError`
|
|
101
112
|
- [FIX] `Time` and `DateTime` passed as date-range bounds rendered an `xs:dateTime`
|
|
102
113
|
with a local offset into an `xs:date` element; they are now coerced to a date
|
|
103
114
|
- [FIX] `C52` requested no container on H005 while `Client#C52` always unzips the
|
|
104
115
|
response, raising `Zip::Error`. `C52` and `C53` now default to a ZIP container and
|
|
105
116
|
both accept `container_type:` to override it
|
|
106
|
-
- [BREAKING] Removed `Epics::Services::CryptService#sign`, which had no callers and
|
|
107
|
-
disagreed with `#encrypt` on how an A005 signature is formed
|
|
108
117
|
- [FIX] `Epics::Client.setup` forwarded its block to `.new`, which yields before the
|
|
109
118
|
keys are generated, so the block saw an empty keyring and anything touching it —
|
|
110
119
|
`ini_letter`, `save_keys`, `INI`, `HIA` — failed. It now yields once the client is
|
|
@@ -3,21 +3,17 @@ class Epics::GenericUploadRequest < Epics::GenericRequest
|
|
|
3
3
|
|
|
4
4
|
def initialize(client, document, **options)
|
|
5
5
|
super(client, **options)
|
|
6
|
-
|
|
6
|
+
@document = document
|
|
7
7
|
aes_factory = Epics::Factories::Crypt::AesFactory.new
|
|
8
8
|
aes = aes_factory.create
|
|
9
9
|
@transaction_key = aes.key
|
|
10
10
|
@crypt_service = Epics::Services::CryptService.new
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
def document=(value)
|
|
16
|
-
@document = value.gsub(/\n|\r/, '')
|
|
17
|
-
end
|
|
18
|
-
|
|
13
|
+
# The ES hash excludes CR and LF; the bank strips them before verifying. The order
|
|
14
|
+
# data itself is transmitted unchanged.
|
|
19
15
|
def document_digest
|
|
20
|
-
@crypt_service.hash(document)
|
|
16
|
+
@crypt_service.hash(document.gsub(/\n|\r/, ''))
|
|
21
17
|
end
|
|
22
18
|
|
|
23
19
|
def to_transfer_xml
|
data/lib/epics/version.rb
CHANGED
data/spec/upload_digest_spec.rb
CHANGED
|
@@ -22,11 +22,18 @@ RSpec.describe 'upload order data digests' do
|
|
|
22
22
|
.not_to eq(OpenSSL::Digest.digest('sha256', document))
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
# Callers may hash the content themselves, e.g. a container's HashValue over the
|
|
26
|
+
# canonical message, so the transmitted order data must be the input as given.
|
|
27
|
+
it 'transmits the document unchanged' do
|
|
28
|
+
subject.transaction_id = 'ABC'
|
|
29
|
+
order_data = Nokogiri::XML(subject.to_transfer_xml)
|
|
30
|
+
.at_xpath('//e:OrderData', 'e' => 'urn:org:ebics:H004').text
|
|
31
|
+
compressed = Epics::Services::CryptService
|
|
32
|
+
.new
|
|
33
|
+
.decrypt_by_key(subject.transaction_key, Base64.decode64(order_data))
|
|
34
|
+
|
|
35
|
+
expect(document).to include("\n")
|
|
36
|
+
expect(Zlib::Inflate.inflate(compressed)).to eq(document)
|
|
30
37
|
end
|
|
31
38
|
|
|
32
39
|
it 'is identical for CRLF and LF encodings of the same document' do
|
|
@@ -56,6 +63,18 @@ RSpec.describe 'upload order data digests' do
|
|
|
56
63
|
.to eq(data_digest_of(order).text)
|
|
57
64
|
end
|
|
58
65
|
|
|
66
|
+
it 'transmits the document unchanged' do
|
|
67
|
+
order = Epics::CCT.new(client, document)
|
|
68
|
+
order.transaction_id = 'ABC'
|
|
69
|
+
order_data = Nokogiri::XML(order.to_transfer_xml).at_xpath('//e:OrderData', ns).text
|
|
70
|
+
compressed = Epics::Services::CryptService
|
|
71
|
+
.new
|
|
72
|
+
.decrypt_by_key(order.transaction_key, Base64.decode64(order_data))
|
|
73
|
+
|
|
74
|
+
expect(document).to include("\n")
|
|
75
|
+
expect(Zlib::Inflate.inflate(compressed)).to eq(document)
|
|
76
|
+
end
|
|
77
|
+
|
|
59
78
|
it 'is reproducible across two builds of the same document' do
|
|
60
79
|
expect(data_digest_of(Epics::CCT.new(client, document)).text)
|
|
61
80
|
.to eq(data_digest_of(Epics::CCT.new(client, document)).text)
|