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

chore: emily filter updates from signers #1472

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Jiloc
Copy link
Collaborator

@Jiloc Jiloc commented Mar 4, 2025

Description

Closes: #1462

Changes

  • update_withdrawals and update_deposits now return 403 Forbidden if an api key of the public api (the signers) is trying to set an entry to a status != Accepted
  • stop logging api keys in update_* endpoints.

Testing Information

  • added integration tests

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Jiloc Jiloc added the emily API that communicates with Signers to trigger sBTC operations. label Mar 4, 2025
@Jiloc Jiloc added this to the sBTC: Withdrawal fine tuning milestone Mar 4, 2025
@Jiloc Jiloc self-assigned this Mar 4, 2025
@Jiloc Jiloc requested review from matteojug, djordon and MCJOHN974 March 4, 2025 20:31
@Jiloc Jiloc changed the title [chore] emily filter updates from signers chore: emily filter updates from signers Mar 5, 2025
Comment on lines +452 to +454
if is_unauthorized {
return Err(Error::Forbidden);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should further limit the signers update to state transition from pending to accepted? Otherwise it could be possible that a signer change a confirmed deposit back to accepted. I looked around but I couldn't find anything preventing this, but maybe I'm missing something.

(status = 404, description = "Address not found", body = ErrorResponse),
(status = 405, description = "Method not allowed", body = ErrorResponse),
(status = 500, description = "Internal server error", body = ErrorResponse)
),
security(("ApiGatewayKey" = []))
)]
#[instrument(skip(context))]
#[instrument(skip(context, api_key))]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should we add the api_key skip also to the other ApiGatewayKey endpoints?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed for chainstate endpoints (seems like they were the only ones left) in 4ec3ad7

let is_unauthorized = body
.withdrawals
.iter()
.any(|deposit| deposit.status != Status::Accepted);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit

Suggested change
.any(|deposit| deposit.status != Status::Accepted);
.any(|withdrawal| withdrawal.status != Status::Accepted);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed in 8b58e0f

// --------
let request_id = 1;

// Setup test deposit transaction.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: s/deposit/withdrawal/, multiple occurrences

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed in 8b58e0f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emily API that communicates with Signers to trigger sBTC operations.
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

[Feature] Signers can only change the state of Emily request to Accepted from Pending
2 participants