biscuit-capi: record the error when returning NULL from biscuit_from … - #344
Merged
Merged
Conversation
aojea
marked this pull request as draft
September 25, 2026 15:15
aojea
marked this pull request as ready for review
September 25, 2026 15:15
aojea
force-pushed
the
capi-record-errors
branch
from
September 25, 2026 15:27
551c6f7 to
3dd1234
Compare
…and the build functions `biscuit_from`, `biscuit_builder_build`, `biscuit_authorizer`, `authorizer_builder_build` and `authorizer_builder_build_unauthenticated` converted the `Result` with `.ok()` without calling `update_last_error`, so a caller receiving NULL found `error_kind() == None` and `error_message() == NULL`. `biscuit_from` is the function every binding calls on untrusted input, so an invalid or forged token produced no diagnostic at all. `biscuit_builder_build` also returned NULL silently when the seed was not 32 bytes. Record the underlying error in each of these paths and add a C test that checks `biscuit_from` on garbage reports `FormatDeserializationError` and a short seed reports `InvalidArgument`.
aojea
force-pushed
the
capi-record-errors
branch
from
September 29, 2026 19:23
3dd1234 to
f6f2950
Compare
Contributor
|
Thanks! Note that the |
Contributor
|
a doctest failed because of a timeout. While adding larger timeouts to regular tests is fine, I'm a bit more reluctant to modify doctests the same way |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…and the build functions
biscuit_from,biscuit_builder_build,biscuit_authorizer,authorizer_builder_buildandauthorizer_builder_build_unauthenticatedconverted theResultwith.ok()without callingupdate_last_error, so a caller receiving NULL founderror_kind() == Noneanderror_message() == NULL.biscuit_fromis the function every binding calls on untrusted input, so an invalid or forged token produced no diagnostic at all.biscuit_builder_buildalso returned NULL silently when the seed was not 32 bytes.Record the underlying error in each of these paths and add a C test that checks
biscuit_fromon garbage reportsFormatDeserializationErrorand a short seed reportsInvalidArgument.Assisted by AI