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

Make showing algo configurable? #20

Open
byrnedo opened this issue Jun 24, 2020 · 7 comments
Open

Make showing algo configurable? #20

byrnedo opened this issue Jun 24, 2020 · 7 comments

Comments

@byrnedo
Copy link

byrnedo commented Jun 24, 2020

This commit 221cfc4
hides the algo from the receiver.

I'm integrating against apis that don't expect this.
Are we open for making this behaviour configurable?

@cjslep
Copy link
Member

cjslep commented Jun 24, 2020

I'm open to it! It could internally be a bool flag. But rather than adding a bool to an existing Signer constructor, let's create a special Signer constructor (ex NewSignerDeprecatedDraft10) that has a comment that documents:

  1. This effective behavior behavior of exposing the algorithm.
  2. That this is based on the old v10 draft of the spec (or older)
  3. To notify API owners that are causing clients to use this NewSignerDeprecatedDraft10 function that they are using an old version of the specification and should update their software to match the specification.

Let me know if this is something you'd like to contribute; otherwise it'll be something I can get to only when time permits.

@byrnedo
Copy link
Author

byrnedo commented Jun 25, 2020

I like the idea of the different constructors. I was thinking of some way of doing it in our fork and thought maybe branches at first but this is much better. I can see if I can put something together.

Actually @cjslep, looking around at the code: wouldn't it be simpler to just have a branch for the draft? Because work involved then is just to reset back to the pre algo hiding commit, push and we're done.

Across the board bug fixes will be more tedious I guess. But the complexity in general would be lower.

@cjslep
Copy link
Member

cjslep commented Jun 26, 2020

We might be talking about the same thing, and I probably wasn't being clear!

If I understand your suggestion of a "branch" to mean "branching statements" in signing.go like the following, I would definitely welcome such mostly-plumbing changes:

setSignatureHeader(..., showAlgoDeprecatedDraft10 bool) {
  ...
  if (showAlgoDeprecatedDraft10) {
    // Old behavior
  } else {
    // current behavior
  }

where both the macSigner and asymmSigner can call this function like:

type fooSigner {
  ...
  showAlgoDeprecatedDraft10 bool
}

func (m *fooSigner) X() {
  setSignatureHeader(..., m.showAlgoDeprecatedDraft10)

And the new NewSignerDeprecatedDraft10 constructor can call newSigner which can now set showAlgoDeprecatedDraft10 to be true on the correct kind of Signer implementation.

Did I understand you correctly, or is this more work than what you had in mind?

@byrnedo
Copy link
Author

byrnedo commented Jun 26, 2020

I actually meant a git branch since I thought those kind of conditions could increase complexity.

@cjslep
Copy link
Member

cjslep commented Jun 26, 2020

Ah I see! Sorry for misunderstanding. I think I'd prefer the code complexity over the organizational complexity of maintaining two git branches.

@khanzf
Copy link

khanzf commented Jan 8, 2022

Hi all, seeing this discussion for the first time, a bit late :) I was about to report the same issue.

While the specification says to hide the algorithm, in practice most implementations rely on the algorithm name. Thus, using hs2019 confuses the pleroma relay application which consumes the algorithms. The long-term solution is obviously to modify the relay application, but for now I agree that there should be a feature that disables hiding the algorithm.

I am not clear on what is being said in this reply. Are you saying that this functionality is already being done?

@khanzf
Copy link

khanzf commented Jan 19, 2022

I used the following hand-jam to replace hs20191 with 1rsa-sha2561. The specific reason was because the pleroma relay application uses the algorithm name, so hs2019` fails.

req.Header["Signature"][0] = strings.Replace(req.Header["Signature"][0], "algorithm=\"hs2019\"", "algorithm=\"rsa-sha256\"", 1)

In my opinion the specification should be reverted.

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

No branches or pull requests

3 participants