Skip to content

West Midlands | 26 March SDC | Iswat Bello | Sprint 1 | Purple Forest/bug report/Extra long blooms#210

Open
Iswanna wants to merge 1 commit into
CodeYourFuture:mainfrom
Iswanna:Purple-Forest/bug-report/Extra-long-blooms
Open

West Midlands | 26 March SDC | Iswat Bello | Sprint 1 | Purple Forest/bug report/Extra long blooms#210
Iswanna wants to merge 1 commit into
CodeYourFuture:mainfrom
Iswanna:Purple-Forest/bug-report/Extra-long-blooms

Conversation

@Iswanna

@Iswanna Iswanna commented Jun 11, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

This PR fixes a bug whereby the application allowed blooms (posts) longer than 280 characters to be saved to the database. While the frontend had validation, the backend lacked a "security guard" to prevent direct API requests or scripts from bypassing the limit.

The Problem: The application was only validating bloom length on the frontend. This allowed scripts (like populate.py) or direct API requests to save blooms longer than 280 characters, breaking the business rules.

The Fix:

  • Added a MAX_BLOOM_LENGTH constant (280) to the backend.
  • Updated the send_bloom function in endpoints.py to check the length of the incoming content.
  • The backend now returns a 400 Bad Request if the bloom exceeds the limit.

Verification:

  • I performed a factory reset of the database and ran populate.py.
  • Confirmed that the backend successfully rejected the oversized bloom from the script with a 400 error.
  • Verified via DBeaver that the invalid bloom was not saved to the database.

@Iswanna Iswanna added 📅 Sprint 1 Assigned during Sprint 1 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Legacy-Code The name of the module. labels Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Legacy-Code The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant