Skip to content

Fix based on Coverity and Sonar audits (part 5) - #22333

Merged
stelfrag merged 1 commit into
netdata:masterfrom
stelfrag:cov_fix_202604_part5
May 1, 2026
Merged

Fix based on Coverity and Sonar audits (part 5)#22333
stelfrag merged 1 commit into
netdata:masterfrom
stelfrag:cov_fix_202604_part5

Conversation

@stelfrag

Copy link
Copy Markdown
Collaborator

Sonar c:S2612: mark_database_to_recover() created the
.netdata-meta.db.recover / .delete marker with `open(..., O_WRONLY |
O_CREAT | O_TRUNC | O_CLOEXEC, 444)`. The literal `444` is decimal,
which is octal 0o674 (rw-rwxr--) -- group rwx + others r. Same
decimal-not-octal typo as the previous api_v1_manage.c commit.

The file is a marker created and immediately closed (no body written);
only its existence matters at next-startup recovery detection. It does
not need group or other access. Use mode 0600 -- minimum permissions
needed by the owning netdata process, eliminates the c:S2612 violation.
@sonarqubecloud

Copy link
Copy Markdown

@stelfrag

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@stelfrag I have started the AI code review. It will take a few minutes to complete.

@stelfrag
stelfrag marked this pull request as ready for review May 1, 2026 07:23
Copilot AI review requested due to automatic review settings May 1, 2026 07:23
@stelfrag
stelfrag marked this pull request as draft May 1, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SQLite recovery marker file creation to use secure, owner-only permissions, aligning with audit-driven hardening from the ongoing Coverity/Sonar fix series.

Changes:

  • Create .netdata-meta.db.recover / .netdata-meta.db.delete marker files with mode 0600 instead of 444.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stelfrag
stelfrag marked this pull request as ready for review May 1, 2026 07:56
@stelfrag
stelfrag merged commit ed6e8eb into netdata:master May 1, 2026
162 checks passed
@stelfrag
stelfrag deleted the cov_fix_202604_part5 branch May 1, 2026 08:18
@stelfrag stelfrag mentioned this pull request Jun 22, 2026
Ferroin pushed a commit that referenced this pull request Jul 15, 2026
sqlite: fix decimal mode literal on recovery marker file

Sonar c:S2612: mark_database_to_recover() created the
.netdata-meta.db.recover / .delete marker with `open(..., O_WRONLY |
O_CREAT | O_TRUNC | O_CLOEXEC, 444)`. The literal `444` is decimal,
which is octal 0o674 (rw-rwxr--) -- group rwx + others r. Same
decimal-not-octal typo as the previous api_v1_manage.c commit.

The file is a marker created and immediately closed (no body written);
only its existence matters at next-startup recovery detection. It does
not need group or other access. Use mode 0600 -- minimum permissions
needed by the owning netdata process, eliminates the c:S2612 violation.

Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
(cherry picked from commit ed6e8eb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants