]> git.ipfire.org Git - suricata-reporter.git/commitdiff
generator: Open the database in read-only mode
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 24 Sep 2025 15:32:04 +0000 (15:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 24 Sep 2025 15:32:04 +0000 (15:32 +0000)
The generator does not need to write to the database at all. Therefore
we can tell the driver to open it in read-only mode to be able to
generate reports from any user that is allowed to read from the
database, but not write to it (i.e. the web UI).

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/suricata-report-generator.in

index 6f88fd17f1d8f37a06a0497af966250544d362b0..3a29253fe3d65c02cd36a6fb1e76e26c9f108046 100644 (file)
@@ -75,7 +75,7 @@ class ReportGenerator(object):
                self.path = path
 
                # Open the database
-               self.db = sqlite3.connect(path)
+               self.db = sqlite3.connect("file://%s?mode=ro" % path, uri=True)
                self.db.row_factory = row_factory
 
                # Load a default stylesheet for our document