Commit graph

41 commits

Author SHA1 Message Date
Peter Taoussanis
e554dbb1c5 Fix tests path 2020-07-24 17:09:58 +02:00
Peter Taoussanis
23276ac910 [#101] NB Change default encryption from AES-CBC to AES-GCM
Why?

  - AES-GCM is faster and can be more secure, Ref. https://goo.gl/Dsc9mL, etc.
  - AES-GCM is an authenticated[1] encryption mechanism, providing
    automatic integrity checks. This is relevant to [#101].

What's the issue with #101?

  - We    compress then encrypt    on freeze ; Reverse would make compression useless
  - So we decrypt  then decompress on thaw

Attempting CBC decryption with the wrong password will often but not
*always* throw. Meaning it's possible for decompression could be
attempted with a junk ba. And this can cause some decompressors to
fail in a destructive way, including large allocations (DDoS) or even
taking down the JVM in extreme cases.

Possible solutions?

  - We could add our own HMAC, etc.
  - And/or we could use something like AES-GCM which offers built-in
    integrity and will throw an AEADBadTagException on failure.

There may indeed be reasons [2,3,4] to consider adding a custom HMAC -
and that's still on the cards for later.

But in the meantime, the overall balance of pros/cons seems to lean
in the direction of choosing AES-GCM as a reasonable default.

Note that the change in this commit is done in a backward-compatible
way using Nippy's versioned header: new payloads will be written using
AES-GCM by default. But old payloads already written using AES-CBC will
continue to be read using that scheme.

References
  [1] https://en.wikipedia.org/wiki/Authenticated_encryption
  [2] https://www.daemonology.net/blog/2009-06-24-encrypt-then-mac.html
  [3] https://blog.cryptographyengineering.com/2011/12/04/matt-green-smackdown-watch-are-aead/
  [4] HMAC vs AEAD integrity,           https://crypto.stackexchange.com/q/24379
  [5] AES-GCM vs HMAC-SHA256 integrity, https://crypto.stackexchange.com/q/30627
2019-01-06 14:13:34 +01:00
Isak Sky
abb55da29e [#113 #114] Support object arrays (@isaksky) 2019-01-06 12:24:29 +01:00
Peter Taoussanis
1a8a44286a [#93] Pickup record redefinitions at REPL, etc. (@smee) 2017-12-21 10:12:33 +01:00
Peter Taoussanis
3d8bc0eee1 Experimental: add cache metadata support 2016-07-17 15:42:41 +07:00
Peter Taoussanis
4c647465f5 Encryption: micro optimizations, housekeeping 2016-05-09 14:05:02 +07:00
Peter Taoussanis
c85329fe05 Cache housekeeping (incl. tests, switch to volatiles) 2016-04-14 12:16:51 +07:00
Peter Taoussanis
5849320d3a Drop Expectations, migrate to clojure.test, update test.check stuff 2015-12-01 14:56:41 +07:00
Peter Taoussanis
3479ddad00 Clean up thaw fallback behaviour, decrease number of fallback cases 2015-10-06 17:56:15 +07:00
Peter Taoussanis
e71df20a42 Tests: re-enable decryption tests with invalid passwords 2015-10-06 13:07:42 +07:00
Peter Taoussanis
998dabc195 NB: refactor freezing utils for easier use by libs + custom extensions, etc. 2015-09-30 12:29:05 +07:00
Peter Taoussanis
da77b3d582 NB: Remove (long-deprecated) freezing legacy mode 2015-09-30 12:29:04 +07:00
Peter Taoussanis
53d993e132 Tests housekeeping 2015-09-30 11:57:46 +07:00
Peter Taoussanis
f1af76635a Project.clj housekeeping, drop support for Clojure 1.4
Clojure 1.4 support is becoming more and more hassle; not worth it
2015-09-30 11:57:46 +07:00
Peter Taoussanis
1ba3c38ab2 Update benchmarks 2015-09-14 20:12:11 +07:00
Peter Taoussanis
b42aff9cc9 [#68] NB hotfix: encryption thread safety 2015-09-14 16:58:02 +07:00
Peter Taoussanis
9e60939848 EXPERIMENTAL: Support keyword-id extensions (#50) 2014-07-06 13:25:08 +07:00
Peter Taoussanis
20b1c2b1d2 Encode compression type in Nippy header, major refactor/housekeeping
Housekeeping includes:
  * Importing useful encryption+compression stuff into primary ns
    for lib consumers.
  * Promoting a number of things from Alpha status.
  * Exceptions are now all `ex-info`s.
  * Simplification of `thaw` API: Nippy v1 support is now automatic
    & configuration-free (performance impact in most cases is negligible).
2014-04-29 23:10:26 +07:00
Peter Taoussanis
b7a454a9c8 EXPERIMENTAL: Make LZ4 the default Nippy compressor (back-compatible for header'ed data) 2014-04-29 23:10:26 +07:00
Peter Taoussanis
66333155c9 simple-check -> test.check 2014-02-28 21:01:20 +07:00
Peter Taoussanis
54389cc3a0 NB migrate utils stuff to encore lib 2014-02-23 19:15:55 +07:00
Peter Taoussanis
557cf2eda7 Add simple-check based roundtrip test 2014-02-16 18:49:45 +07:00
Peter Taoussanis
e580fc6b2b Experimental: add prop-based tests for bijective val->bin mapping 2014-01-22 14:01:27 +07:00
Peter Taoussanis
42950ec24a Add stress-data-comparable, stress-data-benchable 2014-01-21 14:55:50 +07:00
Peter Taoussanis
8f8ab99e95 Add some Serializable tests (exceptions) 2013-10-24 13:55:47 +07:00
Peter Taoussanis
c58bf97af7 Move Record test into stress data 2013-10-24 13:55:47 +07:00
Peter Taoussanis
3879cf4d62 Add experimental LZMA2 compressor for higher compression ratios than Snappy 2013-10-19 15:37:38 +07:00
Peter Taoussanis
a76734a25a Housekeeping, add test for records with custom extension 2013-08-07 17:30:13 +07:00
James Reeves
6ab00df42c Add fast serialization for records 2013-08-06 17:56:43 +01:00
Peter Taoussanis
4071d0f3ec Switch to simpler extend-freeze, extend-thaw custom type API (ALPHA) 2013-08-02 21:28:51 +07:00
Peter Taoussanis
c2a964932c Add custom-freezer macro for easier Freezable extension 2013-08-02 15:04:11 +07:00
Peter Taoussanis
99091b0a32 Add support for custom thaw readers 2013-07-29 16:43:29 +07:00
Peter Taoussanis
a84d3de7f6 Add before-run, after-run Expectations fns 2013-06-26 14:44:27 +07:00
Peter Taoussanis
c8c0b99ae2 Update benchmarks (2.0.0-alpha6 w/fast io-streams) 2013-06-17 15:12:18 +07:00
Peter Taoussanis
559c73abef Fix core dump issue (important), simplify API
PROBLEM: :legacy-mode :auto/true thawing was resulting in JVM core
dumps when attempting to use Snappy to decompress encrypted data.

CAUSE: The org.iq80.snappy implementation seems to choke on the
random IV byte data being generated by the AES128 encrypter. This
may or may not be a bug (still awaiting feedback from lib's authors).

SOLUTION: We're only susceptible to this issue when trying to
decompress data that is: a) encrypted, b) being thawed in legacy mode.
In particular, we're _not_ susceptible to this issue when thawing
in non-legacy mode because in that case we have a header explicitly
warning us that the data is encrypted.

An obvious work-around, therefore, is just to disable decryption when
attempting to thaw legacy-mode data. In practice this isn't a problem
because older versions of Nippy didn't support encryption anyway.
2013-06-16 19:33:23 +07:00
Peter Taoussanis
c42457a48c Housekeeping, new keyword implementation (mpenet) 2013-06-14 17:52:25 +07:00
Peter Taoussanis
15dd24ac06 Add :auto legacy mode for _full_, transparent backwards-compatibility 2013-06-13 19:01:57 +07:00
Peter Taoussanis
8d48ec9d75 NB: Simpler, more flexible API (backwards-compatible) 2013-06-13 16:41:54 +07:00
Peter Taoussanis
9734e882bb Swap repeatedly -> utils/repeatedly* (faster) 2013-06-13 11:45:45 +07:00
Peter Taoussanis
da077c6a54 Drop Clojure 1.3 support 2013-06-13 11:45:45 +07:00
Peter Taoussanis
6fe433b579 Update tests, migrate to Expectations lib 2013-06-13 11:45:44 +07:00