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

Bug: Error: [PDOException] SQLSTATE[42S22]: Column not found: 1054 Unknown column 'User.last_api_access' in 'field list' #8814

Open
juju4 opened this issue Dec 10, 2022 · 3 comments
Labels
needs triage This issue has been automatically labelled and needs further triage

Comments

@juju4
Copy link
Contributor

juju4 commented Dec 10, 2022

Expected behavior

No error

Actual behavior

pymisp example scripts failing as seen in log section.

Steps to reproduce

This is part of CI of my MISP ansible role.
At the end of the install, it tests setup with pymisp and few of the example scripts,
This may be related to php hardening and snuffleupagus but disabling those in normal ci does not solve problem so looking for help where this could from as not seeing much more from logs.
Problem occurs for 2 months+ (https://github.com/juju4/ansible-MISP/actions/runs/3166740935/jobs/5156672261#step:14:62) but can't revalidate as github actions logs expired since.

Tested on
centos8, devel-nosnuffle: https://github.com/juju4/ansible-MISP/actions/runs/3665549408/jobs/6196700832#step:9:5646
centos8, devel: https://github.com/juju4/ansible-MISP/actions/runs/3665263094/jobs/6196218176#step:9:5733
ubuntu 20.04, either seems to pass step and fail/stall on kitchen verify: https://github.com/juju4/ansible-MISP/actions/runs/3665263094/jobs/6196218216#step:14:73 - works fine during manual run on vps aka not github actions.
ubuntu 18.04 falls on #8620

Thanks

Version

2.4/HEAD

Operating System

Ubuntu 20.04 (and others)

Operating System version

20.04

PHP version

7.4

Browser

N/A

Browser version

No response

Relevant log output

https://github.com/juju4/ansible-MISP/actions/runs/3665263094/jobs/6196218176#step:14:60

+ sudo kitchen exec default-centos-8-Stream -c 'cat /var/www/_MISP/MISP/app/tmp/logs/error.log'
-----> Execute command on default-centos-8-Stream.
       2022-12-10 18:14:27 Error: [PDOException] SQLSTATE[42S22]: Column not found: 1054 Unknown column 'User.last_api_access' in 'field list'
       Request URL: /admin/users/index
       Stack Trace:
       #0 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Model/Datasource/DboSource.php(502): PDOStatement->execute(Array)
       #1 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Model/Datasource/DboSource.php(468): DboSource->_execute('SELECT `User`.`...', Array)
       #2 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Model/Datasource/DboSource.php(715): DboSource->execute('SELECT `User`.`...', Array, Array)
       #3 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Model/Datasource/DboSource.php(1226): DboSource->fetchAll('SELECT `User`.`...', Array)
       #4 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3053): DboSource->read(Object(User), Array)
       #5 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3025): Model->_readDataSource('all', Array)
       #6 /var/www/_MISP/MISP/app/Controller/UsersController.php(426): Model->find('all', Array)
       #7 [internal function]: UsersController->admin_index()
       #8 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Controller/Controller.php(499): ReflectionMethod->invokeArgs(Object(UsersController), Array)
       #9 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(193): Controller->invokeAction(Object(CakeRequest))
       #10 /var/www/_MISP/MISP/app/Lib/cakephp/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest))
       #11 /var/www/_MISP/MISP/app/webroot/index.php(99): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
       #12 {main}
+ sudo kitchen exec default-centos-8-Stream -c 'cat /var/www/_MISP/MISP/app/tmp/logs/debug.log'
-----> Execute command on default-centos-8-Stream.
       2022-12-10 18:14:05 Notice: Undefined index: REMOTE_ADDR in [/var/www/_MISP/MISP/app/Model/AppModel.php, line 3916]
       2022-12-10 18:14:25 Info: [WORKER PID: 20969][email] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20966][default] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20965][default] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20964][default] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20967][default] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20977][email] - starting to process background jobs...
       2022-12-10 18:14:25 Notice: Notice (8): Undefined index: perm_galaxy_editor in [/var/www/_MISP/MISP/app/Controller/ServersController.php, line 1852]
       Trace:
       ErrorHandler::handleError() - APP/Lib/cakephp/lib/Cake/Error/ErrorHandler.php, line 230
       ServersController::getVersion() - APP/Controller/ServersController.php, line 1852
       ReflectionMethod::invokeArgs() - [internal], line ??
       Controller::invokeAction() - APP/Lib/cakephp/lib/Cake/Controller/Controller.php, line 499
       Dispatcher::_invoke() - APP/Lib/cakephp/lib/Cake/Routing/Dispatcher.php, line 193
       Dispatcher::dispatch() - APP/Lib/cakephp/lib/Cake/Routing/Dispatcher.php, line 167
       [main] - APP/webroot/index.php, line 99
       
       2022-12-10 18:14:25 Info: [WORKER PID: 20963][default] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20970][email] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20978][email] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21019][cache] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21100][prio] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21091][prio] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20994][email] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 20999][cache] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21035][cache] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21068][prio] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21112][prio] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21046][cache] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21047][prio] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21043][cache] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21113][update] - starting to process background jobs...
       2022-12-10 18:14:25 Info: [WORKER PID: 21113][update] - launching job with ID: ea1d3a10-b808-4006-a43e-377ab5de3e07...
       2022-12-10 18:14:25 Info: [JOB ID: ea1d3a10-b808-4006-a43e-377ab5de3e07] - started command `admin runUpdates 1`.
       2022-12-10 18:14:26 Notice: Undefined index: REMOTE_ADDR in [/var/www/_MISP/MISP/app/Model/AppModel.php, line 3916]
       2022-12-10 18:14:26 Notice: Undefined index: REMOTE_ADDR in [/var/www/_MISP/MISP/app/Model/AppModel.php, line 3916]


### Extra attachments

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@juju4 juju4 added the needs triage This issue has been automatically labelled and needs further triage label Dec 10, 2022
@juju4
Copy link
Contributor Author

juju4 commented Jan 28, 2023

Reproduced the problem when ran without role juju4.harden_apache meaning error is not related to php hardening and snuffleupagus

mysql misp db has no "User.last_api_access" but has "users.last_api_access"

code https://github.com/MISP/MISP/blob/2.4/app/Controller/UsersController.php#L431
it seems a separate object.

@iglocska
Copy link
Member

Did your DB updates run? Could you check their status? Also make sure you have an update worker running.

@juju4
Copy link
Contributor Author

juju4 commented Jan 30, 2023

any specific command(s) to check?
any way to call web diagnostics page in command line?

From https://github.com/juju4/ansible-MISP/actions/runs/4033173613/jobs/6933521594#step:23:13
cake Admin securityAudit, cake Admin configLint, cake Admin live` seems to be mostly fine (few errors but don't think related)
https://github.com/juju4/ansible-MISP/actions/runs/4033173613/jobs/6933521594#step:21:12
same for db table structure
Not many other errors
https://github.com/juju4/ansible-MISP/actions/runs/4033173613/jobs/6933521594#step:14:55

On live install, error above appears too at setup but PyMISP calls are working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has been automatically labelled and needs further triage
Projects
None yet
Development

No branches or pull requests

2 participants