229 Commits
Author SHA1 Message Date
clonedArtie 02c7c9c960 Added scanorganic schema to settings 2026-06-17 15:03:26 +02:00
clonedArtie e32d3ecbd2 Sync with master (#238) 2026-06-17 14:59:35 +02:00
Athanasius 6a514d3bae Gateway: Improve the new logging elements
* There are different source-keys for much of this.
* Have game_version *then* game_build.
* Where a message doesn't have a relevant field, set to '-'.
2023-01-19 16:01:53 +00:00
Athanasius d983a6c806 Gateway: Expand logging on Accepted or Validation Error 2023-01-19 15:29:57 +00:00
Athanasius 7f7b462790 Setttings: Update for fcmaterials_journal and fcmaterials_capi now 2022-09-02 16:30:18 +01:00
Athanasius 2d2a205c7a schemas: New fcmaterials/1 based on the *Journal* data source only 2022-08-30 17:23:00 +01:00
Athanasius ff83ede948 Gateway: Remove all form-encoded support
This causes issues, at the least, with compressed messages that 'look' like
they decompressed body is form-encoded.  18385 messages in the last month
rejected due to this.

No actually valid form-encoded messages in that time frame.
2022-06-16 13:27:11 +01:00
Athanasius 56b4e20238 Settings.py: Add missing / for fsssignaldiscovered/1 schema 2022-06-15 14:03:02 +01:00
norohind 912fa0e064 WIP: FSSSignalDiscovered event support 2022-06-13 22:35:58 +03:00
Gareth Harper b9e624a351 make gateway use new schema 2022-05-25 14:39:55 +00:00
Athanasius 8db880f95d schemas/FSSAllBodiesFound: Don't list in outdated schemas 2022-01-28 17:29:11 +00:00
robbyxp1 d4e7409ae0 Add to settings.py the fssallbodiesfound schemas 2022-01-28 17:29:11 +00:00
robbyxp1 3b7c002b51 Add schema to settings 2022-01-28 08:14:45 +00:00
Athanasius 8d5b03915b Gateway: Log where upload data is form-encoded
We suspect no-one is actually using this possible form of upload, and
ideally would remove the code for it entirely.  First we need to log any
uploaders that do use this form to be sure.
2022-01-18 15:53:06 +00:00
Athanasius 8f7910a5d9 Bouncer: Support --loglevel <level> CL arg
This also aligns the general logger setup with the other scripts
2022-01-18 15:22:02 +00:00
Athanasius 6986af7ca0 Settings.py: Remove import argparse
CL arg parsing is done in main scripts now.
2022-01-18 15:17:45 +00:00
Athanasius fe214583aa Relay: Support --loglevel <level> fully
There's no real logging in Relay yet, but this makes it support
switching level anyway.
2022-01-18 15:16:32 +00:00
Athanasius 86b283f920 Monitor.py: Minimal changes to allow --loglevel <level>
The CL arg won't actually *do* anything yet, because this script doesn't
actually have a logger set up at all.  But we need to fake this else
eddn.conf.Settings.loadConfig() won't be called correctly or work.
2022-01-18 15:09:56 +00:00
Athanasius fb3c0348ad Gateway: Support --loglevel <level> CL arg
NB: This required changes to src/eddn/conf/Settings.py as well, which
means other scripts, e.g. Monitor.py, will also need changing.
2022-01-18 15:02:38 +00:00
Athanasius abcf472197 Gateway: Revert non-gzip form encoded check
Fixes the regression identified in #165

However the gzip code path can still erroneously think a decompressed
request body is form encoded when it is not.  This happens when any text
in the decompressed body matches the regex:

        .+=[^\&;]*

i.e. some text, followed by `=`, and then some more text, possibly
empty, followed by an ampersand `&`, or semi-colon `;`, or the end of the
string.

`&` and `;` are used to separate key=value pairs in form encoding, the
`=` separates a key from its value.
2022-01-11 15:06:02 +00:00
Athanasius ccde820ba7 Gateway/errors: 'Schema Validation' properly tagged and documented 2022-01-09 16:02:28 +00:00
Athanasius e111fb8415 Gateway/errors: Outdate Schema: Tweak message and document 2022-01-09 15:48:27 +00:00
Athanasius e931bfff96 Gateway/errors: MalformedUploadError isn't raised upon JSON issue 2022-01-09 15:45:56 +00:00
Athanasius 4da60215f0 Gateway/errors: Tag FAIL if a zlib.error 2022-01-09 15:43:12 +00:00
Athanasius 8edae919e2 Gateway/errors: Call out if FAIL is specifically on JSON parsing 2022-01-09 15:38:29 +00:00
Athanasius 10d70bfe77 Gateway: Properly report 'not compressed, badly form-encoded' to uploaders
* This code worked if the request was *properly* form-encoded, with a
'data' key whose value was a valid message.

* It failed to detect where the request was form-encoded, with without a
'data' key.  It would just assume 'not form-encoded' in that case, then
fail later on JSON parsing.

Thus, re-use the `urlparse.parse_qs()` check for form-encoded format.
This passes:

  1. Properly, `data` key, form-encoded with valid value is fully JSON
  parsed, schema checked and accepted.
  2. *NOT* compressed *or* form-encoded valid message is properly parsed
  and accepted.
  2. Uncompressed, form-encoded, but no `data` key correctly returns the
  same error status and body as the compressed+form-encoded+no data key
  path.
2022-01-07 16:45:37 +00:00
Athanasius 872af7f594 Gateway: Properly report 'badly form encoded' to uploaders
This currently only applies if the data was also, validly, compressed.
2022-01-07 16:32:10 +00:00
Athanasius 10b12cf74b Gateway: Properly report zlib.decompress() errors to uploaders
This also adds some debug/error logging to the code path.
2022-01-07 16:04:00 +00:00
Athanasius 1134a6c9b4 Gateway: Only log first 512 characters of invalid JSON
Don't want to spam the logs with up to 1MiB per bad message.
2022-01-06 17:39:01 +00:00
Athanasius 9f219da6a6 Gateway: Expand on logging for interpretation of errors
This includes logging the *full* (uncompressed) message if it fails to
parse as JSON.
2022-01-06 17:36:39 +00:00
Athanasius 1371f71217 Gateway: Set up proper logger formatting
For some reason the milliseconds portion of the %S timestamp is using a
comma for decimals separator, despite 'locale' saying we're set to (US)
English.  /tableflip
2022-01-06 14:06:59 +00:00
Athanasius 377bdd3833 Gateway: Add logging per Accepted request
Actually some logging was already there, just the logger had never been
set up properly, but then I decided to make the format of this message
more useful.
2022-01-06 13:54:33 +00:00
Athanasius 0e80c76cb5 Gateway: Set bottle request limit to 1MiB 2022-01-06 13:07:53 +00:00
Athanasius 1b290ff53d Validator: Specify *which* schema failed to load 2021-10-14 14:00:14 +00:00
Athanasius bfdba0699e Settings.py: Add new schemas to GATEWAY_JSON_SCHEMAS 2021-09-23 18:34:11 +00:00
Athanasius ad56800822 Bouncer: Use Settings.py, and thus override files, rather than hard-coded 2021-07-10 10:30:05 +00:00
Athanasius 579e185b86 Bouncer: Minor docs edit & remove un-needed Validator import 2021-07-08 20:37:41 +00:00
Athanasius 555c9dd813 Bouncer: Accept messages as if a Gateway, but then forward them to another
This is to be used during migration, running on the old host so as to
forward all messages to the new Gateway.

The destination is hard-coded in `LIVE_GATEWAY_URL`.
2021-07-08 12:16:50 +00:00
Athanasius 1df2fb749b Relay: Add missing from bottle import ..., request, ... 2021-07-02 17:07:46 +00:00
Athanasius 1e9edf94f7 Relay: app.-ise and CORS-ise
* Use the "make an explicit Bottle() and use it" change.
* Use app.route with OPTIONS in method= list.
* Remove extraneous setting of Access-Control-Allow-Origin header.
2021-07-02 17:02:53 +00:00
Athanasius 9359b78301 Gateway: Correct methodS to singular & remove extraneous header
* methods != method
* There shouldn't be any need to manually set
  Access-Control-Allow-Origin headers now.
2021-07-02 17:02:07 +00:00
Athanasius a8b3fc33e1 Monitor: Forgot the app.install(EnableCors()) 2021-07-02 16:57:06 +00:00
Athanasius 1feb7c2dee Monitor: Converted to app. including CORS handler 2021-07-02 16:54:37 +00:00
Athanasius 2eb8a9fb88 Gateway: Implement a CORS plugin for all routes
* Switches all of the routes to use .route(..., method=[...]) so as to
  include OPTIONS as well as either POST or GET.
2021-07-02 16:32:19 +00:00
AnthorNet e4bc72abe9 Remove GA 2020-07-06 14:24:09 +02:00
Athanasius 6d9942ece0 Switch bottle to using an 'app' instance.
This fixes the problem I was having (on two separate machines, Debian
stretch and Debian buster) with the Gateway not actually sending
messages out port 8500 to the Relay and Monitor.
  Something about the '@thing' syntax, or using bare 'run()' must be
interfering with zmq.green.  The latter ends up thinking there are no
active/matching sockets to send to[0], despite the sockets definitely
being there (complete with TCP 3-way handshake visible on tcpdump
output).
  With the problem:

	* no network traffic was observed on port 8500.
	* A test sender.send(...) just before the bottle run() call
	  *did* send the message.  A similar test at the start of the
	  @post('/upload/') function did not succeed.

[0] - I ended up putting debug prints in both python-zmq and the zeromq
'libzmq' libraries, building the Debian packages and installing those
versions.  I also ended up using 'gdb' on the process.  The end result
of this was to find that the _matching variable (a count of matching
sockets I think) was empty deep in libzmq, when it should be counting
sockets to send to.
  This was specifically in zeromq3-4.3.1/src/dist.cpp, in the
void zmq::dist_t::distribute (msg_t *msg_) function.  The immediate:

	    if (_matching == 0) {

test was true.  I didn't manage to track down which bit of libzmq code
should have been setting _matching before I 'recursed back up' the call
chain to investigate other things.
2019-10-05 11:23:41 +01:00
AnthorNet b21bdf76e5 Merge pull request #90 from Marginal/tidy
Remove redundant editing of journal faction info and clean up duplicate detection code
2019-04-29 15:32:55 +02:00
AnthorNet 9484f4646a Fix for UTF8 uploader 2019-04-29 15:31:10 +02:00
AnthorNet 1150a72b47 Remove uploader from monitor 2019-01-12 10:22:39 +01:00
Jonathan Harris be7fcc2c05 Remove redundant cleanup of journal faction info
Clean up duplicate detection code
2019-01-08 18:58:41 +00:00