You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- New flask_s3_viewer.audit module emits one line per list/download/
upload/delete/presign call with action, namespace, key, user, result,
status_code, client_ip, user_agent, and a length-capped error field.
Denied operations land at WARNING, exceptions at ERROR, success at
INFO; control-byte sanitisation blocks log-line injection. emit() is
a documented public helper for host integrations.
- Wire emit() into the blueprint: _enforce_auth fires before the
401/403 abort, the @require decorator covers download/delete, and
files/files_presign emit via try/finally. A request-scoped sentinel
prevents duplicate or missing records, and the Google OAuth redirect
path is intentionally silent (covered by a regression test).
- Move every direct logging.* call to module loggers and fix the
long-standing PURGE / MKDIR / UP_OBJECT debug statements that were
silently dropped because the object name was passed as a positional
arg against an unparameterised message.
- Document the logger name, fields, level mapping, ProxyFix recommend-
ation, RedactFilter / KeyErrorRedactFilter examples, and host-side
emit() usage. Bump CHANGELOG with the next-release section.
<h1>Changelog<aclass="headerlink" href="#changelog" title="Link to this heading"></a></h1>
109
110
<p>All notable changes to this project will be documented in this file. Dates are displayed in UTC.</p>
110
111
<p>Generated by <cite>``auto-changelog`</cite> <<aclass="reference external" href="https://github.com/CookPete/auto-changelog">https://github.com/CookPete/auto-changelog</a>>`_.</p>
112
+
<sectionid="unreleased">
113
+
<h2>[1.1.0] - unreleased<aclass="headerlink" href="#unreleased" title="Link to this heading"></a></h2>
114
+
<blockquote>
115
+
<div><p>Audit logging & logging surface clean-up. The public API (<codeclass="docutils literal notranslate"><spanclass="pre">FlaskS3Viewer</span></code>
pure-<codeclass="docutils literal notranslate"><spanclass="pre">logging</span></code>: attach a handler to <codeclass="docutils literal notranslate"><spanclass="pre">flask_s3_viewer.audit</span></code>, set its
130
+
level, optionally pin <codeclass="docutils literal notranslate"><spanclass="pre">propagate</span><spanclass="pre">=</span><spanclass="pre">False</span></code>. No constructor flag.
131
+
<codeclass="docutils literal notranslate"><spanclass="pre">flask_s3_viewer.audit.emit(...)</span></code> is a public helper host code may
132
+
call to record extra non-CRUD operations on the same logger. Log
133
+
injection is defended at this layer — ASCII control bytes in any
134
+
user-controllable field (key / email / User-Agent / exception text)
135
+
are escaped to <codeclass="docutils literal notranslate"><spanclass="pre">\xNN</span></code> before the record is built. UA is capped at
136
+
256 bytes; free-form fields at 1024 bytes. See <em>Audit logging</em> in
137
+
<codeclass="docutils literal notranslate"><spanclass="pre">docs/source/usage/configuration.rst</span></code> for ProxyFix guidance, JSON
138
+
handler setup, and PII / ARN / bucket-name redaction filter
<codeclass="docutils literal notranslate"><spanclass="pre">logging.debug(...)</span></code> calls in <codeclass="docutils literal notranslate"><spanclass="pre">flask_s3_viewer/__init__.py</span></code>,
145
+
<codeclass="docutils literal notranslate"><spanclass="pre">aws/s3.py</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">aws/session.py</span></code>, and <codeclass="docutils literal notranslate"><spanclass="pre">aws/cache.py</span></code> have been routed
146
+
through per-module <codeclass="docutils literal notranslate"><spanclass="pre">logging.getLogger(__name__)</span></code> instances. Record
147
+
<codeclass="docutils literal notranslate"><spanclass="pre">name</span></code> now reads <codeclass="docutils literal notranslate"><spanclass="pre">flask_s3_viewer.<module></span></code> instead of <codeclass="docutils literal notranslate"><spanclass="pre">root</span></code>. Host
148
+
pipelines that filter by record <codeclass="docutils literal notranslate"><spanclass="pre">name</span></code> (rather than by handler
149
+
attachment) need to update their allow-lists; host pipelines that
150
+
attach handlers to the root logger (or to <codeclass="docutils literal notranslate"><spanclass="pre">flask_s3_viewer</span></code>) are
151
+
unaffected — the module loggers default to <codeclass="docutils literal notranslate"><spanclass="pre">propagate=True</span></code>.</p></li>
152
+
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">app.url_map</span></code> registration dump was demoted from INFO to DEBUG so
153
+
registering many namespaces (or large blueprints) no longer floods
the broken <codeclass="docutils literal notranslate"><spanclass="pre">logging.debug('PURGE:',</span><spanclass="pre">name)</span></code> form (the second
160
+
positional argument was treated as a logging-args tuple, against an
161
+
unparameterised message string, which the stdlib silently drops).
162
+
They now use <codeclass="docutils literal notranslate"><spanclass="pre">logger.debug('PURGE:</span><spanclass="pre">%s',</span><spanclass="pre">name)</span></code> etc., so a host that
163
+
pins the logger at DEBUG actually sees the keys involved in each
<h2><aclass="reference external" href="https://github.com/hidekuma/flask-s3-viewer/compare/1.0.0...1.0.1">1.0.1</a><aclass="headerlink" href="#id2" title="Link to this heading"></a></h2>
0 commit comments