apostrophecms / apostrophecms/apostrophe

Signed in guest user get 404 on most pages unless the group guest has view private locales checked

Open
#2,629 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

Using workflow obviously. It was very hard to work out why every guest user got 404's on login even though all pages were set to be public. The fix was to allow the guest group to view private locales. I think the database lost control of the setting after I incorrectly specified one locale as private in app.js then set it back again. This eventually started causing problems with admin user not being able to change locales with every locale striked through!

Apos Version :2.112.1

## To Reproduce
I really don't know how to create this again but it is still going on in my database

Step by step instructions to reproduce the behavior:

Add new user to guest group without 'view private locales'
Sign in as guest user gets and I get 404 right away.

## Expected behavior
A normal non-signed in user being able to view pages in different locales.

**Version of Node.js:**

14.4

**Server Operating System:**
Windows 10 Dev env and Ubutu 18.04.4

These are the docs from the DB that may help in understanding what is going

this is the signup group that is added after a user requests signup
```
{
"_id" : "ckhdrevqc0004s4fzv59rzzax",
"title" : "signup",
"permissions" : [
"guest"
],
"type" : "apostrophe-group",
"slug" : "signup",
"createdAt" : ISODate("2020-11-11T18:51:25.861Z"),
"titleSortified" : "signup",
"updatedAt" : ISODate("2020-12-15T12:39:49.678Z"),
"highSearchText" : "signup signup signup signup guest",
"highSearchWords" : [
"signup",
"guest"
],
"lowSearchText" : "signup signup signup signup guest",
"searchSummary" : "",
"viewGroupsIds" : [],
"viewUsersIds" : [],
"editGroupsIds" : [],
"editUsersIds" : [],
"docPermissions" : [],
"tags" : [],
"trash" : false,
"permissionsLocales" : {
"guest" : {}
}
}
```

I moved the user in guest and made these changes that allowed the user to view pages

![image](https://user-images.githubusercontent.com/690181/102216637-5c26cb80-3ed3-11eb-937f-f1196c5674dc.png)

group guest
```
{
"_id" : "ckgph4s7h0001c0fz2xalexe0",
"title" : "guest",
"permissions" : [
"guest",
"private-locales"
],
"type" : "apostrophe-group",
"createdAt" : ISODate("2020-10-25T18:57:10.349Z"),
"slug" : "guest",
"titleSortified" : "guest",
"updatedAt" : ISODate("2020-12-14T11:46:53.328Z"),
"highSearchText" : "guest guest guest guest",
"highSearchWords" : [
"guest"
],
"lowSearchText" : "guest guest guest guest",
"searchSummary" : "",
"viewGroupsIds" : [],
"viewUsersIds" : [],
"editGroupsIds" : [],
"editUsersIds" : [],
"docPermissions" : [],
"tags" : [],
"trash" : false,
"permissionsLocales" : {
"guest" : {
"default" : true,
"default-draft" : true,
"es" : true,
"es-draft" : true,
"de" : true,
"de-draft" : true
},
"private-locales" : {}
}
}
```

this is the user, I've xxxx out real names and emails
guest user
```
{
"_id" : "ckigwlkkj00vqlwfz04vfr9g9",
"disabled" : false,
"trash" : false,
"type" : "apostrophe-user",
"firstName" : "Rob",
"lastName" : "xxx",
"username" : "xxxxx",
"email" : "xxxxx@gmail.com",
"signup" : true,
"signupAt" : ISODate("2020-12-09T04:19:36.930Z"),
"title" : "Rob xxxx",
"groupIds" : [
"ckhdrevqc0004s4fzv59rzzax",
"ckgph4s7h0001c0fz2xalexe0"
],
"slug" : "user-rob-xxxx",
"createdAt" : ISODate("2020-12-09T04:19:36.931Z"),
"updatedAt" : ISODate("2020-12-15T01:06:22.093Z"),
"titleSortified" : "rob xxxx",
"highSearchText" : "rob xxxx user rob xxxx rob xxxx rob xxxx useridxxxx user rob xxxx",
"highSearchWords" : [
"rob",
"xxxx",
"user",
"useridxxxx"
],
"lowSearchText" : "rob xxxx user rob xxxx rob xxxx rob xxxx useridxxxx rob xxxx",
"searchSummary" : "",
"viewGroupsIds" : [],
"viewUsersIds" : [],
"editGroupsIds" : [],
"editUsersIds" : [],
"docPermissions" : [],
"lastLogin" : ISODate("2020-12-15T01:06:22.084Z"),
"group" : "ckhdrevqc0004s4fzv59rzzax"
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported guest-group and locale-permission state using the issue's step-by-step scenario and the supplied database documents. Compare access for a signed-in guest with and without the private-locales permission; done means public pages and locale changes no longer return 404s for the reported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
authorization, backend, localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.