< 282020-11-29⋎30 >

farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Feature requests and bug reports: github.com/farmOS/farmOS/issuesSet by ChanServ on 2018-08-16 at 14:32
00:28holz[m]<mstenta[m] "You mention you're using POST to"> Hello follow-up question ~ So I am unable to POST to create new records at /log, I am still getting error "500 Service unavailable (with message)". Retrieving data with GET is no problem for me. Again, I am using oauth2 password credentials grant, hosting via farmier. Any pointers?
00:45mstenta[m]Do the example `curl` commands work?
00:45mstenta[m]farmos.org/development/api/#creating-rec
04:06*farmBOT has joined
05:26*mmn has quit (Remote host closed the connection)
05:45*mmn has joined
08:37*mmn has quit (Quit: goodbye)
09:00*farmtech[m] has quit (Quit: Idle for 30+ days)
10:26holz[m]<mstenta[m] "Do the example `curl` commands w"> No, perhaps I have some small mistake. This is what I did:
16:00*zedrickr11[m] has quit (Quit: Idle for 30+ days)
17:45paul121[m]holz: That looks correct. I'm curious what would happen if you try Session auth, could you try that? farmos.org/development/api/#2-session-co
17:45paul121[m]ohhh actually... it looks like your `timestamp` is in milliseconds, not seconds
17:45paul121[m]that might create the 500 error
17:46paul121[m]try `1606644424` instead
18:21mstenta[m]Ah good catch!
18:36symbioquine[m]@paul121 In farmOS 2.x is it expected for the `farm` oauth2 client to allow the "Authorization Code" Grant type to proceed for any domain without a confirmation prompt?
18:37symbioquine[m]paul121: ^
18:43symbioquine[m]I might be missing something, but it looks like a site at "my.malicious.example.com/" could redirect a user who is already logged into their farmOS instance to "my.example.farm/oauth/authorize?response" and the user would be redirected immediately without any prompt to
18:43symbioquine[m]"my.malicious.example.com/farmOSGrantHand"
18:43paul121[m]Hmmm that doesn't sound right. I think we should consider disabling authorization code grant for the default client altogether
18:44symbioquine[m]If I check the "third party" box it works as expected - showing a prompt...
18:44paul121[m]Simple oauth has a setting for "trusted clients" or "remembered clients" or something that will allow the client to automatically be re-authorized without form, once it is authorized once. That's a configurable option on the client I believe
18:44*uploaded an image: image.png (26KiB) < matrix.org/_matrix/media/r0/download/mat >
18:45paul121[m]Ah okay. Yea, maybe if it isn't "third party" then simple oauth doesn't display the authorization form
18:47symbioquine[m]Just curious, what's the intended use-case for that oauth client?
18:48symbioquine[m]Is it the "Resource Owner" grant flow to allow clients like farmOS.py?
18:51symbioquine[m]This all came up because I was testing accessing farmOS 2.x from QGIS and the oauth2 setup seemed "a bit too easy" so I started poking around... :)
18:51paul121[m]It's meant to just be a default client so something is available to use, but that is a bit of an oauth anti-pattern. There really shouldn't be one client that's used for multiple purposes
18:52paul121[m]Yea that oauth connection would be great!
18:54paul121[m]IMO we should disable that client by default, and have a `farm_dev` instead. Provided with an optional module. But having a default client available might make sense... mainly for convenience though? I think mstenta pushed for the default option ;-)
18:57symbioquine[m]There's also some weird behavior with simple_oauth - for example if you pass a non-existent client id it returns a 401 which causes the browser to pop up a basic auth dialog;
18:57*uploaded an image: image.png (45KiB) < matrix.org/_matrix/media/r0/download/mat >
18:58symbioquine[m]But as far as I can tell, there's nothing useful a normal user could do at that point.
19:00paul121[m]Oh interesting
19:00symbioquine[m]OTH, with oauth2_server you get a sensible error message; `{"error":"invalid_client","error_description":"The client id supplied is invalid"}`
19:00paul121[m]That may actually be a "bug" we've introduced...
19:01symbioquine[m]with that patch?
19:01paul121[m]We modified simple oauth to use strings as client_id identifiers, rather than UUIDs
19:01paul121[m]So we change the logic of how the consumer entities are looked up
19:02paul121[m]But... It should still be compatible with UUIDs
19:02paul121[m]Maybe that is an edge case, if nothing is found, we're over-ordering the default behavior
19:04symbioquine[m]oauth2_server returns that message with a http 400 code
19:08symbioquine[m]I think the "bug" is here; github.com/thephpleague/oauth2-server/bl
19:08mstenta[m]> IMO we should disable that client by default, and have a `farm_dev` instead. Provided with an optional module. But having a default client available might make sense... mainly for convenience though? I think mstenta pushed for the default option ;-)
19:08mstenta[m]Yea I thought it would be nice to have a simple default for farmOS.py, curl, etc that didn't require enabling another module
19:08symbioquine[m]But it's somewhat subjective...
19:09mstenta[m]But it should be limited to password auth I think
19:10symbioquine[m]I'm going to open an issue with thephpleague/oauth2-server anyway and see what happens... :)
19:14paul121[m]Oh wow! It's in the php library. Interesting. Worth mentioning I'm not too sure if oauth2_server was very up to spec in D7
19:14paul121[m]Although the oauth spec is a bit all over the place
19:14symbioquine[m]Yeah, I hope the spec doesn't require http 401...
19:14symbioquine[m]That would be surprising :)
19:15symbioquine[m]I'll open the issue and let it get sorted out there. That way at least there's a tracking issue for the surprising behavior even if it turns out that it is just following the spec.
19:15paul121[m]Also the new oauth2_server module for D8 was refactored to use that same thephpleague library! The released that right after we got done implementing simple_oauth haha
19:16paul121[m]Cool! Curious where that goes
19:16paul121[m]I gtg! Talk later
19:22symbioquine[m]<mstenta[m] "But it should be limited to pass"> Agreed. I just don't see a way to turn off the Authorization Code grant flow...
19:23symbioquine[m]If we could, then I believe the behavior would match that of the default client in farmOS 7.x-1.x
19:24mstenta[m]This is where the client gets created: github.com/farmOS/farmOS/blob/c837e626b1
19:24mstenta[m]But paul121 is more familiar than I am, I might defer to him when he's back :-)
19:25mstenta[m]One thing I wanted to mention to you, though, symbioquine - just to be sure you're aware: we are not writing auto-update code for 2.x until we release the first official beta
19:26mstenta[m]So we're sort of working under the assumption that farmOS 2.x is being installed fresh at this point... as things change in the dev branch they won't auto-update existing deployments
19:27mstenta[m]So this one is a good example... if we change the code in `hook_install()` it will NOT update the client in any farmOS 2.x databases that are already installed
19:27mstenta[m]After beta release, we'll start to include `hook_update_N()` functions that include update logic
19:28mstenta[m]Just isn't worth our time (or all the added code) in the pre-beta dev phase
19:28mstenta[m]Hopefully by the time we release a beta, most things will be pretty solid, so update code will be limited
19:29symbioquine[m]Makes sense. I'm just doing dev testing at this point so I can just blow away the whole install between tests :)
19:30mstenta[m]Cool! That's what I figured - just wanted to make sure :-)
19:30mstenta[m]We should probably post that somewhere so it's explicit
19:31mstenta[m](Although we don't really have "farmOS 2.x" posted anywhere prominent, so most people probably don't know about it)
19:33mstenta[m]Oh so on another topic you might be interested in... I've been playing around a bit with a modified `.github/workflows/run-test.yml` file that can be used in contrib modules for automated testing
19:33mstenta[m] * Oh so on another topic you might be interested in... I've been playing around a bit with a modified `.github/workflows/run-tests.yml` file that can be used in contrib modules for automated testing
19:35mstenta[m]It's based off of the farmOS `run-tests.yml` with a few differences:
19:35mstenta[m]- Doesn't build the docker containers - just pulls the `2.x` and `2.x-dev` images from Docker Hub
19:35mstenta[m]- Does a few things to allow the contrib module to be required via Composer, so that other dependencies get pulled in
19:35mstenta[m]I was thinking... it might be nice to try to package something like this up as an action in the GitHub Actions marketplace
19:35mstenta[m]Because it's going to be pretty much boilerplate that other modules could largely copy
19:36mstenta[m]I haven't made reusable actions before, but it sounds like it would be a good option
19:36*sent a long message: < matrix.org/_matrix/media/r0/download/mat >
19:36mstenta[m]Cool! Here I'll paste what I have into a gist.... one sec
19:36symbioquine[m]Was just thinking yesterday that I need to figure out how to do that...
19:37mstenta[m]I got it working... but it might benefit from some improvements
19:38mstenta[m]And like I said... I'd rather not have to copy+paste+modify this in every module (and update when changes are needed) - so maybe a github marketplace action would help
19:38mstenta[m]gist.github.com/mstenta/90d1caa7cddfb4f9
19:39mstenta[m](context: this is for a `farmier` module, which I install on farmier-hosted sites to do a few small overrides etc - so you can search/replace "farmier" with your module name)
19:40mstenta[m]> I got it working... but it might benefit from some improvements
19:40mstenta[m]In particular, I had to do a few things to work around the `www-data` user id `33` thing... (thanks for documenting that btw - i might have forgotten and spent longer trying to debug it had i not just recently read your comments)
19:41symbioquine[m]:)
19:41mstenta[m]> Does a few things to allow the contrib module to be required via Composer, so that other dependencies get pulled in
19:41mstenta[m]To do this, I am basically just checking out the repo into the `www` folder AFTER the containers are started (so that it's available in the container), and then use `composer config` to add a local repository
19:42mstenta[m]Then `composer require` works
19:42symbioquine[m]Yeah, that workflow looks pretty straight-forward (hind-sight being what it is) :)
19:42mstenta[m]Cool!
19:42mstenta[m]Have you ever made a github marketplace action?
19:42mstenta[m]Curious what's involved
19:42symbioquine[m]no idea
19:43symbioquine[m]Can't imagine it would be too hard though...
19:43mstenta[m]docs.github.com/en/free-pro-team@latest/
19:45mstenta[m]jgaehring and I talked about doing something similar for Field Kit module packaging
19:45mstenta[m](to basically run npm install, create a tarball, attach it to a release, etc)
19:46mstenta[m]So maybe it would make sense to have a dedicated repo for farmOS-related actions we provide to the community... at github.com/farmOS/farmOS-actions or something
19:47mstenta[m](Which I assume would just be the source code... but the actions themselves would be published to the marketplace, and devs could include them in their workflow files as they wish)
19:47mstenta[m]But we can work up to that :-)
19:48mstenta[m]Dogfood them ourselves for a bit first... even if it means having the same code in multiple repos
19:55symbioquine[m]github.com/thephpleague/oauth2-server/is
19:56symbioquine[m]<mstenta[m] "So maybe it would make sense to "> According to docs.github.com/en/free-pro-team@latest/ "Each repository must contain a single action."
19:56mstenta[m]ahh..
19:56mstenta[m]oh well
19:56symbioquine[m]So maybe create one called "farmOS-module-test-gh-action" for now? :)
19:56mstenta[m]yea something like that
19:57mstenta[m]maybe `farmOS-action-*`?
19:57mstenta[m]`farmOS-action-run-rests` or something
19:57mstenta[m]so they all get alphabetically sorted in the repo list :-)(
19:57mstenta[m] * so they all get alphabetically sorted in the repo list :-)
19:57symbioquine[m]yeah, not sure but it might be worth making the name communicate that it's a "Github" action...
19:57mstenta[m]mm yea perhaps
19:58mstenta[m]we could also consider creating a github.com/farmOS-actions group
19:58mstenta[m]and putting them in there
19:58symbioquine[m]I don't know if the repository name needs to match the action name in the marketplace.
19:58mstenta[m]we already have github.com/farmOS-legacy, where I move old stuff
19:59symbioquine[m]If not, maybe the repository name includes "gh" or "github", but the action name doesn't need to since it appears in the context of the Github actions marketplace.
19:59mstenta[m]yea
19:59mstenta[m]if we put them in their own org, then we could just make it clear that the org is for github actions... so we don't need it in the repo name
20:00symbioquine[m]that could work too
20:00mstenta[m]most users of them wouldn't be looking for actual repos anyway... so it's ok if it's not in the farmOS org
20:00mstenta[m]they'd find them via the marketplace i assume... or by copying other modules
20:00symbioquine[m]<symbioquine[m] "github.com/thephpleague/"> paul121: in case you wanted to follow along on that issue
20:01symbioquine[m]<mstenta[m] "they'd find them via the marketp"> or ideally from the documentation :)
20:01mstenta[m]yes yes
20:02mstenta[m]i set up the org and added you as a member :-)
20:03symbioquine[m]cool
20:04symbioquine[m]I was just getting around to creating a repository for the WFS module development to happen in so hopefully soon I'll check in a stubbed version of the controller and try to get the WFS compliance test suite running against it using that action...
20:04mstenta[m](this way too... if we ever move off of GitHub we just leave this behind)
20:05symbioquine[m]makes sense
20:05mstenta[m]neat!
20:06symbioquine[m]opengeospatial.github.io/ets-wfs20/
20:06symbioquine[m] * I was just getting around to creating a repository for the WFS module development to happen in so hopefully soon I'll check in a stubbed version of the controller and try to get the WFS conformance test suite running against it using that action...
20:06mstenta[m]oh very cool
20:07symbioquine[m]Seems like WFS 2.0 makes more sense than 3.0 for now since QGIS doesn't support WFS 3.0 yet.
20:07mstenta[m]ah
20:09symbioquine[m]QGIS also supports something called "OGC API - features"... but I haven't been able to make very much sense of it yet; www.ogc.org/standards/ogcapi-features
20:10mstenta[m]makes sense to focus on what's supported by qgis
20:10symbioquine[m]<symbioquine[m] "QGIS also supports something cal"> It almost looks like it might be possible to make the JSON:API endpoint compatible with it... but I haven't fully GROKed it yet
20:11symbioquine[m]Seems almost too free-form...
20:11mstenta[m]oooh interesting
20:11symbioquine[m]docs.opengeospatial.org/is/17-069r3/17-0
20:48*farmtech[m] has joined
21:36holz[m]<paul121[m] "try `1606644424` instead"> works!! amazing, thanks!
21:37mstenta[m]@holz usually 500 means there's a bug somewhere... ideally a validation issue like that should throw a different code
21:37mstenta[m]so you shouldn't expect to see 500s normally
21:38mstenta[m]we're working on farmOS 2.x, which has a completely different framework for the API, so hopefully it is already fixed there :-)
21:45holz[m]<mstenta[m] "we're working on farmOS 2.x, whi"> Exciting! Maybe a vague question: I am making a nodejs app, should I be expecting some major changes?
21:48mstenta[m]yes haha
21:48mstenta[m]2x.farmos.org/development/api/changes/
21:49mstenta[m]that is a work in progress document... we are adding to it as we build out the farmOS 2.x data architecture - so it is still missing things that we have not upgraded to 2.x yet
21:49mstenta[m]we are aiming for Spring 2021
21:49mstenta[m]to start beta
21:49mstenta[m]so you may want to still target the 1.x API in the short term... depends on what you're doing I suppose
21:50mstenta[m]but we will document all the changes in that doc, so it should make the upgrade process pretty straightforward when the time comes...
21:51mstenta[m]for the most part, the data model itself will be roughly the same (with some notable exceptions)
21:51mstenta[m]the endpoints themselves are changing, and we're using JSON:API and JSON Schema - so the JSON structure is changing
21:51mstenta[m]and a bunch of names are changing (eg: dropping the `farm_` prefix from log types)
21:52mstenta[m]basically just cleaning up the old API and making it perfect (and less Drupal-y) :-)
21:58holz[m]mstenta: nice, glad to have the heads up. I have a short term goal for the end of December so I will work with the 1.x API. the WIP document is super useful, seems like upgrading on my end will be fairly straightforward!
22:03mstenta[m]Great!

< 282020-11-29⋏30 >