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

FedCM spec: IdP should validate nonce to prevent CSRF? #582

Closed
obfuscoder opened this issue May 13, 2024 · 11 comments
Closed

FedCM spec: IdP should validate nonce to prevent CSRF? #582

obfuscoder opened this issue May 13, 2024 · 11 comments

Comments

@obfuscoder
Copy link
Contributor

In the current draft of the FedCM spec (https://fedidcg.github.io/FedCM/), section 3.5. Identity assertion endpoint contains the following:

NOTE: An [IDP](https://fedidcg.github.io/FedCM/#idp) should validate the nonce, if present, to prevent CSRF-style attacks.

There is some confusion amongst implementers, what should be validated here?

The nonce is optional and it is the RP's responsibility to define unique nonce values when initiating the FedCM call and compare the returned nonce with the provided one.

@cbiesinger
Copy link
Collaborator

@bvandersloot-mozilla

@samuelgoto
Copy link
Collaborator

I'm thinking that this should be done as part of #536 in userland (e.g. an OAuth Profile layer), rather than in browserland in the FedCM spec per se.

@timcappalli, wdyt?

@achimschloss
Copy link
Contributor

Agreed, if nonce was not already a top level parameter and removing it would be a breaking change it should be userland via https://github.com/fedidcg/FedCM/issues/556 - I guess it would be fair to just remove the note

@aaronpk
Copy link

aaronpk commented May 13, 2024

the comment in the sample code in the spec says this:

// Assume there is a method returning a random number. Store the value in a variable which can
// later be used to check against the value in the token returned.

This assumes the client understands how to parse the token returned, which I thought was not an assumption the FedCM spec wanted to make. I would recommend removing the nonce parameter entirely in favor of moving all of that kind of thing into a different layer as described in #536.

If there is anything FedCM needs to do at the FedCM API layer to mitigate this kind of injection/replay attacks, it should provide the other half of the validation story as well.

@bc-pi
Copy link

bc-pi commented May 13, 2024

@aaronpk's perspective on layering #582 (comment) makes a lot of sense.

@samuelgoto
Copy link
Collaborator

samuelgoto commented May 13, 2024

I would recommend removing the nonce parameter entirely in favor of moving all of that kind of thing into a different layer as described in #536.

Yeah, nonce I think would be an easy (and, I think, only?) target once we introduce w3c-fedid/custom-requests#2.

@cbiesinger
Copy link
Collaborator

In principle I agree with moving nonce to params. However, we have shipped it since the initial version of FedCM and so I am not sure we can remove it now for backwards compatibility reasons.

@obfuscoder
Copy link
Contributor Author

As changing API may be a bit tricky and needs more thinking through, could you at least remove the NOTE I mentioned as @achimschloss suggested?

@samuelgoto
Copy link
Collaborator

As changing API may be a bit tricky and needs more thinking through, could you at least remove the NOTE I mentioned as @achimschloss suggested?

Yeah, that sounds reasonable. Care to send a PR?

We'll get to this at some point, but if you could put together a PR, you may beat us to it.

obfuscoder pushed a commit to obfuscoder/FedCM that referenced this issue May 15, 2024
samuelgoto pushed a commit that referenced this issue May 15, 2024
github-actions bot added a commit that referenced this issue May 15, 2024
SHA: 10794f7
Reason: push, by samuelgoto

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@npm1
Copy link
Collaborator

npm1 commented May 15, 2024

Should we close this issue now?

github-actions bot added a commit to mattdanielbrown/WebID that referenced this issue May 16, 2024
SHA: 10794f7
Reason: push, by pull[bot]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@samuelgoto
Copy link
Collaborator

Should we close this issue now?

Yeah, I think we can close this issue now that this PR has been merged:

#583

I would recommend removing the nonce parameter entirely in favor of moving all of that kind of thing into a different layer as described in #536.

The only suggestion left here unaddressed is this, and I kicked off a separate issue to track it independently of this one:

https://github.com/fedidcg/FedCM/issues/616

npm1 pushed a commit that referenced this issue Jul 31, 2024
npm1 pushed a commit that referenced this issue Sep 18, 2024
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

7 participants