@@ -81,7 +81,8 @@ namespace confighttp {
81
81
void send_response (resp_https_t response, const nlohmann::json &output_tree) {
82
82
SimpleWeb::CaseInsensitiveMultimap headers;
83
83
headers.emplace (" Content-Type" , " application/json" );
84
-
84
+ headers.emplace (" X-Frame-Options" , " DENY" );
85
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
85
86
response->write (output_tree.dump (), headers);
86
87
}
87
88
@@ -103,7 +104,9 @@ namespace confighttp {
103
104
104
105
const SimpleWeb::CaseInsensitiveMultimap headers {
105
106
{" Content-Type" , " application/json" },
106
- {" WWW-Authenticate" , R"( Basic realm="Sunshine Gamestream Host", charset="UTF-8")" }
107
+ {" WWW-Authenticate" , R"( Basic realm="Sunshine Gamestream Host", charset="UTF-8")" },
108
+ {" X-Frame-Options" , " DENY" },
109
+ {" Content-Security-Policy" , " frame-ancestors 'none';" }
107
110
};
108
111
109
112
response->write (code, tree.dump (), headers);
@@ -119,7 +122,9 @@ namespace confighttp {
119
122
auto address = net::addr_to_normalized_string (request->remote_endpoint ().address ());
120
123
BOOST_LOG (info) << " Web UI: [" sv << address << " ] -- not authorized" sv;
121
124
const SimpleWeb::CaseInsensitiveMultimap headers {
122
- {" Location" , path}
125
+ {" Location" , path},
126
+ {" X-Frame-Options" , " DENY" },
127
+ {" Content-Security-Policy" , " frame-ancestors 'none';" }
123
128
};
124
129
response->write (SimpleWeb::StatusCode::redirection_temporary_redirect, headers);
125
130
}
@@ -189,6 +194,8 @@ namespace confighttp {
189
194
190
195
SimpleWeb::CaseInsensitiveMultimap headers;
191
196
headers.emplace (" Content-Type" , " application/json" );
197
+ headers.emplace (" X-Frame-Options" , " DENY" );
198
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
192
199
193
200
response->write (code, tree.dump (), headers);
194
201
}
@@ -209,6 +216,8 @@ namespace confighttp {
209
216
210
217
SimpleWeb::CaseInsensitiveMultimap headers;
211
218
headers.emplace (" Content-Type" , " application/json" );
219
+ headers.emplace (" X-Frame-Options" , " DENY" );
220
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
212
221
213
222
response->write (code, tree.dump (), headers);
214
223
}
@@ -262,6 +271,8 @@ namespace confighttp {
262
271
std::string content = file_handler::read_file (WEB_DIR " index.html" );
263
272
SimpleWeb::CaseInsensitiveMultimap headers;
264
273
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
274
+ headers.emplace (" X-Frame-Options" , " DENY" );
275
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
265
276
response->write (content, headers);
266
277
}
267
278
@@ -280,6 +291,8 @@ namespace confighttp {
280
291
std::string content = file_handler::read_file (WEB_DIR " pin.html" );
281
292
SimpleWeb::CaseInsensitiveMultimap headers;
282
293
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
294
+ headers.emplace (" X-Frame-Options" , " DENY" );
295
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
283
296
response->write (content, headers);
284
297
}
285
298
@@ -298,6 +311,8 @@ namespace confighttp {
298
311
std::string content = file_handler::read_file (WEB_DIR " apps.html" );
299
312
SimpleWeb::CaseInsensitiveMultimap headers;
300
313
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
314
+ headers.emplace (" X-Frame-Options" , " DENY" );
315
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
301
316
headers.emplace (" Access-Control-Allow-Origin" , " https://images.igdb.com/" );
302
317
response->write (content, headers);
303
318
}
@@ -317,6 +332,8 @@ namespace confighttp {
317
332
std::string content = file_handler::read_file (WEB_DIR " clients.html" );
318
333
SimpleWeb::CaseInsensitiveMultimap headers;
319
334
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
335
+ headers.emplace (" X-Frame-Options" , " DENY" );
336
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
320
337
response->write (content, headers);
321
338
}
322
339
@@ -335,6 +352,8 @@ namespace confighttp {
335
352
std::string content = file_handler::read_file (WEB_DIR " config.html" );
336
353
SimpleWeb::CaseInsensitiveMultimap headers;
337
354
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
355
+ headers.emplace (" X-Frame-Options" , " DENY" );
356
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
338
357
response->write (content, headers);
339
358
}
340
359
@@ -353,6 +372,8 @@ namespace confighttp {
353
372
std::string content = file_handler::read_file (WEB_DIR " password.html" );
354
373
SimpleWeb::CaseInsensitiveMultimap headers;
355
374
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
375
+ headers.emplace (" X-Frame-Options" , " DENY" );
376
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
356
377
response->write (content, headers);
357
378
}
358
379
@@ -370,6 +391,8 @@ namespace confighttp {
370
391
std::string content = file_handler::read_file (WEB_DIR " welcome.html" );
371
392
SimpleWeb::CaseInsensitiveMultimap headers;
372
393
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
394
+ headers.emplace (" X-Frame-Options" , " DENY" );
395
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
373
396
response->write (content, headers);
374
397
}
375
398
@@ -388,6 +411,8 @@ namespace confighttp {
388
411
std::string content = file_handler::read_file (WEB_DIR " troubleshooting.html" );
389
412
SimpleWeb::CaseInsensitiveMultimap headers;
390
413
headers.emplace (" Content-Type" , " text/html; charset=utf-8" );
414
+ headers.emplace (" X-Frame-Options" , " DENY" );
415
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
391
416
response->write (content, headers);
392
417
}
393
418
@@ -404,6 +429,8 @@ namespace confighttp {
404
429
std::ifstream in (WEB_DIR " images/sunshine.ico" , std::ios::binary);
405
430
SimpleWeb::CaseInsensitiveMultimap headers;
406
431
headers.emplace (" Content-Type" , " image/x-icon" );
432
+ headers.emplace (" X-Frame-Options" , " DENY" );
433
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
407
434
response->write (SimpleWeb::StatusCode::success_ok, in, headers);
408
435
}
409
436
@@ -420,6 +447,8 @@ namespace confighttp {
420
447
std::ifstream in (WEB_DIR " images/logo-sunshine-45.png" , std::ios::binary);
421
448
SimpleWeb::CaseInsensitiveMultimap headers;
422
449
headers.emplace (" Content-Type" , " image/png" );
450
+ headers.emplace (" X-Frame-Options" , " DENY" );
451
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
423
452
response->write (SimpleWeb::StatusCode::success_ok, in, headers);
424
453
}
425
454
@@ -471,6 +500,8 @@ namespace confighttp {
471
500
// if it is, set the content type to the mime type
472
501
SimpleWeb::CaseInsensitiveMultimap headers;
473
502
headers.emplace (" Content-Type" , mimeType->second );
503
+ headers.emplace (" X-Frame-Options" , " DENY" );
504
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
474
505
std::ifstream in (filePath.string (), std::ios::binary);
475
506
response->write (SimpleWeb::StatusCode::success_ok, in, headers);
476
507
}
@@ -971,6 +1002,8 @@ namespace confighttp {
971
1002
std::string content = file_handler::read_file (config::sunshine.log_file .c_str ());
972
1003
SimpleWeb::CaseInsensitiveMultimap headers;
973
1004
headers.emplace (" Content-Type" , " text/plain" );
1005
+ headers.emplace (" X-Frame-Options" , " DENY" );
1006
+ headers.emplace (" Content-Security-Policy" , " frame-ancestors 'none';" );
974
1007
response->write (SimpleWeb::StatusCode::success_ok, content, headers);
975
1008
}
976
1009
0 commit comments