Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(security): expose certified flag for ICP to XDR conversion rate #830

Merged
merged 8 commits into from
Jan 29, 2025

Conversation

yhabib
Copy link
Contributor

@yhabib yhabib commented Jan 29, 2025

Motivation

It has been flagged as a security concern not to use a certified query when reading the ICP to XDR conversion rate.

One option is to implement certificate validation, but its complexity seems beyond the scope of the security ticket. Therefore, I am exposing a new parameter to make the call an update call instead of a query call.

SECFIND-421

Changes

  • New certified parameter for getIcpToCyclesConversionRate to use the certifiedService

Tests

  • Updated existing test to check that service is call when certified: false
  • Add new test to check that certifiedService is call when certified: true

Todos

  • Add entry to changelog (if necessary).

Copy link
Contributor

github-actions bot commented Jan 29, 2025

size-limit report 📦

Path Size
@dfinity/ckbtc 8.12 KB (0%)
@dfinity/cketh 3.68 KB (0%)
@dfinity/cmc 1.41 KB (-0.07% 🔽)
@dfinity/ledger-icrc 4.29 KB (0%)
@dfinity/ledger-icp 15.45 KB (0%)
@dfinity/nns 37.19 KB (0%)
@dfinity/nns-proto 140.98 KB (0%)
@dfinity/sns 17.19 KB (0%)
@dfinity/utils 4.67 KB (0%)
@dfinity/zod-schemas 626 B (0%)
@dfinity/ic-management 3.22 KB (0%)

@yhabib yhabib changed the title Secfind 421/certified call fix(security): use update call for ICP to XDR conversion rate Jan 29, 2025
@yhabib yhabib marked this pull request as ready for review January 29, 2025 15:19
@yhabib yhabib requested review from a team as code owners January 29, 2025 15:19
Copy link
Member

@peterpeterparker peterpeterparker left a comment

Choose a reason for hiding this comment

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

LGTM, thanks. Can you add an entry in the CHANGELOG.md?

I'll approve afterwards, I would need to re-approve after your commit anyway ;)

@yhabib yhabib changed the title fix(security): use update call for ICP to XDR conversion rate fix(security): expose certified flag for ICP to XDR conversion rate Jan 29, 2025
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@peterpeterparker peterpeterparker left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

@yhabib yhabib force-pushed the secfind-421/certified-call branch from 9ccfff6 to f88dbc3 Compare January 29, 2025 16:58
@yhabib yhabib merged commit b8c1a0f into main Jan 29, 2025
12 checks passed
@yhabib yhabib deleted the secfind-421/certified-call branch January 29, 2025 17:05
github-merge-queue bot pushed a commit to dfinity/nns-dapp that referenced this pull request Jan 30, 2025
# Motivation

We want to pull in the latest changes to make the get the the ICP to XDR
conversion rate certified.
Related ic-js pr: dfinity/ic-js#830

# Changes

- Run `npm run upgrade:next`
- Add new fields to the mock - the reason why the CI action upgrade is
failing.

# Tests

- Should pass as before

# Todos

- [ ] Add entry to changelog (if necessary).
Not necessary
github-merge-queue bot pushed a commit to dfinity/nns-dapp that referenced this pull request Jan 30, 2025
)

# Motivation

It has been flagged as a security concern not to use a certified query
when reading the ICP to XDR conversion rate.

This is a follow up of dfinity/ic-js#830 to make
the call as a certified one.

[SECFIND-421](https://dfinity.atlassian.net/browse/SECFIND-421)

# Changes

- Pass the `certified` flag to `getIcpToCyclesConversionRate` to make it
an update call

# Tests

- Updated unit test to check that the flag is provided

# Todos

- [ ] Add entry to changelog (if necessary).
Not necessary

[SECFIND-421]:
https://dfinity.atlassian.net/browse/SECFIND-421?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
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