Repository navigation
Release 8.4.2 #40529
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
Release 8.4.2 #40529
Changes from 5 commits
171a46b
f422eb6
d7bf6f3
ff254bf
3a3f0e1
bc2eb5b
65eadbd
acf3f97
1a28d0c
69df443
25e87d8
0f33a7b
b0c593d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@rocket.chat/meteor': patch | ||
| --- | ||
|
|
||
| Bump @rocket.chat/meteor version. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@rocket.chat/meteor': patch | ||
| '@rocket.chat/rest-typings': patch | ||
| --- | ||
|
|
||
| Fixes the `users.presence` endpoint returning an empty array when called with multiple comma-separated IDs, caused by `ajvQuery` coercing the string into a single-element array after the OpenAPI migration |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@rocket.chat/model-typings': patch | ||
| '@rocket.chat/models': patch | ||
| '@rocket.chat/meteor': patch | ||
| --- | ||
|
|
||
| Ensures that deactivated users have their login tokens cleaned up in users.deactivateidle | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@rocket.chat/meteor': patch | ||
| --- | ||
|
|
||
| Ensures the Meteor method for translateMessage validates access and types |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@rocket.chat/meteor': patch | ||
| --- | ||
|
|
||
| Ensures the autotranslate.translateMessage endpoint checks for room access |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -548,9 +548,20 @@ API.v1.post( | |
| const lastLoggedIn = new Date(); | ||
| lastLoggedIn.setDate(lastLoggedIn.getDate() - daysIdle); | ||
|
|
||
| // since we're deactiving users that are not logged in, there is no need to send data through WS | ||
| const ids = await Users.findActiveNotLoggedInAfterWithRole(lastLoggedIn, role, { projection: { _id: 1 } }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This read-then-update-then-notify sequence can broadcast incorrect user state for users that no longer match the update filter at update time. Prompt for AI agents |
||
| .map(({ _id }: { _id: string }) => _id) | ||
| .toArray(); | ||
|
|
||
| const { modifiedCount: count } = await Users.setActiveNotLoggedInAfterWithRole(lastLoggedIn, role, false); | ||
|
|
||
| ids.forEach((_id) => { | ||
| void notifyOnUserChange({ | ||
| clientAction: 'updated', | ||
| id: _id, | ||
| diff: { 'services.resume.loginTokens': [], 'active': false }, | ||
| }); | ||
| }); | ||
|
|
||
| return API.v1.success({ | ||
| count, | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1392,6 +1392,48 @@ describe('[Users]', () => { | |
| .end(done); | ||
| }); | ||
|
|
||
| it('should return presence for a single id', async () => { | ||
| const res = await request | ||
| .get(api('users.presence')) | ||
| .query({ ids: 'rocket.cat' }) | ||
| .set(credentials) | ||
| .expect('Content-Type', 'application/json') | ||
| .expect(200); | ||
|
|
||
| expect(res.body).to.have.property('success', true); | ||
| expect(res.body).to.have.property('full', false); | ||
| expect(res.body).to.have.property('users').that.is.an('array').with.lengthOf(1); | ||
| expect(res.body.users[0]).to.have.property('_id', 'rocket.cat'); | ||
| }); | ||
|
|
||
| it('should correctly parse comma-separated ids and not return an empty result', async () => { | ||
| const res = await request | ||
| .get(api('users.presence')) | ||
| .query({ ids: `rocket.cat,${credentials['X-User-Id']}` }) | ||
| .set(credentials) | ||
| .expect('Content-Type', 'application/json') | ||
| .expect(200); | ||
|
|
||
| expect(res.body).to.have.property('success', true); | ||
| expect(res.body).to.have.property('full', false); | ||
| // only rocket.cat is guaranteed to be online; admin may be offline | ||
| expect(res.body.users.map((u: IUser) => u._id)).to.include('rocket.cat'); | ||
| }); | ||
|
|
||
| it('should return presence for repeated ids params', async () => { | ||
| const res = await request | ||
| .get(api('users.presence')) | ||
| .query(`ids=rocket.cat&ids=${credentials['X-User-Id']}`) | ||
| .set(credentials) | ||
| .expect('Content-Type', 'application/json') | ||
| .expect(200); | ||
|
|
||
| expect(res.body).to.have.property('success', true); | ||
| expect(res.body).to.have.property('full', false); | ||
| // only rocket.cat is guaranteed to be online; admin may be offline | ||
| expect(res.body.users.map((u: IUser) => u._id)).to.include('rocket.cat'); | ||
| }); | ||
|
Comment on lines
+1423
to
+1435
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Repeated-ids test can pass even if only the first Current assertion still passes when the backend ignores repeated params, because Suggested test hardening it('should return presence for repeated ids params', async () => {
const res = await request
.get(api('users.presence'))
- .query(`ids=rocket.cat&ids=${credentials['X-User-Id']}`)
+ .query('ids=non-existent-user-id&ids=rocket.cat')
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200);
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('full', false);
- // only rocket.cat is guaranteed to be online; admin may be offline
expect(res.body.users.map((u: IUser) => u._id)).to.include('rocket.cat');
});🧰 Tools🪛 OpenGrep (1.20.0)[ERROR] 1424-1426: SQL query built via string concatenation or template literal passed to query()/execute(). Use parameterized queries instead. (coderabbit.sql-injection.raw-query-concat-js) 🤖 Prompt for AI Agents |
||
|
|
||
| it('should return full list of online users for more than 10 minutes in the past', (done) => { | ||
| const date = new Date(); | ||
| date.setMinutes(date.getMinutes() - 11); | ||
|
|
@@ -4770,6 +4812,29 @@ describe('[Users]', () => { | |
| expect(res.body).to.have.property('success', false); | ||
| }); | ||
| }); | ||
|
|
||
| it('should revoke login tokens of deactivated idle users', async () => { | ||
| const idleUser = await createUser(); | ||
| await request.post(api('roles.addUserToRole')).set(credentials).send({ roleId: testRoleId, username: idleUser.username }).expect(200); | ||
|
|
||
| const idleUserCredentials = await login(idleUser.username, password); | ||
| await request.get(api('me')).set(idleUserCredentials).expect(200); | ||
|
|
||
| await updatePermission('edit-other-user-active-status', ['admin']); | ||
| await request | ||
| .post(api('users.deactivateIdle')) | ||
| .set(credentials) | ||
| .send({ daysIdle: 0, role: testRoleId }) | ||
| .expect(200) | ||
| .expect((res: Response) => { | ||
| expect(res.body).to.have.property('success', true); | ||
| expect(res.body).to.have.property('count').that.is.greaterThan(0); | ||
| }); | ||
|
|
||
| await request.get(api('me')).set(idleUserCredentials).expect(401); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This test does not prove login tokens were revoked; a 401 can happen just because the user was deactivated. Prompt for AI agents |
||
|
|
||
| await deleteUser(idleUser); | ||
| }); | ||
| }); | ||
|
|
||
| describe('[/users.requestDataDownload]', () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The changeset summary appears unrelated to this PR’s actual fixes, so release notes for this patch will be misleading.
Prompt for AI agents