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

Store _pronamic_payment_key in JSON #237

Closed
Tracked by #218
remcotolsma opened this issue Oct 5, 2021 · 2 comments
Closed
Tracked by #218

Store _pronamic_payment_key in JSON #237

remcotolsma opened this issue Oct 5, 2021 · 2 comments

Comments

@remcotolsma
Copy link
Member

remcotolsma commented Oct 5, 2021

@rvdsteege How should we name this in JSON?

payment {
    "key": "..."
}

Is just key clear enough?

  • $payment->get_key()
  • $payment->set_key( $key )

Or should we put this away in meta? Did we borrow the concept of a key from WooCommerce orders?

In #201 (comment) i also describe a rewrite rule like:

http://pay.local/abonnement-inzien/{secret_40_chars_sha_1_hash}
http://pay.local/abonnement-inzien/9cf95dacd226dcf43da376cdb6cbba7035218921

Also with the note:

Use wp_hash( $subscription->get_id() ) for an unique hash in a public URL, if users generate new salts (https://api.wordpress.org/secret-key/1.1/salt/) the old public links will also no longer work.

In https://docs.google.com/spreadsheets/d/1CJHnHcr9s8lkh4Fq9HQmlAThCK69eXiTC3UktyeQKYw/edit?usp=sharing we also suggested to store the key in wp_posts.post_password.

There is no index on the wp_posts.post_password so maybe wp_posts.post_name is even a better choice?

The current payment/subscription key is also not a wp_hash( $subscription->get_id() ) key.

@remcotolsma
Copy link
Member Author

Intuitively I think we should move away from the key property and use dynamically generated hashes that can be invalidated by setting new secret keys (https://api.wordpress.org/secret-key/1.1/salt/).

The key is currently used in i think return, redirect and subscription action URLs:

Now old payments without key/hash were also allowed through, but for the future we can always require a hash? How bad is it that a return/redirect URL of an old payment no longer works?

@remcotolsma
Copy link
Member Author

remcotolsma commented Oct 6, 2021

For now decided to simply use:

payment {
    "key": "..."
}

pronamic/wp-pay-core@eca6822

remcotolsma added a commit to pronamic/wp-pay-core that referenced this issue Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants