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

docs: add section on replay protection to getting-started #400

Closed
wants to merge 4 commits into from

Conversation

rflechtner
Copy link
Contributor

@rflechtner rflechtner commented Jun 7, 2021

fixes KILTProtocol/ticket#1373

Adds a little section on how the timestamps in messages help with replay protection.
Also updates the example on how to remove properties from a credential, which I missed when merging #398

How to test:

Read, understand, complain if you want.

Checklist:

  • I have verified that the code works
  • I have verified that the code is easy to understand
    • If not, I have left a well-balanced amount of inline comments
  • I have left the code in a better state
  • I have documented the changes (where applicable)

@rflechtner rflechtner changed the title docs: add section on replay protection to getting started docs: add section on replay protection to getting-started Jun 7, 2021
@rflechtner rflechtner requested a review from tjwelde June 7, 2021 14:25
Copy link
Contributor

@tjwelde tjwelde left a comment

Choose a reason for hiding this comment

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

I think the time calculations are wrong. please have a look

}
```

### 6.3. Replay Protection

In certain use cases, an attacker may intercept and copy credential submissions traveling from claimers to verifiers in an attempt to convince the verifier to accept the credential submission again later on.
Copy link
Contributor

Choose a reason for hiding this comment

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

Or, the claimer copies the message to give it to their friends.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeaaaah, but... if the owner is in on it, they could also just re-submit. It's not like you would alter the origin/sender by giving someone a copy of your message

if (
submissions.has(encrypted.hash) ||
encrypted.createdAt > Date.now() + MAX_ACCEPTED_AGE ||
encrypted.createdAt < Date.now() + MIN_ACCEPTED_AGE
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
encrypted.createdAt < Date.now() + MIN_ACCEPTED_AGE
encrypted.createdAt > Date.now() - MIN_ACCEPTED_AGE

Creation date can lie up to 1s in the future

if MIN_ACCEPTED_AGE would be a positive number, this could become a + and would be easier to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it would however clash with the variable name a bit; here, if you set the MIN_ACCEPTED_AGE to 1s, then messages cannot be more recent than 1s in the past (age of 1s), if you set it to -1s, they cannot be more recent than one second in the future.

@rflechtner rflechtner requested a review from tjwelde June 8, 2021 08:31
@ntn-x2
Copy link
Member

ntn-x2 commented Nov 5, 2021

@tjwelde @Dudleyneedham I have "unstaled" this PR so that it can be merged.
@Dudleyneedham could you please double-check that nothing from your PR has been mistakenly changed when updating this PR?
@tjwelde do you think your concerns have been properly addressed by Raphael's comments? If so, you could perhaps approve the PR or otherwise I could try to address any outstanding concerns.

@ntn-x2 ntn-x2 requested a review from Dudleyneedham November 5, 2021 08:05
@rflechtner rflechtner marked this pull request as draft May 10, 2022 16:02
@rflechtner
Copy link
Contributor Author

rflechtner commented Jun 2, 2022

This is superseded by KILTprotocol/docs#100

@rflechtner rflechtner closed this Jun 2, 2022
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.

3 participants