A user ohm-s reported that Discourse SSO is incorrectly granting admin privileges to users despite the SSO payload explicitly setting admin=false. The issue persisted even with a non-developer email and using an admin API key for signing. IAmGav suggested checking DISCOURSE_DEVELOPER_EMAILS, but ohm-s confirmed the email was unrelated. Debugging via verbose_discourse_connect_logging was advised IAmGav. Further investigation revealed a deeper bug: ActiveRecord queries were ignoring user filters, causing notifications and topics to display globally instead of per-user ohm-s. Manual fixes to add WHERE clauses worked temporarily but weren’t sustainable ohm-s. After ruling out plugins and environment issues, ohm-s resolved the problem by starting a fresh Docker container and migrating data — rebuilding the existing container did not help. The issue appears tied to a corrupted or misconfigured container state rather than core SSO logic. #closed
I am integrating discourse SSO, however I am facing a problem where the user being created is getting admin privileges even though that the SSO payload explicitly states that he shouldn’t be.
I am on the latest beta: 2.8.0.beta6 [ f3273bd43e ]
Here is a an example:
I justed with omar+member9@306.dev which is a totally different domain and not on DISCOURSE_DEVELOPER_EMAILS but the issue is still there, the user got admin access
The api key I am using to sign the SSO belongs to admin, does that affect anything ?
I just integrated SSO on an existing discourse site and I am getting this behavior.
The site is running using docker (discourse_docker repo)
I logged in to the container and access the postgres db, the user has admin flag as false in the db so it is not being updated by the “make_developer_admin” method
To assist in debugging DiscourseConnect you may enable the site setting verbose_discourse_connect_logging . By enabling that site setting rich diagnostics will show up in YOURSITE.com/logs . Be sure to the warnings box at the bottom of YOURSITE.com/logs .
it looks like some kind of filtering bug using ActiveRecord api, i logged the queries and I don’t see userid in the where filter so it looks it is pulling the notifications data globally
Same thing i guess is happening with forums / topics, it is somehow ignoring the userid filter and getting everything
It looks like user.notifications is not adding the filter , i have manually added a where condition in the code and it got fixed in the modal notifications display, but in the details page, it uses a different code path so it is still displaying everything. What’s the real solution ?