Skip to content

fix(security): restrict permissions and cleanup temp tls pem for mongodb (#915) - #946

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/915-mongo-tls-temp-pem-permissions-cleanup
Sep 25, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/915-mongo-tls-temp-pem-permissions-cleanup

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

  • Restrict POSIX file permissions (0600 file / 0700 dir) when creating merged temporary client TLS PEM keys in resolveMongoTlsCertificateKeyFile.
  • Add cleanupMongoTlsTempFile and track temporary client PEM in MongoConnection, ensuring reliable cleanup upon disconnect or connection errors.
  • Add cleanupStaleMongoTlsTempFiles hook executed on app startup in lib/main.dart to purge any leftover temporary TLS files from previous sessions.
  • Add unit tests covering restrictive permissions, targeted cleanup, and connection error cleanup.

Linked issue

Closes #915

Checklist

  • flutter analyze passes locally
  • Scope matches the linked issue only (no drive-by refactors)
  • PR targets dev

@github-actions github-actions Bot added bug Something isn't working core Core library logic and services connections Database connections, URI parsing, pools labels Sep 25, 2026
@github-actions github-actions Bot added this to the 0.4.18 milestone Sep 25, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit b8b1859 into dev Sep 25, 2026
3 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/915-mongo-tls-temp-pem-permissions-cleanup branch September 28, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working connections Database connections, URI parsing, pools core Core library logic and services

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant