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

Audit fixes #32

Merged
merged 7 commits into from
Dec 23, 2024
Merged

Audit fixes #32

merged 7 commits into from
Dec 23, 2024

Conversation

chcmedeiros
Copy link
Contributor

No description provided.

Comment on lines +271 to +273
if (cla != CLA) {
THROW(APDU_CODE_COMMAND_NOT_ALLOWED);
}
Copy link
Member

Choose a reason for hiding this comment

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

Why are we doing this so explicit when we don't do the same on other apps? any difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is discussible, and I'm glad you point it out.
There might be a case where the transaction has ETH_CLA, and it comes with an ETH instruction not supported but that collides with a flare app instruction.
The app would treat this ETH transaction has a flare transaction.
The format of the transactions is different, so I would say it's impossible the app would parse and sign with success an ETH transaction using the flare parser.
But the auditors pointed this out, so I decided to add that extra check to make sure only flare transactions go through.
What do you think @emmanuelm41 ?

@@ -118,8 +118,7 @@ zxerr_t _sign(uint8_t *output, uint16_t outputLen, const uint8_t *message, uint1
const err_convert_e err_c =
convertDERtoRSV(signature->der_signature, tmpInfo, signature->r, signature->s, &signature->v);
if (err_c == no_error) {
*sigSize =
sizeof_field(signature_t, r) + sizeof_field(signature_t, s) + sizeof_field(signature_t, v) + signatureLength;
Copy link
Member

Choose a reason for hiding this comment

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

Was this signaatureLength empty (0) before? or was not this working?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the rypto-sign for non-evm transactions, we are only returning the signature in the r,s,v format.
Here we should be doing the same because the DER format was not needed.

@emmanuelm41 emmanuelm41 merged commit 6d61786 into dev Dec 23, 2024
34 checks passed
@emmanuelm41 emmanuelm41 deleted the audit-fixes branch December 23, 2024 14:45
emmanuelm41 added a commit that referenced this pull request Dec 23, 2024
* add  flare CLA extra verification

* remove not needed DER signature from response

* update zxlib

* bump version

* update fuzzer

* update docs

* update docs
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