Skip to content

Commit 3bdfce2

Browse files
authored
[5.3] System test in media manager to prevent a rename (#45115)
1 parent e3be9d2 commit 3bdfce2

File tree

1 file changed

+18
-0
lines changed
  • tests/System/integration/administrator/components/com_media

1 file changed

+18
-0
lines changed

tests/System/integration/administrator/components/com_media/Media.cy.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,22 @@ describe('Test in backend that the media manager', () => {
8989

9090
cy.checkForSystemMessage('File or Folder not found');
9191
});
92+
93+
it('can not rename to malicious file', () => {
94+
cy.visit('/administrator/index.php?option=com_media');
95+
cy.wait('@getMedia');
96+
97+
cy.window()
98+
.then((win) => win.Joomla.getOptions('csrf.token'))
99+
.then((token) => cy.request({
100+
method: 'put',
101+
url: '/administrator/index.php?option=com_media&format=json&mediatypes=0,1,2,3&task=api.files&path=local-images%3A%2Fpowered_by.png',
102+
body: { [token]: '1', newPath: 'local-images:/powered.php', move: 0 },
103+
failOnStatusCode: false,
104+
}))
105+
.then((response) => {
106+
expect(response.status).to.eq(500);
107+
cy.readFile('images/powered.php').should('not.exist');
108+
});
109+
});
92110
});

0 commit comments

Comments
 (0)