Skip to content

Reject non-integer bounty fields#246

Closed
nicolatrozzi wants to merge 1 commit into
ramimbo:mainfrom
nicolatrozzi:reject-noninteger-bounty-fields
Closed

Reject non-integer bounty fields#246
nicolatrozzi wants to merge 1 commit into
ramimbo:mainfrom
nicolatrozzi:reject-noninteger-bounty-fields

Conversation

@nicolatrozzi
Copy link
Copy Markdown
Contributor

Refs #228

Summary

  • Add shared ledger-service integer guards for bounty mutation fields.
  • Reject boolean and non-integer issue_number/max_awards values when creating bounties.
  • Reject boolean and non-integer bounty_id values before direct pay_bounty() or close_bounty() calls can treat True as bounty id 1.

Repro Before Fix

Direct ledger-service calls could pass values such as issue_number=True, max_awards=True, or bounty_id=True. Because Python booleans are integers (True == 1), those values could create or mutate bounty #1-style records instead of being rejected as malformed input.

Verification

  • ./.venv/bin/python -m pytest tests/test_ledger.py::test_create_bounty_rejects_non_integer_issue_number_and_max_awards tests/test_ledger.py::test_bounty_mutations_reject_boolean_bounty_ids -q -> 2 passed
  • ./.venv/bin/python -m pytest -q -> 207 passed, 2 warnings
  • ./.venv/bin/python -m ruff format --check . -> 37 files already formatted
  • ./.venv/bin/python -m ruff check . -> all checks passed
  • ./.venv/bin/python -m mypy app -> success
  • ./.venv/bin/python scripts/docs_smoke.py -> docs smoke ok
  • ./.venv/bin/python scripts/check_agents.py -> AGENTS.md ok
  • git diff --check -> clean

No secrets, wallet material, private vulnerability details, deployment values, payout details, or MRWK price claims are included.

Copy link
Copy Markdown
Contributor

@MolhamHamwi MolhamHamwi left a comment

Choose a reason for hiding this comment

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

No blockers found.

Evidence checked:

  • Inspected app/ledger/service.py and confirmed the new _required_int / _required_positive_int helpers reject Python bool values before True == 1 can create or mutate bounty records, while preserving the existing positive-range checks and the max_awards > 1_000 cap.
  • Inspected tests/test_ledger.py and confirmed coverage rejects boolean/float issue_number and max_awards, plus boolean bounty_id for both pay_bounty() and close_bounty().
  • Verified this is scoped to ledger validation and does not touch payout proof metadata, wallet material, deployment configuration, or public pricing text.
  • Ran local validation on PR head 2d0e742: focused new tests -> 2 passed; broader ledger/webhook suite -> 31 passed; Ruff check passed; Ruff format check already formatted; git diff --check origin/main...HEAD -> clean.
  • Checked GitHub shows the PR merge state clean and the hosted Quality, readiness, docs, and image checks check successful.

@nicolatrozzi
Copy link
Copy Markdown
Contributor Author

Closing this one because PR #245 was submitted just before it and covers the same bounty integer-field guard. I opened the distinct non-string service-input fix separately as #251.

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