monit-docker 0.0.74__tar.gz → 0.0.76__tar.gz
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.
- {monit_docker-0.0.74/monit_docker.egg-info → monit_docker-0.0.76}/PKG-INFO +1 -1
- monit_docker-0.0.76/RELEASE +1 -0
- monit_docker-0.0.76/VERSION +1 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/audit.md +32 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/__init__.py +1 -1
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/audit.py +37 -28
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/audit_query.py +2 -2
- {monit_docker-0.0.74 → monit_docker-0.0.76/monit_docker.egg-info}/PKG-INFO +1 -1
- {monit_docker-0.0.74 → monit_docker-0.0.76}/setup.yml +2 -2
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_audit.py +24 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_audit_query.py +33 -0
- monit_docker-0.0.74/RELEASE +0 -1
- monit_docker-0.0.74/VERSION +0 -1
- {monit_docker-0.0.74 → monit_docker-0.0.76}/LICENSE +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/MANIFEST.in +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/README.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/bin/monit-docker +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/access-checks.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/alerts.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/architecture.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/check-config.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/compose.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/cron.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/dockerhub.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/dwho-http-notifications.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/filesystems.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/grafana.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/healthchecks.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/images/grafana-cpu.png +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/images/grafana-network.png +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/images/grafana-overview.png +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/index.rst +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/maintenance.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/metrics.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/notifications.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/pypi.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/redis-notifications.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/restart-limit.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/runtime-checks.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/scenarios.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/serve.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/simple.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/trigger-delay.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/troubleshooting.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/docs/ui.md +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/grafana/monit-docker.json +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alertmanager.email-slack.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alertmanager.email.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alertmanager.redis.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alertmanager.slack.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alerts.runtime.test.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alerts.runtime.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alerts.test.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alerts.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/compose.audit.yaml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/compose.notifications.yaml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/compose.redis.yaml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/compose.yaml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/dwho-http/http.json +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/dwho-http/http.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/dwho-http/payload.json +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/dwho-http/send.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/grafana/dashboards.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/grafana/datasources.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/prometheus-notifications.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/prometheus.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/redis-webhook/Dockerfile +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/redis-webhook/bridge.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/redis-webhook/requirements.txt +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/start.sh +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/scenarios.yml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/ui/compose.actions.yaml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/ui/compose.journal.yaml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/ui/compose.yaml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/examples/ui/prepare.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/__main__.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/__init__.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/access.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/configuration.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/docker.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/events.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/filesystems.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/http.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/http_routes.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/rules.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/scenarios.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/selection.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/state.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/syntax.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/adapters/validation.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/audit_forward.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/cli.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/core/__init__.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/core/engine.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/core/manual.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/core/metrics.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/core/policy.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/core/rules.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/domain/__init__.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/domain/errors.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/domain/filesystems.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/domain/maintenance.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/domain/models.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/domain/rules.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/domain/runtime.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/manual_actions.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/notification_audit.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/outputs/__init__.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/outputs/formatting.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/outputs/prometheus.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker/service.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker.egg-info/SOURCES.txt +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker.egg-info/dependency_links.txt +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker.egg-info/requires.txt +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/monit_docker.egg-info/top_level.txt +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/pyproject.toml +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/requirements.txt +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/setup.cfg +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/setup.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_access.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_access_docker.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_adapters.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_check_config.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_core.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_cron.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_docker_integration.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_engine.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_filesystem_mode.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_filesystems.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_health.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_httpdis_transport.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_maintenance.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_manual_actions.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_monit_docker.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_packaging.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_restart_limit.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_runtime_checks.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_runtime_docker.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_scenarios.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_service.py +0 -0
- {monit_docker-0.0.74 → monit_docker-0.0.76}/tests/test_trigger_delay.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.76
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.76
|
|
@@ -257,6 +257,20 @@ serve options. Reuse the token and proxy-include mounts from
|
|
|
257
257
|
should use the authenticated username. Compose replaces `command` lists: do not
|
|
258
258
|
stack the journal and actions overlays without combining their command options.
|
|
259
259
|
|
|
260
|
+
Since 0.0.75, **View action** opens a separate **Action history** dialog for
|
|
261
|
+
action events with a correlation ID. It shows matching action events in recorded
|
|
262
|
+
order, oldest first, without applying the main journal filters. Each stage keeps
|
|
263
|
+
its source, actor, host, target and reason; a recorded duration is shown in
|
|
264
|
+
milliseconds when available. Closing the dialog preserves the journal page and
|
|
265
|
+
filters. Notification events and legacy events without an ID have no action link.
|
|
266
|
+
|
|
267
|
+
The dialog reads one bounded page at a time. **Load older events** explicitly
|
|
268
|
+
continues the search, including after an empty page; there is no background scan
|
|
269
|
+
or polling. **Refresh action** starts a new snapshot and recovers from expired
|
|
270
|
+
cursors. The display is limited to 500 events. Only retained events are shown:
|
|
271
|
+
missing stages do not prove an action is still running or that it never completed.
|
|
272
|
+
An ID groups recorded events; it does not invent missing lifecycle stages.
|
|
273
|
+
|
|
260
274
|
### Bounded reads and downloads
|
|
261
275
|
|
|
262
276
|
`GET /v1/audit` returns up to 100 events, newest first, with a signed continuation
|
|
@@ -267,6 +281,12 @@ Opening files briefly takes a nonblocking shared journal lock. File content read
|
|
|
267
281
|
and serialization run after releasing it, outside the action/monitoring locks.
|
|
268
282
|
If a writer holds the journal lock, browsing returns 503 rather than waiting.
|
|
269
283
|
|
|
284
|
+
Since 0.0.75, the `correlation_id` query parameter matches the complete, case-sensitive
|
|
285
|
+
ID. Combine it with `category=action` to read action stages without result/source
|
|
286
|
+
filters: `/v1/audit?category=action&correlation_id=REQUEST_ID`. It accepts at most
|
|
287
|
+
256 printable characters and uses the same authentication, scan limits and
|
|
288
|
+
filter-bound cursors as other filters. `/v1/audit/export` accepts it too.
|
|
289
|
+
|
|
270
290
|
A sparse filter can produce an empty page with an **Older events** continuation.
|
|
271
291
|
No automatic loop scans the remaining files. Cursors are bound to the filters and
|
|
272
292
|
authenticated user, exclude subsequent appends and expire after 15 minutes,
|
|
@@ -285,3 +305,15 @@ proxy identity replacement, writer progress during reads and browser error state
|
|
|
285
305
|
Run `.github/scripts/benchmark-audit.py` with the project environment to measure a
|
|
286
306
|
50 MiB disposable journal, first-page memory and latency, full sparse-search cost
|
|
287
307
|
and a concurrent write. Measurements depend on the host and are not latency SLAs.
|
|
308
|
+
|
|
309
|
+
Since 0.0.76, opening action history immediately previews matching events from
|
|
310
|
+
the current journal page while the agent checks retained history. Refreshing also
|
|
311
|
+
keeps the previously displayed events visible. The loading message identifies
|
|
312
|
+
this provisional view; a successful response replaces it, including when the
|
|
313
|
+
new snapshot is empty. A failed request labels the retained preview as possibly
|
|
314
|
+
incomplete or outdated. No extra background requests or persistent browser
|
|
315
|
+
storage are used. Ordinary audit text validation also avoids unnecessary
|
|
316
|
+
character-by-character work while preserving the canonical escaping rules.
|
|
317
|
+
Compiled regular expressions process escape sequences and ASCII control runs;
|
|
318
|
+
printable Unicode is preserved, with detailed checks limited to unusual Unicode
|
|
319
|
+
runs. Malformed and noncanonical escape sequences are still rejected.
|
|
@@ -25,7 +25,12 @@ MAX_RECORD_BYTES = 65536
|
|
|
25
25
|
DEFAULT_MAX_BYTES = 5 * 1024 * 1024
|
|
26
26
|
_SCHEMA_VERSION = 2
|
|
27
27
|
_FORMULA_PREFIXES = ('=', '+', '-', '@', '\uff1d', '\uff0b', '\uff0d', '\uff20')
|
|
28
|
-
_TEXT_ESCAPE = re.compile(r'\\(?:\\|u[0-9a-f]{4}|U[0-9a-f]{8})')
|
|
28
|
+
_TEXT_ESCAPE = re.compile(r'\\(?:\\|u[0-9a-f]{4}|U[0-9a-f]{8})?')
|
|
29
|
+
_FORMULA_START = re.compile(r'\A( *)([%s])' % re.escape(''.join(_FORMULA_PREFIXES)))
|
|
30
|
+
_ASCII_TO_ESCAPE = re.compile(r'[\\\x00-\x1f\x7f]+')
|
|
31
|
+
_NON_ASCII = re.compile(r'[^\x00-\x7f]+')
|
|
32
|
+
_ASCII_ESCAPES = {code: '\\u%04x' % code for code in (*range(32), 127)}
|
|
33
|
+
_ASCII_ESCAPES[ord('\\')] = '\\\\'
|
|
29
34
|
FIELDS = ('schema_version', 'event_id', 'timestamp', 'host', 'category', 'event',
|
|
30
35
|
'correlation_id', 'source', 'actor', 'container_id', 'container_name',
|
|
31
36
|
'action', 'command_id', 'rule_id', 'result', 'reason', 'error_code',
|
|
@@ -42,38 +47,42 @@ def fingerprint(value):
|
|
|
42
47
|
return hashlib.sha256(str(value).encode('utf-8')).hexdigest()
|
|
43
48
|
|
|
44
49
|
|
|
50
|
+
def _escape_unicode_match(match):
|
|
51
|
+
value = match.group()
|
|
52
|
+
if value.isprintable():
|
|
53
|
+
return value
|
|
54
|
+
return ''.join(character if character.isprintable() else
|
|
55
|
+
('\\u%04x' if ord(character) <= 0xffff else '\\U%08x') % ord(character)
|
|
56
|
+
for character in value)
|
|
57
|
+
|
|
58
|
+
|
|
45
59
|
def _escape_text(value):
|
|
46
60
|
"""Canonical, reversible display text shared by storage and every output."""
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
if '\\' not in value and value.isprintable() and not value.lstrip(' ').startswith(_FORMULA_PREFIXES):
|
|
62
|
+
return value
|
|
63
|
+
value = _ASCII_TO_ESCAPE.sub(lambda match: match.group().translate(_ASCII_ESCAPES), value)
|
|
64
|
+
# Only unusual Unicode needs per-character checks; preserve printable runs.
|
|
65
|
+
if not value.isprintable():
|
|
66
|
+
value = _NON_ASCII.sub(_escape_unicode_match, value)
|
|
67
|
+
return _FORMULA_START.sub(lambda match: match.group(1) + '\\u%04x' % ord(match.group(2)), value)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _unescape_match(match):
|
|
71
|
+
token = match.group()
|
|
72
|
+
if token == '\\':
|
|
73
|
+
raise AuditError('Invalid audit text escape')
|
|
74
|
+
if token == '\\\\':
|
|
75
|
+
return '\\'
|
|
76
|
+
try:
|
|
77
|
+
return chr(int(token[2:], 16))
|
|
78
|
+
except ValueError as error:
|
|
79
|
+
raise AuditError('Invalid audit text code point') from error
|
|
58
80
|
|
|
59
81
|
|
|
60
82
|
def _unescape_text(value):
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
parts.append(value[position])
|
|
65
|
-
position += 1
|
|
66
|
-
continue
|
|
67
|
-
match = _TEXT_ESCAPE.match(value, position)
|
|
68
|
-
if match is None:
|
|
69
|
-
raise AuditError('Invalid audit text escape')
|
|
70
|
-
token = match.group()
|
|
71
|
-
try:
|
|
72
|
-
parts.append('\\' if token == '\\\\' else chr(int(token[2:], 16)))
|
|
73
|
-
except ValueError as error:
|
|
74
|
-
raise AuditError('Invalid audit text code point') from error
|
|
75
|
-
position = match.end()
|
|
76
|
-
return ''.join(parts)
|
|
83
|
+
if '\\' not in value:
|
|
84
|
+
return value
|
|
85
|
+
return _TEXT_ESCAPE.sub(_unescape_match, value)
|
|
77
86
|
|
|
78
87
|
|
|
79
88
|
def prepare_record(record):
|
|
@@ -24,7 +24,7 @@ _IDENTITY_BYTES = 256
|
|
|
24
24
|
_CURSOR_TTL = 900
|
|
25
25
|
_MAX_QUERY = 32768
|
|
26
26
|
_MAX_CURSOR = 24000
|
|
27
|
-
_FILTER_KEYS = ('since', 'until', 'container', 'source', 'category', 'result')
|
|
27
|
+
_FILTER_KEYS = ('since', 'until', 'container', 'source', 'category', 'result', 'correlation_id')
|
|
28
28
|
_QUERY_KEYS = frozenset(_FILTER_KEYS + ('cursor', 'format'))
|
|
29
29
|
_SOURCE_VALUES = ('manual', 'automatic')
|
|
30
30
|
_CATEGORY_VALUES = ('action', 'notification')
|
|
@@ -54,7 +54,7 @@ def parse_query(query):
|
|
|
54
54
|
if len(query) > _MAX_QUERY:
|
|
55
55
|
raise QueryError(400, 'invalid_filters')
|
|
56
56
|
try:
|
|
57
|
-
values = parse_qs(query, keep_blank_values=True, strict_parsing=True, max_num_fields=
|
|
57
|
+
values = parse_qs(query, keep_blank_values=True, strict_parsing=True, max_num_fields=len(_QUERY_KEYS)) if query else {}
|
|
58
58
|
except ValueError:
|
|
59
59
|
raise QueryError(400, 'invalid_filters')
|
|
60
60
|
if set(values) - _QUERY_KEYS or any(len(value) != 1 for value in values.values()):
|
|
@@ -4,8 +4,8 @@ description: monit-docker
|
|
|
4
4
|
author: Adrien Delle Cave
|
|
5
5
|
author_email: pypi@doowan.net
|
|
6
6
|
copyright: '2019-2023 Adrien Delle Cave'
|
|
7
|
-
release: '0.0.
|
|
8
|
-
version: '0.0.
|
|
7
|
+
release: '0.0.76'
|
|
8
|
+
version: '0.0.76'
|
|
9
9
|
license: License GPL-3
|
|
10
10
|
url: https://github.com/decryptus/monit-docker
|
|
11
11
|
python_requires:
|
|
@@ -95,6 +95,20 @@ class JournalTests(unittest.TestCase):
|
|
|
95
95
|
self.assertEqual(row['actor'], r"\u003dCMD()")
|
|
96
96
|
self.assertEqual(row['container_name'], record['container_name'])
|
|
97
97
|
|
|
98
|
+
def test_plain_text_fast_path_preserves_canonical_validation(self):
|
|
99
|
+
for raw in ('', ' ', 'public-demo', 'café 雪', 'emoji 🐳', 'trailing ', 'ordinary = text'):
|
|
100
|
+
with self.subTest(raw=raw):
|
|
101
|
+
record = event_record('action', 'completed', actor=raw)
|
|
102
|
+
self.assertEqual(record['actor'], raw)
|
|
103
|
+
self.assertEqual(prepare_record(record), record)
|
|
104
|
+
for raw in ('=SUM(1,2)', ' +X', '-1', '@name', '=X', ' +X', '-X', '@X', '\n', '\t', '\u202e', '\\u0041'):
|
|
105
|
+
with self.subTest(raw=raw):
|
|
106
|
+
record = event_record('action', 'completed', actor=raw)
|
|
107
|
+
self.assertNotEqual(record['actor'], raw)
|
|
108
|
+
self.assertEqual(prepare_record(record), record)
|
|
109
|
+
with self.assertRaises(AuditError):
|
|
110
|
+
prepare_record(dict(record, actor=raw))
|
|
111
|
+
|
|
98
112
|
def test_text_is_protected_before_storage_stderr_and_every_export(self):
|
|
99
113
|
raw = ' =SUM(1,2)\n\r\t\x1b[31m\x7f\x85\u202e\u2066\u200b\u2028\U000e0001'
|
|
100
114
|
expected = r' \u003dSUM(1,2)\u000a\u000d\u0009\u001b[31m\u007f\u0085\u202e\u2066\u200b\u2028\U000e0001'
|
|
@@ -139,6 +153,16 @@ class JournalTests(unittest.TestCase):
|
|
|
139
153
|
self.assertNotEqual(control['actor'], literal['actor'])
|
|
140
154
|
self.assertEqual(prepare_record(prepare_record(literal)), literal)
|
|
141
155
|
|
|
156
|
+
def test_mixed_escape_runs_preserve_unicode_and_literal_backslashes(self):
|
|
157
|
+
raw = ' =café 雪 🐳\n\t\\u202e\u202e\U000e0001 end'
|
|
158
|
+
expected = ' \\uff1dcafé 雪 🐳' + r'\u000a\u0009\\u202e\u202e\U000e0001 end'
|
|
159
|
+
record = event_record('action', 'completed', actor=raw)
|
|
160
|
+
self.assertEqual(record['actor'], expected)
|
|
161
|
+
self.assertEqual(prepare_record(record), record)
|
|
162
|
+
for suffix in ('\\', r'\q', r'\u123', r'\u00AF', r'\U0000000', r'\U00110000'):
|
|
163
|
+
with self.subTest(suffix=suffix), self.assertRaises(AuditError):
|
|
164
|
+
prepare_record(dict(record, actor=expected + suffix))
|
|
165
|
+
|
|
142
166
|
def test_legacy_records_are_protected_without_rewriting_archives(self):
|
|
143
167
|
legacy = dict(event_record('action', 'completed'), schema_version=1, actor='=CMD()\n\u202e')
|
|
144
168
|
expected = dict(legacy, schema_version=2, actor=r'\u003dCMD()\u000a\u202e')
|
|
@@ -87,6 +87,30 @@ class QueryTests(unittest.TestCase):
|
|
|
87
87
|
self.assertLessEqual(sum(len(encoded(row)) for row in page['records']), PAGE_BYTES)
|
|
88
88
|
self.assertGreater(len(page['records']), 0)
|
|
89
89
|
|
|
90
|
+
def test_correlation_filter_is_exact_and_bound_to_cursor_and_exports(self):
|
|
91
|
+
wanted = self.populate(105, correlation_id='request-A', container_name='web')
|
|
92
|
+
self.populate(1, correlation_id='request-A-extra')
|
|
93
|
+
self.populate(1, correlation_id='request-a')
|
|
94
|
+
self.populate(1)
|
|
95
|
+
query = dict(correlation_id='request-A', category='action', container='web',
|
|
96
|
+
source='manual', result='succeeded', since='2020-01-01T00:00:00Z',
|
|
97
|
+
until='2100-01-01T00:00:00Z')
|
|
98
|
+
first, _ = self.reader.page(urlencode(query), 'alice')
|
|
99
|
+
self.assertEqual(first['records'], wanted[::-1][:100])
|
|
100
|
+
second, _ = self.reader.page(urlencode(dict(query, cursor=first['next_cursor'])), 'alice')
|
|
101
|
+
self.assertEqual(second['records'], wanted[::-1][100:])
|
|
102
|
+
exported, format = self.reader.page(urlencode(dict(query, cursor=first['page_cursor'], format='csv')), 'alice')
|
|
103
|
+
self.assertEqual(format, 'csv')
|
|
104
|
+
self.assertEqual(exported['records'], first['records'])
|
|
105
|
+
for changed in ('request-a', 'request-A-extra'):
|
|
106
|
+
with self.assertRaises(QueryError) as error:
|
|
107
|
+
self.reader.page(urlencode(dict(query, cursor=first['next_cursor'], correlation_id=changed)), 'alice')
|
|
108
|
+
self.assertEqual(error.exception.code, 400)
|
|
109
|
+
for query in ('correlation_id=a&correlation_id=b', 'correlation_id=%0A', 'correlation_id=' + 'x' * 257):
|
|
110
|
+
with self.assertRaises(QueryError) as error:
|
|
111
|
+
self.reader.page(query, 'alice')
|
|
112
|
+
self.assertEqual(error.exception.code, 400)
|
|
113
|
+
|
|
90
114
|
def test_scan_does_not_hold_writer_lock_and_busy_writer_is_not_waited_on(self):
|
|
91
115
|
self.populate(2)
|
|
92
116
|
lock = os.open(str(self.path) + '.lock', os.O_RDWR)
|
|
@@ -183,3 +207,12 @@ class AuditReadHttpTests(unittest.TestCase):
|
|
|
183
207
|
self.assertEqual(self.request(method='POST')[0], 405)
|
|
184
208
|
self.assertEqual(self.request('/v1/audit?source=invalid')[0], 400)
|
|
185
209
|
self.assertNotIn(TOKEN, json.dumps(self.monitor.status()))
|
|
210
|
+
|
|
211
|
+
def test_http_correlation_query_returns_all_action_stages(self):
|
|
212
|
+
records = [self.journal.record('action', event, correlation_id='request-123', result=result)
|
|
213
|
+
for event, result in (('queued', 'pending'), ('started', 'pending'), ('completed', 'failed'))]
|
|
214
|
+
self.journal.record('action', 'completed', correlation_id='request-123-other')
|
|
215
|
+
self.journal.record('notification', 'received', correlation_id='request-123')
|
|
216
|
+
code, body, _ = self.request('/v1/audit?category=action&correlation_id=request-123')
|
|
217
|
+
self.assertEqual(code, 200)
|
|
218
|
+
self.assertEqual(json.loads(body)['records'], records[::-1])
|
monit_docker-0.0.74/RELEASE
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.0.74
|
monit_docker-0.0.74/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.0.74
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/alertmanager.email-slack.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/prometheus-notifications.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{monit_docker-0.0.74 → monit_docker-0.0.76}/examples/monitoring/redis-webhook/requirements.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|