Update Scheduled Mail Handler#80
Conversation
App Router migration and other updates
Add test email feature, fix email styling
Update set up repo setup
Merge to Main 12/6/2025
Merge to main 02/02/26
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| name: Ruff (backend) | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./backend | ||
|
|
||
| steps: | ||
| - name: Check out Git repository | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v4 | ||
|
|
||
| - name: Set up Python | ||
| run: uv python install | ||
|
|
||
| - name: Install backend dependencies | ||
| run: uv sync --group dev | ||
|
|
||
| - name: Run Ruff lint check | ||
| run: uv run ruff check | ||
|
|
||
| - name: Run Ruff format check | ||
| run: uv run ruff format --check |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
In general, the fix is to add an explicit permissions block that restricts the GITHUB_TOKEN to the minimal scope required. For pure linting jobs that only need to read repository contents, contents: read is sufficient. Since both run-linters and ruff are lint jobs and do not perform write operations to the repo or GitHub APIs, they can share a global minimal permissions block.
The best way to fix this without changing existing functionality is to add a top-level permissions block after the on: trigger. This will apply to all jobs (including ruff) that don’t define their own permissions. We’ll set contents: read, which is the minimal recommended starting point and matches CodeQL’s suggestion. No imports or additional methods are needed; this is entirely a YAML configuration change in .github/workflows/lint.yml, within the shown snippet.
Concretely, in .github/workflows/lint.yml, insert:
permissions:
contents: readbetween lines 2 and 3 (after on: pull_request and before jobs:), maintaining the existing indentation style.
| @@ -1,5 +1,7 @@ | ||
| name: Lint | ||
| on: pull_request | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| run-linters: | ||
| name: Run linters |
| logger.error(f"Unexpected error retrieving posts: {e}") | ||
|
|
||
| return Response( | ||
| {"error": f"Unexpected error retrieving posts: {e}"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR |
Check warning
Code scanning / CodeQL
Information exposure through an exception
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
In general, this should be fixed by ensuring that detailed exception information (including raw exception messages) is logged only on the server and not returned to the client. The client should receive a generic, non-sensitive error message and, if needed, a generic error code that can be correlated with server logs.
For this specific view, the best minimal fix without changing existing functionality is to keep the logging line as-is (so developers still see the detailed error in logs) but change the HTTP response body in the broad except Exception as e: handler to a generic message that does not include e. That means editing backend/hoagiemail/api/stuff_posts_view.py at lines 46–48 to remove the f-string with {e} and replace it with a constant message like "Unexpected error retrieving posts.". No new imports or helper methods are required.
| @@ -44,5 +44,5 @@ | ||
| logger.error(f"Unexpected error retrieving posts: {e}") | ||
|
|
||
| return Response( | ||
| {"error": f"Unexpected error retrieving posts: {e}"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR | ||
| {"error": "Unexpected error retrieving posts."}, status=status.HTTP_500_INTERNAL_SERVER_ERROR | ||
| ) |
13fc827 to
a7fad96
Compare
References
Proposed Changes
Summary
Implemented the handler to update a scheduled mail, allowing users to modify when a scheduled email will be sent.
Changes
Notes