Skip to content

fix(outputs.parquet): Sanitize measurement names before using as file name - #19552

Open
81reap wants to merge 4 commits into
influxdata:masterfrom
81reap:parquet-01-filename-safety
Open

fix(outputs.parquet): Sanitize measurement names before using as file name#19552
81reap wants to merge 4 commits into
influxdata:masterfrom
81reap:parquet-01-filename-safety

Conversation

@81reap

@81reap 81reap commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Since measurement names are used as file names, an invalid file name like ../../../../tmp/evil wrote its file to /tmp instead. A name that was too long or had a NUL byte made os.Create fail into a retry storm blocking telegraf from writing metrics until the bad metric aged out of the buffer.

Now measurement names are sanitized if they are used as a file name. Renamed measurements are logged to console simmilar to how outputs.bigquery handles table names.

Checklist

Related issues

resolves #19563

@telegraf-tiger telegraf-tiger Bot added fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Aug 26, 2026
@81reap
81reap marked this pull request as ready for review August 26, 2026 04:54
@srebhan

srebhan commented Aug 26, 2026

Copy link
Copy Markdown
Member

@81reap I wonder if we shouldn't simply reject the metric instead of trying to be clever. What do you think?

81reap added 2 commits August 26, 2026 14:39
… name

Since measurement names are used as file names, an invalid file name like `../../../../tmp/evil` wrote its file to `/tmp` instead. A name that was too long or had a `NUL` byte made `os.Create` fail into a retry storm blocking telegraf from writing metrics until the bad metric aged out of the buffer.

Now measurement names are sanitized if they are used as a file name. Renamed measurements are logged to console simmilar to how `outputs.bigquery` handles table names.
@81reap
81reap force-pushed the parquet-01-filename-safety branch from 1f45938 to baccc53 Compare August 26, 2026 18:43
@srebhan

srebhan commented Aug 26, 2026

Copy link
Copy Markdown
Member

To be honest I would let the OS decide on what a valid filename is. This strongly depends on the OS and it's really hard to get it right through a black-list. What do you think? A test would be good anyway.

Furthermore, you should use os.Root to make sure the new file is genuinely below the configured directory.

@telegraf-tiger

Copy link
Copy Markdown
Contributor

Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip.
Downloads for additional architectures and packages are available below.

⚠️ This pull request increases the Telegraf binary size by 7.28 % for linux amd64 (new size: 330.7 MB, nightly size 308.2 MB)

📦 Click here to get additional PR build artifacts

Artifact URLs

. DEB . RPM . TAR . GZ . ZIP
amd64.deb aarch64.rpm darwin_amd64.tar.gz windows_amd64.zip
arm64.deb armel.rpm darwin_arm64.tar.gz windows_arm64.zip
armel.deb armv6hl.rpm freebsd_amd64.tar.gz windows_i386.zip
armhf.deb i386.rpm freebsd_armv7.tar.gz
i386.deb ppc64le.rpm freebsd_i386.tar.gz
mips.deb riscv64.rpm linux_amd64.tar.gz
mipsel.deb s390x.rpm linux_arm64.tar.gz
ppc64el.deb x86_64.rpm linux_armel.tar.gz
riscv64.deb linux_armhf.tar.gz
s390x.deb linux_i386.tar.gz
linux_mips.tar.gz
linux_mipsel.tar.gz
linux_ppc64le.tar.gz
linux_riscv64.tar.gz
linux_s390x.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

outputs.parquet: fields that first appear after the initial flush are silently dropped, with no warning

2 participants