Skip to content

Address SonarCloud findings - #21

Merged
AevumDecessus merged 3 commits into
fragforce:devfrom
AevumDecessus:sonarcloud-fixes
Jun 22, 2026
Merged

Address SonarCloud findings#21
AevumDecessus merged 3 commits into
fragforce:devfrom
AevumDecessus:sonarcloud-fixes

Conversation

@AevumDecessus

@AevumDecessus AevumDecessus commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Run Docker container as non-root user (addgroup/adduser, chown, USER directive) and add .dockerignore to prevent sensitive files from entering the image
  • Add explicit HTTP method restrictions (require_GET, require_http_methods) to all view functions
  • Resolve N+1 query in dashboard by annotating the queryset with Count() instead of calling book.recordings.count() per iteration

Test plan

  • Docker image builds successfully
  • App starts and responds on /healthz/
  • Dashboard loads correctly with annotated recording counts
  • Views reject disallowed HTTP methods with 405
  • .env and .git are excluded from built image

Creates a dedicated app user/group for the runtime process. Adds .dockerignore to prevent .env, .git, and other sensitive files from being copied into the image.
GET-only views use @require_GET, form views use @require_http_methods([GET, POST]). Prevents unintended method handling.
Use queryset annotation with Count() instead of calling book.recordings.count() inside the loop, reducing the number of database queries from O(n) to 1.
@AevumDecessus
AevumDecessus merged commit 76432e0 into fragforce:dev Jun 22, 2026
@AevumDecessus
AevumDecessus deleted the sonarcloud-fixes branch June 22, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant