Skip to content

Env template and ignore files cleanup - #64

Open
JoshD94 wants to merge 2 commits into
masterfrom
josh-cleanup
Open

Env template and ignore files cleanup#64
JoshD94 wants to merge 2 commits into
masterfrom
josh-cleanup

Conversation

@JoshD94

@JoshD94 JoshD94 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Overview

Clean up codebase

Changes Made

Updated env template to include JWT secret key
Noticed the dev setup lacks the proper ignore files, so added those

Test Coverage

Next Steps (delete if not applicable)

Related PRs or Issues (delete if not applicable)

Screenshots (delete if not applicable)

Screen Shot Name

Summary by CodeRabbit

  • Chores
    • Added Docker build exclusions for development files, secrets, certificates, logs, and local configuration.
    • Updated the environment template to include a JWT secret setting.
    • Organized and expanded repository exclusions for Python artifacts, virtual environments, build outputs, test coverage, logs, and credentials.

@claiireyu claiireyu 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.

lgtm

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds Docker ignore rules, reorganizes Git ignore rules, and adds JWT_SECRET_KEY to .env_template.

Changes

Repository environment configuration

Layer / File(s) Summary
Ignore and environment rules
.dockerignore, .gitignore, .env_template
Docker and Git ignore rules now cover generated files, secrets, certificates, tooling artifacts, logs, and local environments. .env_template now includes JWT_SECRET_KEY.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: andrewp0809, anikdey-exe

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the cleanup of the environment template and ignore files, which matches the main changes.
Description check ✅ Passed The description identifies the main changes and their purpose, but it leaves the Test Coverage section empty.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch josh-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.env_template:
- Line 6: Update the startup configuration validation associated with
JWT_SECRET_KEY to reject blank or whitespace-only values before the application
serves requests, and ensure the failure is immediate and clear. Add concise
guidance in the environment template that deployments must supply a high-entropy
JWT secret; do not rely on a fallback value.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b4416b7a-7efa-4f83-917c-9d25827845b5

📥 Commits

Reviewing files that changed from the base of the PR and between 8ebefa3 and e0eca1b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • .dockerignore
  • .env_template
  • .gitignore

Comment thread .env_template
STAGE=
DAILY_SUN_URL= No newline at end of file
DAILY_SUN_URL=
JWT_SECRET_KEY= No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- tracked files ---'
git ls-files | sed -n '1,160p'
printf '%s\n' '--- relevant symbols and configuration ---'
rg -n -S --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'JWT_SECRET_KEY|JWT_SECRET|Flask-JWT|JWTManager|SECRET_KEY|dotenv|\.env_template' .
printf '%s\n' '--- candidate file sizes ---'
for f in .env_template src/utils/constants.py app.py; do
  if [ -f "$f" ]; then wc -l "$f"; fi
done

Repository: cuappdev/score-backend

Length of output: 2597


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- .env_template ---'
cat -n .env_template
printf '%s\n' '--- constants.py imports and environment reads ---'
sed -n '1,35p' src/utils/constants.py
printf '%s\n' '--- app startup and JWT setup ---'
sed -n '1,50p' app.py
printf '%s\n' '--- deployment and environment loading ---'
for f in .github/workflows/deploy-dev.yml .github/workflows/deploy-prod.yml Dockerfile docker-compose.yml README.md; do
  printf '\n--- %s ---\n' "$f"
  rg -n -C 4 -S 'env|environment|dotenv|JWT_SECRET_KEY|docker|secret|deploy|run' "$f" || true
done

Repository: cuappdev/score-backend

Length of output: 7234


🌐 Web query:

Flask-JWT-Extended 4.7.1 empty JWT_SECRET_KEY behavior config validation

💡 Result:

In Flask-JWT-Extended (including version 4.7.1), the library validates the secret key configuration at runtime during the token encoding or decoding process, rather than during the initial Flask application startup [1][2]. If you are using a symmetric signing algorithm (the default), the library checks for the secret key using the following logic [1]: 1. It first checks if JWT_SECRET_KEY is defined in the Flask application configuration (app.config). 2. If JWT_SECRET_KEY is not set (is None or empty), it automatically falls back to using the application's Flask SECRET_KEY [1][3][4]. 3. If neither JWT_SECRET_KEY nor the Flask SECRET_KEY is set, the library will raise a RuntimeError when an attempt is made to encode or decode a token [1][2]. The library does not perform an eager validation of these keys when the JWTManager is initialized; therefore, an empty configuration will not prevent the application from starting [1][2]. Instead, the runtime error occurs only when the application attempts to perform a cryptographic operation requiring the key [1][2]. For asymmetric algorithms (e.g., RS256), the library mandates the explicit configuration of JWT_PRIVATE_KEY and/or JWT_PUBLIC_KEY, and it will raise a RuntimeError if these specific keys are missing [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- complete compose configuration ---'
cat -n docker-compose.yml
printf '%s\n' '--- environment documentation and ignore rules ---'
cat -n README.md | sed -n '1,100p'
cat -n .gitignore
printf '%s\n' '--- references to the template and environment files ---'
rg -n -S --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  '\.env_template|cp .*\.env|env_file:|JWT_SECRET_KEY|load_dotenv' .
printf '%s\n' '--- Flask-JWT-Extended source for the pinned version ---'
python3 - <<'PY'
from urllib.request import urlopen
url = "https://raw.githubusercontent.com/vimalloc/flask-jwt-extended/4.7.1/flask_jwt_extended/config.py"
try:
    text = urlopen(url, timeout=10).read().decode()
except Exception as exc:
    print(f"fetch failed: {exc}")
else:
    for i, line in enumerate(text.splitlines(), 1):
        if "secret" in line.lower() or "JWT_SECRET_KEY" in line:
            start = max(1, i - 4)
            end = min(len(text.splitlines()), i + 8)
            print(f"--- lines {start}-{end} ---")
            print("\n".join(f"{n}: {text.splitlines()[n-1]}" for n in range(start, end + 1)))
PY

Repository: cuappdev/score-backend

Length of output: 3305


🏁 Script executed:

#!/bin/bash
set -e
python3 - <<'PY'
from urllib.request import Request, urlopen
import ssl

url = "https://raw.githubusercontent.com/vimalloc/flask-jwt-extended/4.7.1/flask_jwt_extended/config.py"
ctx = ssl._create_unverified_context()
text = urlopen(Request(url, headers={"User-Agent": "review-check"}), context=ctx, timeout=10).read().decode()
lines = text.splitlines()
for i, line in enumerate(lines, 1):
    if "secret" in line.lower():
        start = max(1, i - 5)
        end = min(len(lines), i + 10)
        print("\n".join(f"{n}: {lines[n-1]}" for n in range(start, end + 1)))
        print("---")
PY

Repository: cuappdev/score-backend

Length of output: 3946


Fail fast when JWT_SECRET_KEY is blank.

docker-compose.yml loads .env; the deployment workflows do not load .env_template. If .env contains a blank value, the application accepts it, and Flask-JWT-Extended raises a RuntimeError during token operations because no fallback secret is configured. Reject blank values at startup and document that deployments must provide a high-entropy secret.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.env_template at line 6, Update the startup configuration validation
associated with JWT_SECRET_KEY to reject blank or whitespace-only values before
the application serves requests, and ensure the failure is immediate and clear.
Add concise guidance in the environment template that deployments must supply a
high-entropy JWT secret; do not rely on a fallback value.

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.

2 participants