Commit Graph

168 Commits

Author SHA1 Message Date
Simon Michael
66619803b7 ;pkg: bump version to 1.24.99 2021-12-01 22:16:37 -10:00
Simon Michael
387325b59e ;pkg: bump version to 1.24 2021-12-01 17:16:28 -10:00
Simon Michael
69905dbc25 ;pkg: allow megaparsec 9.2 2021-10-03 22:55:10 -10:00
Simon Michael
8934c115bd ;pkg: bump version to 1.23.99 2021-09-24 12:22:15 -10:00
Simon Michael
19950df745 ;pkg: bump version to 1.23 2021-09-21 15:34:23 -10:00
Arsen Arsenović
9ce55146c8 fix: web: b64 encode user controlled input (#1525)
This fixes a reported Stored XSS vulnerability in toBloodhoundJson by
encoding the user-controlled values in this payload into base64 and
parsing them with atob.

In my exploration of the vulnerability with various payloads I and
others crafted, it would appear that this is the only available XSS in
hledger-web in relation to stored accounts and transaction details. If
there is other parts of the UI which may contain user-controlled data,
they should be examined for similar things. In this instance,
protections provided by yesod and other libraries worked fine, but in a
bit of code that hledger-web was generating, the user could insert a
</Script> tag (which is valid HTML and equivalent to </script> but not
caught by the T.Replace that existed in toBloodhoundJson) in order to
switch out of a script context, allowing the parser to be reset, and for
arbitrary JavaScript to run.

The real fix is a bit more involved, but produces much better results:
Content-Security-Policy headers should be introduced, and using
sha256-<hash of script> or a different algorithm, they should be marked
as trusted in the header. This way, if the (in-browser) parser and
hledger-web generator disagree on the source code of the script, the
script won't run. Note that this would still be susceptible to attacks
that involve changing the script by escaping from the string inside it
or something similar to that, which can be avoided additionally by using
either the method used in this commit, or a proper JSON encoder.

The second approach has the advantage of preventing further XSS, to the
extent specified above, in practice, a combination of both should be
used, b64 for embedded data and the CSP sha256-hash script-src over
everything else, which will eliminate all injected or malformed script
blocks (via CSP), in combination with eliminating any HTML closing tags
which might occur in stored data (via b64).

This vulnerability appears to have been first introduced when
autocompletion was added in hledger-web, git tag hledger-0.24, commit
hash: ec51d28839

Test payload: </Script><svg onload=alert(1)//>

Closes #1525
2021-08-24 05:04:12 -10:00
Simon Michael
f51ea92cfc deps: require base >=4.11, prevent red squares on hackage matrix
We officially support GHC 8.6+ (and 8.8+ for hledger-web) now.
Hackage matrix builder shows all packages building successfully
with GHC 8.4+, somehow, so we'll adjust the base bound to
allow that but prevent any attempts to build with older GHCs,
2021-08-03 21:05:02 -10:00
Simon Michael
2a39497e21 pkg: add tested-with GHC 9.0.1 2021-08-03 20:52:05 -10:00
Simon Michael
6665ddfb9b ;pkg: bump version to 1.22.99 2021-08-03 00:24:20 -10:00
Simon Michael
9aac520edd deps: allow megaparsec 9.1 2021-07-20 20:38:39 -10:00
Simon Michael
544450f557 ;bump version to 1.22 2021-06-28 22:37:47 -10:00
Simon Michael
58b481ca5b stack: updated tested-with to 8.6+ 2021-06-03 14:07:39 -10:00
Felix Yan
684af10643 Allow yesod-form 1.7
Builds fine and all tests pass here.
2021-04-23 10:15:27 -10:00
Simon Michael
ba1e91c302 drop support for GHC 8.0
Prior to this commit,
- hledger still builds with GHC 8.0
- hledger-ui does if you use the build plan specified by stack8.0.yaml,
  but you are likely to hit problems if you let cabal pick one
  (https://github.com/jtdaugherty/vty/issues/198 and others)
- hledger-web might, if you could find the right build plan

The hassles are enough and GHC 8.0 is old enough (first released in
2016) that I'm letting it go; 8.2 is the new minimum version for all
hledger packages.

This allows a bunch of cleanups to conditional imports, which I leave
for later.

Also, updated the tested-with minor versions.
2021-04-04 07:54:22 -10:00
Simon Michael
4e644840bc lib, etc: add now-required lower bound on containers (#1514) 2021-03-29 08:19:28 -07:00
Simon Michael
36cbc2b068 bump base upper bound to allow GHC 9.0 2021-03-12 06:58:46 -08:00
Simon Michael
e050790d4c ;bump version to 1.21.99 2021-03-10 13:50:49 -08:00
Simon Michael
eeddfc2509 ;bump version to 1.21 2021-03-10 08:24:58 -08:00
Simon Michael
9087532b62 ;bump version to 1.20.99 2020-12-14 11:28:07 -08:00
Simon Michael
1856ca5312 web: bump to 1.20.1; update manuals' dates 2020-12-06 18:20:56 -08:00
Simon Michael
2501329f3c ;bump version to 1.20 2020-11-30 15:18:24 -08:00
Simon Michael
ee73a6aabf web: --test [-- HSPECARGS] runs the test suite 2020-11-16 14:02:16 -08:00
Simon Michael
3651a5f5f4 ;web: tests: refactor, add a test for --forecast (#1390) 2020-11-13 16:40:33 -08:00
Simon Michael
c7e267e314 ;web: begin work on a forecasting test (#1390) 2020-11-13 09:42:06 -08:00
Simon Michael
290428f9d4 web: re-enable the test suite; add a test for /journal (#1390) 2020-11-13 09:37:56 -08:00
TANIGUCHI Kohei
906da6e6bd Fix hledger-web description
Slashes need to be escaped or they introduce unexpected italic style
due to Haddock markup.
2020-10-22 00:33:47 -07:00
legrostdg
1dfc7e1116
web: Put session file in $XDG_DATA_DIR. (#1344)
* web: Put session file in $XDG_DATA_DIR.

* web: Use $XDG_CACHE_HOME instead of $XDG_DATA_HOME.

* web: Force minimum version of directory (needed for xdg utilities).

* web: Cancel changes to hledger-web.cabal

Co-authored-by: Félix Sipma <felix.sipma@no-log.org>
2020-09-10 08:37:33 -07:00
Simon Michael
a151bcaec7 ; bump hledger-lib, hledger, hledger-ui, hledger-web version to 1.19.99 2020-09-07 12:16:12 -07:00
Felix Yan
c6f33cc824 Remove redundant semigroups dependency 2020-09-07 12:12:46 -07:00
Simon Michael
8599eda37c allow megaparsec 9 2020-09-07 11:41:57 -07:00
Simon Michael
3170cc7cbd bump version to 1.19 2020-09-01 20:27:17 -07:00
Simon Michael
e090e0f949 add lower bound needed for aeson, to help cabal (#1268) 2020-06-23 14:55:42 -07:00
Simon Michael
24996caaeb bump to dev version 2020-06-21 10:35:52 -07:00
Simon Michael
b389ee98dd ;update tested-with 2020-06-07 11:59:36 -07:00
Simon Michael
19020939c9 ;bump versions to 1.18 2020-06-06 17:18:15 -07:00
Henning Thielemann
c35d0a8b44 ;web: transaction fragments: use numeric identifiers for journal files
This saves us from any escaping issues.
2020-05-25 10:02:39 -07:00
Simon Michael
c6951bf7c6 ;doc: more tweaks to package readmes, hackage descriptions 2020-03-22 10:49:02 -07:00
Simon Michael
9ca8d7cea9 ;update tested-with 2020-03-22 09:27:50 -07:00
Simon Michael
617c2ecbc5 ;doc: consistent markdown readmes for packages 2020-03-22 09:07:47 -07:00
Simon Michael
96b4f0be4f require newer Decimal, math-functions, fixing inconsistent rounding
Decimal 0.5.1+ changed to banker's rounding (round to nearest even
number), and math-functions 0.3.3.0 (used by roi) fixed various
precision-related issues. Now we require the latest versions of these.
This was causing some functional test failures when building with old
GHCs/snapshots.
2020-03-19 10:10:55 -07:00
Simon Michael
1883ff4499 bump to dev version 2020-03-07 15:06:18 -08:00
Simon Michael
ba44d00bed ;bump version to 1.17 2020-03-01 17:29:01 -08:00
Simon Michael
889767f1bd ;bump tested-with
[ci skip]
2020-03-01 17:28:43 -08:00
Simon Michael
7011160bfd ;allow base 4.14/GHC 8.10 2020-01-26 08:12:25 -08:00
Amarandus
76ffaca466 web: Add IPv6 and hostname support
This commit introduces IPv6 support (and thus closes #1145).
It also allows using local hostnames as a parameter for --host.
For this, multiple things needed to be changed:

 - checkWebOpts is dropped, as the supplied parameter is checked later
 by Network.Socket.getAddrInfo
 - defbaseurl needs to check if : is used in the host, as this indicates
 the usage of an IPv6 address. In this case, the host needs to be
 wrapped in [] for the base URL
 - To allow opening such a modified base URL, runHostPortFullUrl is used
 instead of runhostPortUrl, as it allows opening arbitrary URLs instead
 of a path prefixed with http://127.0.0.1

As checking the host for validity is postponed until the webserver tries
to start, an invalid hostname leads to an exception caused by
Network.Socket.getAddrInfo.
This is still fine, as hledger-web won't start in an undefined state, but
will terminate with a nonzero exit code.
2020-01-17 13:18:51 -08:00
Simon Michael
445e8aa3cc add support for megaparsec 8 (#1175) 2020-01-14 09:54:06 -08:00
Carl Richard Theodor Schneider
72acd7c22a web: Add option --socket to use UNIX socket file
This commit adds the --socket option to use hledger-web over an AF_UNIX socket
file.
It allows running multiple instances of hledger-web on the same system without
having to manually choose a port for each instance, which is helpful for running
individual instances for multiple users. In this scenario, the socket path is
predictable, as it can be derived from the username.

It also introduces the following dependencies:

 - network
   - Used to create the unix domain socket
 - unix-compat
   - Used to identify if the socket file is still a socket, to reduce the risk
     of deleting a file when cleaning up the socket
2020-01-12 16:15:37 -08:00
Simon Michael
cfb2a61ae1 ;bump to dev version; bump man page dates
[ci skip]
2020-01-05 09:04:50 -08:00
Stephen Morgan
74778efcf5 Use nubSort instead of nub . sort. 2020-01-04 08:31:10 -08:00
Simon Michael
46d516e7a3 move JSON instances from hledger-web to hledger-lib 2019-12-16 17:17:00 -08:00