#wordpress 2018-06-10

2018-06-10 UTC
#
GWG
Okay, completely rewriting a bunch of the code to be more generic.
#
aaronpk
More generic?
#
GWG
It pulls all rels now, because I might code support for redirect_uri for whitelisting
#
GWG
aaronpk: I just realized I have to manage multiple types of tokens. The Bearer Token, the Authorization Code, and now the State are all being generated the same way. I think I'd better reorganize that.
[grantcodes], jeremycherfas, jeremych- and jeremycherfas_ joined the channel; jeremycherfas left the channel
#
GWG
Okay. Auth code and Access token moved over to more featured way of management. State next
#
GWG
Bed first.
[kevinmarks] joined the channel
#
GWG
aaronpk: I've done a whole boatload of stuff in IndieAuth. I may ask you to have a look when I'm done. It should make it easier to manage the code, I hope.
#
aaronpk
cool! looking forward to it!
#
GWG
aaronpk: I'm already picturing a "Why Did You Do This" moment from either you or pfefferle. That or a commit that says "Indents"
raretrack joined the channel
#
GWG
aaronpk: Be kind today. It's not one of my favorite days of the year.
#
GWG
Not that you aren't usually.
[manton], sketchess, jgmac1106, JHSheridan and [grantcodes] joined the channel
#
Loqi
[dshanske] #67 Refactor and Improve Security
#
GWG
aaronpk: This is just the beginning, but it's a lot of changes.
#
GWG
aaronpk: I'll await the "Why Did You Do This?" Moment.
jgmac1106 joined the channel
#
aaronpk
haha will look in a minute
#
aaronpk
did you at least leave comments about why did you do this?
#
GWG
aaronpk, in the PR
#
GWG
I think this does a lot of good things, but I think I could do more
jgmac1106 and gRegorLove joined the channel
#
aaronpk
GWG: just settled down with some coffee and I'm gonna take a look at this PR now
#
GWG
aaronpk++
#
Loqi
aaronpk has 8 karma in this channel (1644 overall)
#
aaronpk
GWG: it looks like the local verification of authorization codes by the token endpoint is completely gone now
#
GWG
Someone just told me that they have no idea why they want the Indieauth plugin
#
aaronpk
lol, where?
#
GWG
Micro.blog slack PM
#
GWG
I told them what it was for and if they didn't do any of those things, they should disable it
#
aaronpk
good. maybe also add that to the plugin readme?
#
aaronpk
or the wordpress plugin page?
gRegorLove joined the channel
#
GWG
I thought I did. People don't always read the readme
#
aaronpk
GWG: from what I can tell, the plugin now always makes an HTTP request to itself when the token endpoint is verifying the authorization code. I thought you had code in there that looked that up in the database instead
#
aaronpk
oh huh, looks like that was the case in the previous version of the plugin too. so I guess that didn't change in this PR
#
GWG
I did, pfefferle removed it. I may restore it in future
#
aaronpk
why did pfefferle remove it?
#
GWG
It was messing something else up
#
aaronpk
it makes no sense to have the plugin make an http request to itself. that adds so many potential points of failure to what otherwise would be a very straightforward check
#
GWG
I intend to redesign it and reimplement
#
GWG
But it can't use configuration settings.
#
GWG
It needs to figure it out based on the two endpoints being on the same site
#
aaronpk
why can't it uset he configuration settings? I thought that was the point of the setting
#
GWG
Because of his use case
#
aaronpk
I don't believe that
#
aaronpk
there must be another solution
#
GWG
It's why I want to reexamine the issue
#
GWG
Agreed
#
aaronpk
okay, let's come back to this.
#
aaronpk
next question
#
GWG
Exactly
#
aaronpk
I thought class-indieauth-authenticate.php was the file where this plugin consumes other indieauth servers for web sign-in. is that correct?
#
GWG
It still is, but the new websignin class started splitting off the login interface. Why?
#
GWG
Authenticate probably should eventually be renamed authorize
#
aaronpk
there's a bunch of stuff in class-indieauth-authenticate.php about scopes and setting headers, which isn't used at all if you're consuming an existing IndieAuth identity
#
GWG
That's why most of the cin
#
GWG
consuming was moved to the new file
#
aaronpk
oh I see, so class-indieauth-authenticate.php is actually the authorization interface for the built-in authorization endpoint?
#
GWG
I'm trying to make it that way. It was originally a collection of functionality for both
#
GWG
I should rename it now.
#
aaronpk
by "trying to" do you mean this is a completed attempt or work is still in progress?
#
Loqi
yea!
#
GWG
It is a completed attempt, but I think there is always more to do
#
aaronpk
of course there is always more to do. but it's very confusing when you use language like "trying to" because it is not clear whether I am looking at something intended to actually work
#
aaronpk
hm local access token verification seems to have been taken out as well
[pfefferle] joined the channel
#
[pfefferle]
[aaronpk] I removed the local stuff, because the code tries to verify the authentication code with it’s local endpoint instead of the endpoint of the other party… we discussed that a lot
#
aaronpk
[pfefferle]: this is for the web sign-in flow tho right?
#
aaronpk
right so that should have nothing to do with whether the plugin is providing a built-in authorization endpoint
#
[pfefferle]
mixing up too much 😉
#
[pfefferle]
but it did
#
aaronpk
for web sign-in, the assumption is that you are always using an external identity URL so you'd *always* check the remote authorization server
#
aaronpk
but when providing a built-in indieauth server, you'd *always* look up the code locally because this server is the one that generated the code
#
aaronpk
so at least this PR is starting to split out the web sign-in code so that one file isn't trying to do both things
#
[pfefferle]
but it is really hard to review
#
aaronpk
yes I am struggling with that
#
GWG
I think maybe I should have renamed the file now.
#
aaronpk
also I don't see any changes to the wiki page documenting all the use cases
#
GWG
But the implementation works.
#
aaronpk
so that we have a list of things to test
#
GWG
For the things it worked for before
#
[pfefferle]
the usecase I mentioned is in the wiki
#
aaronpk
GWG: did you test all the use cases?
#
GWG
I am still confused I think about pfefferle's use case
#
aaronpk
if so, where is the list you used to walk through everything?
#
GWG
I need to clarify that one to write a clearer list
#
aaronpk
okay i'm going to edit that wiki page right now
#
GWG
I tested using the endpoint for authorization and authentication
#
aaronpk
an empty section with a header
#
GWG
I don't remember. I think I was working on it and may have gotten distracted with something else
#
aaronpk
[pfefferle]: you use relmeauth when doing that?
#
aaronpk
cause that's what that section says
#
[pfefferle]
ah, I saw the relmeauth
#
[pfefferle]
but the my usecase is the same… except the relmeauth stuff
#
aaronpk
that's an important distinction!
#
aaronpk
i'm going to completely replace that use cases section with new content
#
aaronpk
and try to enumerate all the different combinations of things that are or will be supported
#
[pfefferle]
the code seems at least to work for me
#
aaronpk
that's good. I can't get it to work but it might be because I'm using localhost for everything
#
[pfefferle]
Tried one blog with the new code and one with the old
#
[pfefferle]
Will update both and run some more tests
#
GWG
Pfefferle, what do you think of the changes? Does it make the code a little easier to work with?
#
GWG
I got rid of all the cookies
#
aaronparecki.com
edited /Wordpress_IndieAuth_Plugin (+991) "/* Use Cases */ rewrite pfefferle's use case with more detailed steps, stub out additional use cases"
(view diff)
#
aaronpk
[pfefferle]: can you review https://indieweb.org/Wordpress_IndieAuth_Plugin#Logging_in_to_a_multi-user_WordPress_site_via_IndieAuth and add any details about how you configured your two sites?
#
aaronpk
add enough detail so that I can read it and recreate your situation with two wordpress installations so that I can test it myself
#
aaronpk
we should not have to wait for you to test these changes on your own site
#
Loqi
yea!
#
[pfefferle]
Yes, that's it
#
GWG
I am still trying to figure out if the user to url mapping needs further review
#
aaronpk
no additional settings?
#
[pfefferle]
No, not really
#
aaronparecki.com
edited /Wordpress_IndieAuth_Plugin (-16) "/* Web Sign-In */ no additional settings"
(view diff)
#
notiz.blog
edited /Wordpress_IndieAuth_Plugin (+70) "/* Logging in to a multi-user WordPress site via IndieAuth */"
(view diff)
#
[pfefferle]
[dshanske] I only had a quick look, but there are so many changes that makes it hard to say it’s easier to work with 😉
#
GWG
pfefferle, I meant the end product
#
GWG
I moved all the token storage code out.
#
[pfefferle]
what end-product?
#
GWG
I moved the websignin code out of the same file as the Indieauth code
#
GWG
pfefferle, as in... when the changes are finished
#
[pfefferle]
ah ok… perhaps if I dug a bit deeper into the code
#
aaronpk
GWG: in theory, should I be able to disable all the files except the Web_Signin class and have that part still work?
#
GWG
You'd need the global functions, but I think I got everything
#
aaronpk
i'm going to try that
#
GWG
I should test that.
#
GWG
If I didn't, I will
#
[pfefferle]
should we add a setting to also disable the endpoint? to only have the web sign-in?
JHSheridan joined the channel
#
aaronpk
maybe let's save that til we move web sign-in into its own plugin?
#
sknebel
curious, can a plugin install the second plugin on upgrade?
#
aaronpk
I think it can only show a notice
#
aaronpk
so it could say "you need to install this other plugin now" kind of thing
#
GWG
"We have split the sign-on portion into a separate plugin. IndieAuth will only contain the IndieAuth endpoints and authorization code. Please install the web sign-in plugin if you want to sign into your WordPress site with an external IndieAuth endpoint."
#
aaronpk
GWG: so I just tested it, and something in class-indieauth-authenticate.php is still required for web sign-in to work
#
GWG
aaronpk: I'll get it all out. I should have tested that
#
aaronpk
which plugin adds rel=me links to your home page? is that the IndieWeb plugin?
#
GWG
aaronpk: Yes.
#
GWG
There are manual ways, of course, but that is the one that takes them from your user profile.
#
aaronpk
question for GWG and pfefferle: hypothetically, in this new standalone web sign-in plugin, would you like to use indielogin.com as a fallback authentication option if the user is signing in with a site that doesn't support IndieAuth?
#
GWG
aaronpk: I would think so. But is it ready for that?
#
aaronpk
not yet, which is why I said hypothetically
#
aaronparecki.com
edited /Wordpress_IndieAuth_Plugin (+1134) "/* Use Cases */ expand web sign-in via relmeauth use case"
(view diff)
#
GWG
Theoretically, it could do something completely different. But I don't know what that is
#
aaronpk
it could do relmeauth itself, but that requires the person installing the relmeauth plugin on their blog go register github/twitter API keys
#
aaronpk
there are other plugins that do that already so I don't see much value in that
#
GWG
aaronpk: I considered it might need relme checking for other reasons.
#
aaronpk
I wouldn't worry about that for now
#
aaronpk
okay, I installed the IndieAuth plugin for web-sign-in on a test site on a real server so I'll be able to continue to test pfefferle's use case there
#
GWG
I meant as part of the user to url problem, but I'm not worried about it
#
aaronpk
I was able to log in as aaronparecki.com there with the current published version of the plugin
#
aaronparecki.com
edited /Wordpress_IndieAuth_Plugin (+106) "/* Web Sign-In */"
(view diff)
#
aaronpk
GWG: so that I know how to budget my time the rest of the day, are you going to be able to publish some more changes to this PR today still ?
#
GWG
aaronpk: I'm waiting for feedback
#
GWG
Based on your feedback, I might make amendments.
#
GWG
Or, alternatively, if both of you are fine with it so far, might merge it and make additional changes a new PR
#
GWG
Will defer
#
aaronpk
Okay the main thing I would like to see from this PR is that the Web sign in flow works with just its own file
#
GWG
I also have to figure out a fix for Semantic Linkbacks string issue so pfefferle can push that as people are annoyed with a spy icon
#
aaronpk
That will make me feel better about continuing forward with more changes to the IndieAuth side since we'll be less likely to break Web sign in
#
GWG
aaronpk: Do you want me to go back in and work on that while you are looking then?
#
aaronpk
The next PR i want to see local code and token verification come back
#
GWG
I agree with that goal
#
aaronpk
I don't think I have any other feedback right now
#
GWG
aaronpk: I wanted that to be a specific PR from this.
#
GWG
[pfefferle]: Anything from you before I update the PR with that?
#
[pfefferle]
No, I only hope that the local stuff will not kill the authentication again
#
GWG
[pfefferle]: I meant with ensuring the web signin code can work without the auth code
#
GWG
[pfefferle], aaronpk: Pushed split
#
GWG
Also renamed authenticate to authorize to be clearer about it
#
aaronpk
pulls down changes
#
GWG
You can now comment out the endpoints and the authorize functions and it will work
#
GWG
Although both do use the same abstract class, although I suppose I could remove that if I had to
jgmac1106_ joined the channel
#
GWG
aaronpk: How does it look?
#
aaronpk
got distracted with quill
#
aaronpk
one sec
#
aaronpk
sweet, web sign-in works with all the indieauth classes disabled
#
aaronpk
GWG: got some nasty errors entering a URL that doesn't support indieauth. strangely they are in a wordpress core file
#
aaronpk
ah found a bug with your find_rels function
#
aaronpk
if $endpoints is a string and !isset($return[$endpoints]) you should return false
#
aaronpk
also it appears returning a WP_Error from websignin_redirect doesn't actually show that error to the user.
#
GWG
aaronpk, it should. Will have to look at that
#
aaronpk
if you fix the previously mentioned error, then type in a URL that doesn't have an indieauth server, you'll see what I mean
#
aaronpk
don't forget to test the failure cases!
#
GWG
How's it looking so far though?
#
aaronpk
well when it works it works
#
GWG
That's an interesting statement
#
aaronpk
can you push a fix for the find_rels function?
#
GWG
I'm working on it now
#
GWG
It's working oddly
#
aaronpk
I do not understand that sentence
#
GWG
It breaks the redirect.
#
aaronpk
"It's strange that it's working" or "It is working in an unusual way"
#
GWG
I'm trying to figure out why
#
aaronpk
ah ffs wordpress is getting ssl errors trying to fetch itself
#
aaronpk
that took me way too long to track down too
#
GWG
aaronpk: If endpoint is a string and $return[$endpoints] isn't set, I shouldn't return false.
#
GWG
Because it should check html links after that
#
aaronpk
oh okay
#
aaronpk
that's true
#
aaronpk
then the last step needs that
#
GWG
It does. It moved into that code.
#
aaronpk
the problem is right now if you pass in a string for $endpoints, and it's not found, at the very end it returns an array
#
GWG
Then the last setting should be return false, not return $return;
#
aaronpk
maybe return false only if $endpoints is a string?
#
aaronpk
I don't know what the code expects to happen when $endpoints is an array
JHSheridan joined the channel
#
GWG
I think I see the problerm
#
GWG
The return isn't going where it should be
#
aaronpk
found the filter to disable ssl verification thank goodness
JHSheridan joined the channel
#
aaronpk
sweet, can finally log in to stuff with my local wordpress
#
aaronpk
haha now i'm getting the "Unauthorized" error!
#
GWG
Fun
#
GWG
We can troubleshoot it now
#
aaronpk
scopes is blank in the micropub plugin
#
GWG
Back to it not passing scope in correctly.
#
GWG
I'm trying to fix error messages
[grantcodes] joined the channel
#
aaronpk
GWG: okay progress
#
GWG
Oh?
#
aaronpk
error reporting is not working like expected, which is part of why this is so confusing
#
aaronpk
how is the determine_current_user filter supposed to work?
#
aaronpk
er, how is it supposed to tell wordpress there was an error?
#
GWG
aaronpk: I'm fixing error reporting for authenticate now
#
aaronpk
but wordpress does not report that error
#
aaronpk
the next question is why is it failing that in the first place
#
aaronpk
the token endpoint is returning that it's an invalid token
#
GWG
Okay, one error report fixed
#
aaronpk
oh god
#
aaronpk
why didn't I seet his before
#
GWG
There. Also fixed errors in the authenticate function not being returned.
#
GWG
Pushed
#
aaronpk
okay tracked this down to "determine_current_user" is trying to return "User Not Found on this Site"
#
aaronpk
i'm gonna pull your changes in now
JHSheridan joined the channel
#
aaronpk
hopefully your changes will make it more obvious what's going on
#
GWG
I'm going to try to edit the error function.
#
aaronpk
okay, pulled in changes, no change to the "Unauthorized" error
#
aaronpk
the current problem is that "determine_current_user" is trying to set an error but that error is never being returned anywhere
#
aaronpk
now i'm going to try to figure out why "determine_current_user" is failing
#
GWG
Yes. I am looking at that. It's the surfacing that is an issue
#
aaronpk
get_user_by_identifier is returning false
#
aaronpk
aha because $me is set to 'https://tiny.xyz.dev/blog/' and of course that's not a URL on a user record since that's the URL of the site itself
#
GWG
You could try /author/username
#
aaronpk
no I can't
#
GWG
Oh?
#
aaronpk
I logged in as https://tiny.xyz.dev/blog/ into the micropub app, and it issued a token for that URL, so it should be able to verify that token too
#
aaronpk
especially since this site is in single-user mode
#
aaronpk
with local token verification this wouldn't be a problem
#
aaronpk
since the user_id is stored along with the token record
#
aaronpk
so there's no URL matching or lookup that has to happen
#
aaronpk
please do fix surfacing those errors, but how do you feel about ripping out the remote token stuff and replacing it with local lookup right now? now that web sign-in is isolated I don't think there's a use case that requires using a remote indieauth server now
#
GWG
aaronpk: Good point.
#
GWG
There isn't if we split it
#
GWG
I've set up a test to push for an error so I can get it working again
#
aaronpk
we know web sign-in works with just the web sign-in file, so we should be able to rip out a bunch of code from the rest of the files now
#
GWG
Yes.
#
aaronpk
do you think you can do that now?
#
GWG
I'm working on the error problem
tantek joined the channel
#
aaronpk
i'm moving to another project for now but will take a look when you're done
#
GWG
Sorry, people keep calling me for some reason
#
GWG
aaronpk: I found an issue.
#
GWG
If my case, I was running it in a browser that had my cookies enabled, so it was bypassing auth.
#
GWG
I have a curl plugin
#
aaronpk
a curl plugin for what?
#
GWG
For Firefox. To test the error messages, I was using curl to surface messages
tantek__ joined the channel
#
GWG
Okay. I found the problem