Skip to content

fix: validate Chainlink oracle account in best-price before reading price data#8

Open
millw14 wants to merge 1 commit intoaeyakovenko:masterfrom
millw14:fix/oracle-validation-clean
Open

fix: validate Chainlink oracle account in best-price before reading price data#8
millw14 wants to merge 1 commit intoaeyakovenko:masterfrom
millw14:fix/oracle-validation-clean

Conversation

@millw14
Copy link

@millw14 millw14 commented Feb 15, 2026

Problem

getChainlinkPrice() reads hardcoded offsets (138, 216) from any account passed as --oracle without validating it's actually a Chainlink feed. If a user passes the wrong account, the function reads arbitrary bytes as price data and displays confident-looking but completely wrong bid/ask quotes.

Fix

  • Validate account owner is the Chainlink OCR2 program (HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny) before reading
  • Check minimum data length (224 bytes) to prevent RangeError
  • Reject non-positive prices and invalid decimals (>18)
  • Warn on stale prices (>1 hour) via stderr

One file, ~40 lines. No other changes.

Note

My previous PR for this was rightfully closed. I branched from my fork's master instead of upstream, so it included thousands of unrelated lines. This PR is rebased cleanly on upstream/master. I'm sorry for the noise.

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.

1 participant