Skip to content

Address issues from AI security review - #4

Open
philipr-za wants to merge 3 commits into
mainfrom
ai-security-review
Open

philipr-za wants to merge 3 commits into
mainfrom
ai-security-review

Conversation

@philipr-za

Copy link
Copy Markdown
Collaborator

An AI security review surfaced some potential footguns and vulnerabilities in the repo, mostly in the padding implementation.

This PR addresses those issues.

@philipr-za
philipr-za force-pushed the ai-security-review branch 2 times, most recently from 4582b91 to b69c9de Compare October 30, 2026 14:56
@apoelstra

Copy link
Copy Markdown
Member

I don't like adding the subtle dependency. This adds supply chain risk for little value. (The constant-time functions are only used to protect the padding length, which is a pretty small privacy risk even if we took no protective measures at all.)

Just hand-roll constant time comparison ops like we do in rust-secp256k1.

@philipr-za

philipr-za commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

I don't like adding the subtle dependency. This adds supply chain risk for little value. (The constant-time functions are only used to protect the padding length, which is a pretty small privacy risk even if we took no protective measures at all.)

Just hand-roll constant time comparison ops like we do in rust-secp256k1.

thanks for the review @apoelstra

Took a crack at that. Though the AI notes that the less-than comparitors are a bit trickier to do constant time than equals.

@apoelstra

Copy link
Copy Markdown
Member

I'd just copy the algorithm from https://github.com/dalek-cryptography/subtle/blob/main/src/lib.rs#L879-L908 and it in its own file that's clearly labeled as being BSD-copyrighted to hdv and isis.

@philipr-za

philipr-za commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

I'd just copy the algorithm from https://github.com/dalek-cryptography/subtle/blob/main/src/lib.rs#L879-L908 and it in its own file that's clearly labeled as being BSD-copyrighted to hdv and isis.

Alright, seeing as I was copying the GT/LT stuff I grabbed their equals impl too

@apoelstra

Copy link
Copy Markdown
Member

Can you rebase/squash so that there is no commit adding the subtle dep?

philipr-za and others added 3 commits November 3, 2026 14:05
Manually import subtles constant time eq and gt/lt and used in padding impl
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