< 202019-08-21⋎22 >

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:43*Edelbrock has joined
00:44*Edelbrock has left
03:06paul121[m]> I ask because we are hoping to implement OAuth2 in farmOS in the future
03:06paul121[m]I was going to start looking into this !! Haha
05:53*JustTB has joined
06:04*JustTB has quit (Ping timeout: 245 seconds)
08:03skipper_is[m]It is included... The logon form gives you a cookie, you get your token, and use cookie and token for everything else on the future www.bubblecode.net/wp-content/uploads/20
08:04skipper_is[m]Well, a version of OAuth2, there is no refresh token, but works pretty much the same..
08:29skipper_is[m]Bearer Authentication is probably more accurate
09:13*JustTB has joined
09:39skipper_is[m]....Requests still work without the bearer token?!
10:39*JustTB has quit (Quit: Leaving.)
10:54*JustTB has joined
11:11*JustTB has quit (Ping timeout: 245 seconds)
11:42mstenta[m]Ah gotcha. Yea what we have now is not the same as Oauth2
11:42mstenta[m]The token is mainly for preventing cross site request forgery
11:43mstenta[m]If you've ever used one of GitHub's integration features, where you grant access to your GitHub account from other applications, that's oauth
11:44mstenta[m]It's a way to authenticate *without* the other application needing to know your accounts password
11:44mstenta[m]So you can potentially revoke access to a specific app without changing your password (which would revoke access to all apps)
11:45mstenta[m]This is the to-do for adding Oauth2 to farmOS: www.drupal.org/project/farm/issues/30342
12:45skipper_is[m]So /restws/session/token is actually useless?
12:46mstenta[m]Not useless - it's necessary to get the CSRF token, which is required in order to make requests to the JSON endpoints
12:47skipper_is[m]I've just sent a get request, with only the cookie received from user/login, and it worked
12:47mstenta[m]To what endpoint?
12:47skipper_is[m]farm_asset.json?type=animal
12:47mstenta[m]Oh it might only be required for PUT/POST requests... I forget
12:47skipper_is[m]aH OK
12:47skipper_is[m]Oh caps lock
12:47skipper_is[m]I'll try a psot
12:47skipper_is[m]*post
12:48skipper_is[m]403 Access Denied: CSRF validation failed
12:48skipper_is[m] Yea, get works with just cookie
12:48mstenta[m]Cool that makes sense
12:48mstenta[m]FYI all of that is handled by this add-on Drupal module: drupal.org/project/restws
12:49skipper_is[m]I guess... Shouldn't they both be as secure?
12:51mstenta[m]That module basically just asks Drupal "what entity types do you provide?" and then adds JSON/XML endpoints for each
12:51mstenta[m]And it provides the token endpoint
12:52mstenta[m]> I guess... Shouldn't they both be as secure?
12:52mstenta[m]Well it's primarily a protection against CSRF
12:52mstenta[m]en.wikipedia.org/wiki/Cross-site_request
12:52mstenta[m]And GET requests aren't really a risk in that regard
12:52mstenta[m]If you want to prevent reading from the server, then you use access control, not CSRF tokens
12:54mstenta[m]a CSRF attack would be about trying to hijack a user's open session and using it to make changes on the server (POST/PUT)
12:55mstenta[m]> At risk are web applications that perform actions based on input from trusted and authenticated users without requiring the user to authorize the specific action. A user who is authenticated by a cookie saved in the user's web browser could unknowingly send an HTTP request to a site that trusts the user and thereby causes an unwanted action.
12:55mstenta[m]> In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested.
12:56mstenta[m]> Because of this assumption, many existing CSRF prevention mechanisms in web frameworks will not cover GET requests, but rather apply the protection only to HTTP methods that are intended to be state-changing.
13:00skipper_is[m]'self' : _parse_api_page(url=response['self']),
13:00skipper_is[m]Is this just returning the url?
13:03skipper_is[m]Oh, nvm, it is getting the page number from the url
13:31mstenta[m]Where is that?
13:32mstenta[m]Oh in farmOS.py?
13:38skipper_is[m]Yea, got it :)
13:40skipper_is[m]There is no urlparse or parse_qs in micropython
13:54*JustTB has joined
14:09mstenta[m]skipper_is: saw your "death log" feature request... will reply in more detail when i can
14:09mstenta[m]there has been some thought around that...
14:24skipper_is[m]Ok......sounds ominous
14:25mstenta[m]Haha
14:38*JustTB has quit (Ping timeout: 245 seconds)
18:28mstenta[m]skipper_is: I discovered an issue with the patch I made to the Entity API module
18:28mstenta[m]www.drupal.org/project/entity/issues/307
18:28mstenta[m]The change you made manually may cause issues
18:28mstenta[m]Or it may not
18:28mstenta[m]But I'd recommend undoing it and applying the new patch if you can
19:14mstenta[m]skipper_is: I may need to roll back that patch until I have more time to investigate
19:14mstenta[m]You can probably keep the snippet in there that you added for now
20:05skipper_is[m]Currently the other fix didn't seem to be causing any obvious issues.. So I'll leave it for now...
20:06*JustTB has joined
20:28*JustTB has quit (Quit: Leaving.)
20:31skipper_is[m]The requested page "/farmOS/log.json?type=farm_harvest" could not be found. ...Err... What?
20:31mstenta[m]Bah. That's what I was worried about
20:31mstenta[m]You should revert all changes
20:32skipper_is[m]Oki
20:32mstenta[m]Until I get it fully resolved
20:32skipper_is[m]Entity controller... line 200 and something?
20:33skipper_is[m]But if I navigate to the page, I can find it...
20:35skipper_is[m]Reverted, and it is showing the same... must be something I did.. Do I need to restart apache?
20:39mstenta[m]Try clearing Drupal caches
20:39skipper_is[m]The website encountered an unexpected error. Please try again later. Well, it is different!
20:39mstenta[m]`/admin/development/performance`
20:41skipper_is[m]Doesnt exist apparently... gets me to the admin page
20:41mstenta[m]Oh sorry
20:42skipper_is[m]Ooo whole bunch of restws errors..
20:42skipper_is[m]Warning: Invalid argument supplied for foreach() in farm_api_restws_request_alter() (line 144 of /var/www/html/farmOS/profiles/farm/modules/farm/farm_api/farm_api.module).
20:42mstenta[m]`/admin/config/development/performance`
20:42skipper_is[m]Notice: Trying to get property of non-object in restws_file_restws_request_alter() (line 30 of /var/www/html/farmOS/profiles/farm/modules/contrib/restws_file/restws_file.module).
20:43mstenta[m]You can ignore those, that's the same warnings from before from the `restws_file` module
20:43skipper_is[m]Ah ok
20:44skipper_is[m]TypeError: Argument 1 passed to RestWSBaseFormat::getPropertyValues() must be of the type array, string given, called in /var/www/html/farmOS/profiles/farm/modules/contrib/restws/restws.formats.inc on line 478 in RestWSBaseFormat->getPropertyValues() (line 260 of /var/www/html/farmOS/profiles/farm/modules/contrib/restws/restws.formats.inc).
20:44skipper_is[m] This one too?
20:45mstenta[m]That looks different
20:45skipper_is[m]That might be me..
20:47mstenta[m]Hanging out with my toddler for the next few hours, might not be able to help much
20:47skipper_is[m]No worries, mine is asleep :)
20:48mstenta[m]Did clearing caches fix it?
20:48mstenta[m]If not, you may need drush
20:48skipper_is[m]Oh yea, thats why I was there.. leme try
20:49skipper_is[m]Noop
20:49mstenta[m]Bah. I had the same issue
20:49mstenta[m]Drush registry rebuild fixed it
20:50mstenta[m]You're not using the Docker image, right?
20:50skipper_is[m]I am not
20:50skipper_is[m]rebuild registry..... Where might I find that?
20:51mstenta[m]You need drush
20:51skipper_is[m]201
20:51skipper_is[m]{"uri":"https:\/\/home.skipper-iwb.co.uk\/farmOS\/log\/77","id":"77","resource":"log"}
20:51skipper_is[m]success
20:51mstenta[m]Oh? Is it working?
20:51skipper_is[m]Ah log in to the server SSH
20:51skipper_is[m]Yea, seems to be
20:51mstenta[m]Oh great!!
20:52skipper_is[m]Honestly, I've no idea what made it work :P
20:52mstenta[m]Haha probably the cache clear
20:52skipper_is[m]Yea, maybe
20:52skipper_is[m]Bit of a shame the other fix didn't work
20:53mstenta[m]Yea this issue is a deep one... I want to be 100% sure we have it figured out before recommending it
20:53mstenta[m]Don't want to risk messing up your db
20:54mstenta[m]I don't know that it would, but I also don't know that it wouldn't
20:54skipper_is[m]Reminds me, I need to do a backup....
20:54mstenta[m]Yes. Yes yes yes
20:54skipper_is[m]I've not tried to restore from a backup, so I have no idea if my backups are even working
20:54skipper_is[m]Would be nice if there was a builtin backup in Drupal
20:54skipper_is[m]dump everything to a nice zip file
20:54skipper_is[m]files as well
20:54mstenta[m]The backup and migrate module does that
20:55skipper_is[m]Ooo, and here is me fiddling around with pgsql...
20:55mstenta[m]But you could also just roll your own
20:56skipper_is[m]I was just doing pg_dump to save the database, and downloading the sites folder
20:56mstenta[m]Yea that works
20:57skipper_is[m]Is backup and migrate built in, or a download?
20:57mstenta[m]Sometimes a good idea to save the entire web root, so you have the codebase and database versions in sync
20:57mstenta[m]It's an add on
20:57skipper_is[m]Yea, but not in my module list, so I assume I need to install it
20:58mstenta[m]drupal.org/project/backup_migrate
20:58skipper_is[m]Probably isn't compatible with PostGreSQL
20:58mstenta[m]Hmm I would hope it is
20:58mstenta[m]But definitely PGSQL is less tested that MySQL in general it seems
20:59skipper_is[m]I hope so too...
20:59mstenta[m]But you just need a dump, so you can do that and not worry
21:00skipper_is[m]Error
21:00skipper_is[m]The website encountered an unexpected error. Please try again later.
21:00skipper_is[m]Oh yea
21:00mstenta[m]What gave that error?
21:01skipper_is[m]running a backup
21:01skipper_is[m]I suspect it doesnt like Postgresql
21:01mstenta[m]Oh you installed it already
21:01mstenta[m]You're fast :-)
21:02mstenta[m](you know to put downloaded modules in `sites` not `profiles` right?)
21:02skipper_is[m]I installed it through the modules page
21:03skipper_is[m]But it does get installed there
21:03skipper_is[m](in sites)
21:04mstenta[m]Oh gotcha, I never use that
21:04mstenta[m]Also: NEVER update through the UI
21:04mstenta[m]It won't apply patches to modules that farmOS needs
21:04skipper_is[m]How do you patch?
21:05skipper_is[m]I'd just rebuilt the entire thing and copied it across
21:05mstenta[m]There's a big warning on the farmOS update page
21:05skipper_is[m]...hehe.....
21:05mstenta[m]Rebuilt how
21:05skipper_is[m]farm.make
21:05mstenta[m]Oh you have drush?
21:05skipper_is[m]Yea
21:05mstenta[m]Oh good
21:06mstenta[m]Yes, that will automatically patch
21:06skipper_is[m]So I download my sites folder, clone the git, make, copy that to the old location, then copy back in my sites folder..
21:08skipper_is[m]But backup and migrate does NOT like Postgresql, I did a "files only" backup, happy as could be
21:08skipper_is[m]whole site... Nope
21:08skipper_is[m]Drush patches automatically? Do I need to run it?
21:08skipper_is[m]CRON?
21:10mstenta[m]In general I don't recommend building manually with drush
21:10mstenta[m]Much safer to just use the pre built tar file release
21:11skipper_is[m]But that is 18th July...
21:11mstenta[m]See farmOS.org instructions
21:11skipper_is[m]Ooh, the -dev path
21:11mstenta[m]<skipper_is[m] "But that is 18th July..."> Oh I forget, are there recent changes you need?
21:11mstenta[m]Or yea you can use the dev
21:11mstenta[m]But....
21:11skipper_is[m]the changed file types for audio files
21:12mstenta[m](nevermind the but)
21:12mstenta[m]Ok that should work
21:12skipper_is[m]And I think there was a postgresql bug you squashed since 18th
21:13skipper_is[m]So don't drush make build-farm it?
21:14skipper_is[m](How do I update the drupal release? Just copy the files across again?)
21:16mstenta[m]Yea if you download the 7.x-1.x-dev tarball that will be a pre built code base
21:16mstenta[m](essentially the same as what you would get running drush make yourself)
21:16mstenta[m]See farmOS.org for update instructions
21:17mstenta[m]farmos.org/hosting/updating/
21:17skipper_is[m]Yea, so just copy everything over except sites
21:17mstenta[m]Yes
21:17mstenta[m]And run update.php
21:17skipper_is[m]I can manage that
21:17skipper_is[m]Yea
21:18mstenta[m]Yea... Safer than trying to do the drush make yourself IMO
21:18mstenta[m]More consistent
21:18mstenta[m]Or less steps at least
21:18skipper_is[m]Just need an easier way of backup up the database..
21:19skipper_is[m]I dunno, git clone ...... cd cd... drush make.... cp this to that
21:19mstenta[m]Cron script that saves a dump to files dir?
21:19skipper_is[m]Yea, I've not actually tried restoring from the dump, so I'm paranoid I've not dumped the right thing... Do I need pre_Data as well? Too many options in it
21:20mstenta[m](just make sure you don't save it somewhere that's publicly accessible)
21:20skipper_is[m]Indeed!
21:20mstenta[m]Pre data?
21:20skipper_is[m]I'm dumping form pgAdmin, and there are way too many options
21:20mstenta[m]Oh
21:20mstenta[m]Not familiar with that
21:20mstenta[m]But you just need the tables
21:21*uploaded an image: image.png (85KB) < matrix.org/_matrix/media/v1/download/mat >
21:22skipper_is[m]I've just been saying yes to just about everything
21:22mstenta[m]I don't like that... I'd look for the command
21:23skipper_is[m]Oh nice you can just do pg_dump mydb > db.sql
21:23skipper_is[m]and dump the entire DB
21:23mstenta[m]There ya go!
21:23mstenta[m]Yes equivalent to `mysqldump` I assume
21:24skipper_is[m]Thats what I need, I don't need to include pre and post data, or to load via partition root...
21:24skipper_is[m]Or even the unlogged table data..
21:25skipper_is[m]Right then, with that i'm going to hit the rack
21:25mstenta[m]Good good
22:36*JustTB has joined
23:20*JustTB has quit (Ping timeout: 276 seconds)
23:56*JustTB has joined

< 202019-08-21⋏22 >