Skip to content

Conversation

fill-the-fill
Copy link
Collaborator

@fill-the-fill fill-the-fill commented Oct 7, 2025

  • Update documentation
  • Fix issue Bug rationale signature #114 by putting the signature inside a "witness" field.
  • Fix error on incorrect signature
Screenshot 2025-10-07 at 14 08 16
  • Add author signature pre-configuartion
Screenshot 2025-10-07 at 14 07 34
  • Clean UI for author signatures not extending outside of the box
Screenshot 2025-10-07 at 14 08 36
  • Give each author sig a checkmark based on api author verification
Screenshot 2025-10-07 at 14 07 13

Copy link
Collaborator

@mpizenberg mpizenberg left a comment

Choose a reason for hiding this comment

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

I’ve made a first quick read of the PR and pointed to some things that we should change, as well as questions that might lead to doing things differently.

# 1. Name-only:
# { "name": "Cardano Foundation" }
# 2. With full cryptographic witness:
# { "name": "...", "witnessAlgorithm": "ed25519", "publicKey": "...", "signature": "..." }
Copy link
Collaborator

Choose a reason for hiding this comment

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

"signature" can not be part of the pre-configuration, as you can’t pre-sign a non-existing rationale. So let’s also leave the witness out, as the witness will be fully provided by the person when signing. So let’s only support name-only for pre-configurations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved in 63620a3

networkIdTyped =
Address.networkIdFromInt networkId |> Maybe.withDefault Testnet

-- Decode authorPreconfig manually to handle name-only authors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does it need to be handled here again? compared to voterPreconfig which isn’t handled here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved in d0ea2e1

-}
authorWitnessDecoder : JD.Decoder AuthorWitness
authorWitnessDecoder =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let’s not do 3 different formats here, we should only support one format which has the shape of the one in the CIP:

  "authors": [
    {
      "name": "Ryan Williams",
      "witness": {
        "witnessAlgorithm": "CIP-0008",
        "publicKey": "7ea09a34...37480a",
        "signature": "84582a...71409"
      }
    }

We can require that the environment variable to provide pre-defined authors just provide the name anyway, without witness, because the full witness will be generated by the signature creation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved in d8a944d

The CIP-100 verification API only accepts HTTPS URLs.
-}
ipfsToHttpsUrl : String -> String
ipfsToHttpsUrl url =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this manually done everywhere else? or is there already a function doing that at the other places where we do the conversion?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are multiple places where the IPFS to HTTPS is done manually instead of using the ipfsToHttpsUrl function. For consistency I will make them all use the same function from Helper.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved in 09083c7


proxyRequestBody =
JE.object
[ ( "url", JE.string verificationApiUrl )
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’m curious, why not make the request directly? Is it because of CORS? Because any request we send through the server before going to final destination double the traffic and the server costs. If it’s just CORS, we should modify the verifycardanomessage server to accept direct request from the domains we use for the voting tool. Also, let’s move that into the Api module, which contains all requests of the website.

case prop.metadata of
RemoteData.Success _ ->
verifyCip100Metadata actionId prop.metadataUrl
|> Cmd.map ctx.wrapMsg
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let’s avoid sending a request and make the verify server work for every proposal metada we receive. We can make the request only when a proposal is selected. This will significantly reduce both the traffic and the cpu usage for the verify server.

errorMessage =
case decodingError of
JD.Failure message _ ->
if String.contains "No witness found for author" message then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let’s not manipulate stringly typed errors. If we want to identify a specific type of error, let’s return a typed error in the decoder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved in 7547fc8


viewSelectedProposal : ViewContext msg -> ActiveProposal -> Html msg
viewSelectedProposal ctx { id, actionType, metadata, metadataUrl, metadataHash } =
viewSelectedProposal : ViewContext msg -> InnerModel -> ActiveProposal -> Html msg
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we only need 1 field which is the cip100Verification field, let’s just pass that field instead of the whole model.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolved in c001977

@mpizenberg
Copy link
Collaborator

mpizenberg commented Oct 8, 2025

Cool to see that the verify website also has an API endpoint now for verifications. Though as suggested in the review above, we should be using it more sparingly, only after proposal selection, instead of when loading proposals.

Thanks for sharing some visuals also! This way I don’t have to run the thing immediately. Some remarks:

  • In the blue preconfigured thing. It doesn’t seem to me like we need any "preconfigured" marker. Also we should remove the "this author does not require a cryptographic signature" comment. As adding pre-configured names, does not prevent people to sign for these authors.
  • In the list of authors, let’s be careful and not add a "verified" checkmark just aside the author name. Let’s be explicit that the tool verified the signature only, but has no idea if the author is who they claim to be. It’s still the responsibility of the app user to make sure that for example here "Elder Millenial" public key matches the true Elder Millenial person. And this is outside the responsibility of the voting app. So instead we should maybe add a 3rd field with something like: "Signature: verified", or something like that.

@fill-the-fill
Copy link
Collaborator Author

Cool to see that the verify website also has an API endpoint now for verifications. Though as suggested in the review above, we should be using it more sparingly, only after proposal selection, instead of when loading proposals.

Thanks for sharing some visuals also! This way I don’t have to run the thing immediately. Some remarks:

  • In the blue preconfigured thing. It doesn’t seem to me like we need any "preconfigured" marker. Also we should remove the "this author does not require a cryptographic signature" comment. As adding pre-configured names, does not prevent people to sign for these authors.
  • In the list of authors, let’s be careful and not add a "verified" checkmark just aside the author name. Let’s be explicit that the tool verified the signature only, but has no idea if the author is who they claim to be. It’s still the responsibility of the app user to make sure that for example here "Elder Millenial" public key matches the true Elder Millenial person. And this is outside the responsibility of the voting app. So instead we should maybe add a 3rd field with something like: "Signature: verified", or something like that.

Resolved in f0a6c1c, f62e959 and a2ed9a6

@fill-the-fill fill-the-fill requested a review from Copilot October 13, 2025 14:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds author signature preconfiguration functionality to streamline rationale authoring, fixes CIP-100 signature structure to use nested "witness" fields, and enhances UI for signature verification. The changes focus on improving author management and signature validation workflows.

  • Add support for preconfigured authors that can be set via environment variables
  • Update CIP-100 signature structure to use nested "witness" format per standard
  • Implement automatic signature verification with visual feedback and status indicators

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
frontend/static/index.html Add author preconfiguration transformation and initialization
frontend/src/ProposalMetadata.elm Update decoder to use CIP-100 nested witness format
frontend/src/Page/Preparation.elm Add CIP-100 verification API, signature validation, and author preconfiguration support
frontend/src/Page/Cart.elm Replace local IPFS URL conversion with shared helper function
frontend/src/Main.elm Thread author preconfiguration through application state
frontend/src/Helper.elm Add shared IPFS URL conversion utility and improve text wrapping
frontend/src/Api.elm Use shared IPFS URL conversion helper
backend/server.py Add preconfigured authors environment variable support
backend/README.md Document new author preconfiguration environment variable
backend/.env.example Add example configuration for preconfigured authors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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