Skip to content

Commit e2ea57f

Browse files
AtkinsSJKernelDeimos
authored andcommitted
tweak(phoenix): Only take auth params from config message
Having the parent app send us arbitrary config values was a holdover from when phoenix was an embedded iframe and not a separate app. It led to a security issue previously. Let's only take the auth parameters since we can't get those otherwise, and they're safe to read. Everything else should be available in our own URL params.
1 parent b713376 commit e2ea57f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/phoenix/src/main_puter.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import { CreateEnvProvider } from './platform/puter/env.js';
2525
import { CreateSystemProvider } from './platform/puter/system.js';
2626

2727
window.main_shell = async () => {
28-
const config = {};
28+
const config = Object.fromEntries(
29+
new URLSearchParams(window.location.search)
30+
.entries()
31+
);
2932

3033
let resolveConfigured = null;
3134
const configured_ = new Promise(rslv => {
@@ -41,10 +44,9 @@ window.main_shell = async () => {
4144
terminal.on('message', message => {
4245
if (message.$ === 'config') {
4346
const configValues = { ...message };
44-
delete configValues.$;
45-
for ( const k in configValues ) {
46-
config[k] = configValues[k];
47-
}
47+
// Only copy the config that we actually need
48+
config['puter.auth.username'] = configValues['puter.auth.username'];
49+
config['puter.auth.token'] = configValues['puter.auth.token'];
4850
resolveConfigured();
4951
}
5052
});

0 commit comments

Comments
 (0)