Skip to content

Add secure trip pricing functions and tests#1

Open
Blackbirdf16 wants to merge 1 commit intomainfrom
codex/document-trip-request-functions-and-security-measures
Open

Add secure trip pricing functions and tests#1
Blackbirdf16 wants to merge 1 commit intomainfrom
codex/document-trip-request-functions-and-security-measures

Conversation

@Blackbirdf16
Copy link
Owner

Summary

  • add secure trip request builder with encryption, integrity, and rate limiting
  • implement provider price retrieval and validation utilities with TripOffer model
  • cover new functionality with pytest tests for confidentiality, rate limits, and tamper protection

Testing

  • pytest -q

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +167 to +170
for name, fetcher in providers.items():
price, eta = fetcher(route)
signature = _hash_integrity(f"{name}:{price}:{eta}", secret_key)
offers.append(TripOffer(provider=name, price=price, eta_minutes=eta, signature=signature))

Choose a reason for hiding this comment

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

P1 Badge Bind offer signatures to specific trip requests

Provider offers are signed with hmac(secret_key, f"{name}:{price}:{eta}"), so the signature does not cover which trip the quote was generated for. Because return_best_price_to_user only verifies that signature, a client can replay any previously issued cheap offer (from a different origin/destination) and it will still validate and be returned as the best price. The integrity check should include the trip request identifier (e.g., the request nonce or encrypted payload) to prevent cross-trip reuse of offers.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant