This is a bounty to fix a specific bug in a job creation schema where `budgetMax` can be lower than `budgetMin`, leading to invalid job records. The task is to implement validation logic to reject such inverted budget ranges during both job creation and partial updates, while ensuring existing valid ranges are unaffected. This is a clear, well-defined bug fix with a direct payment offer.
A starter prompt for Claude Code, what you'll need, and how to reach them.
You are a skilled developer tasked with fixing a specific bug in a job posting application. The goal is to prevent the creation and update of job records where the 'budgetMax' field is lower than 'budgetMin'.
**Context:**
The project is located in the GitHub repository `SecureBananaLabs/bug-bounty`. The relevant issue is #2853.
**Task:**
1. **Fork the `SecureBananaLabs/bug-bounty` repository.**
2. **Locate `createJobSchema`:** Identify the schema definition responsible for validating job creation payloads. This is likely a Joi, Yup, Zod, or similar schema validation library.
3. **Implement Validation for Creation:** Modify `createJobSchema` to add a validation rule ensuring that `budgetMax` is always greater than or equal to `budgetMin`. If `budgetMax` is less than `budgetMin`, the validation should fail.
4. **Implement Validation for Updates:** Identify the schema or logic used for partial job updates. Add validation to reject updates where both `budgetMin` and `budgetMax` are provided, and `budgetMax` is less than `budgetMin`.
5. **Preserve Existing Valid Ranges:** Ensure that the new validation does not inadvertently break the parsing or display of existing job records with valid (ordered) budget ranges.
6. **Write Tests:** Create new unit tests that specifically cover:
* Successful rejection of a job creation payload with inverted budget ranges (`budgetMax < budgetMin`).
* Successful rejection of a partial update payload with inverted budget ranges when both `budgetMin` and `budgetMax` are present.
* Successful acceptance of valid (ordered) budget ranges for creation and update.
* Successful acceptance of updates where only one budget field (`budgetMin` or `budgetMax`) is provided.
7. **Preferred Stack:** Assume the existing project uses Node.js with a schema validation library like Joi or Zod. Your solution should integrate seamlessly with the existing project's structure and testing framework.
8. **Deliverable:** A pull request to the original repository, clearly referencing issue #2853, containing the bug fix and associated tests.Bounty (amount on the issue). Parent bounty: #743 ## Bug `createJobSchema` currently accepts payloads where `budgetMax` is lower than `budgetMin`. That creates invalid job records such as a USD 500-100 budget range and can break filtering, sorting, and display assumptions. ## Expected - Job creation rejects inverted budget ranges. - Partial job updates reject the same invalid range when both budget fields are present. - Existing valid ordered ranges continue to parse successfully. Related reissue: #2835
Standard for any GitHub-based development.
Standard for JavaScript development.
Common in modern web development; likely already familiar.
Submit a Pull Request to the `SecureBananaLabs/bug-bounty` repository and ensure it references issue #2853.
“I've implemented a robust fix for the `budgetMax < budgetMin` validation issue as described in #2853, including comprehensive unit tests. I've opened a PR for your review.”
Open the original ↗