Skip to content

Commit f68f4a0

Browse files
committed
small note about security
1 parent aa0a419 commit f68f4a0

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
select 'dynamic' as component, properties FROM example WHERE component = 'shell' LIMIT 1;
2+
3+
select
4+
'hero' as component,
5+
'Not found' as title,
6+
'Sorry, the component you were looking for does not exist.' as description_md,
7+
'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/Sad_clown.jpg/640px-Sad_clown.jpg' as image,
8+
'/documentation.sql' as link,
9+
'Back to the documentation' as link_text;
10+
11+
-- Friendly message after an XSS or SQL injection attempt
12+
set $attack = CASE WHEN
13+
$component LIKE '%<%' or $component LIKE '%>%' or $component LIKE '%/%' or $component LIKE '%;%'
14+
or $component LIKE '%--%' or $component LIKE '%''%' or $component LIKE '%(%'
15+
THEN 'attacked' END;
16+
17+
select
18+
'alert' as component,
19+
'A note about security' as title,
20+
'alert-triangle' as icon,
21+
'teal' as color,
22+
TRUE as important,
23+
'SQLPage takes secutity very seriously.
24+
Fiddling with the URL to try to access data you are not supposed to see, or to
25+
trigger a SQL or javacript injection, should never work.
26+
27+
However, if you think you have found a security issue, please
28+
report it and we will fix it as soon as possible.
29+
' as description
30+
where $attack = 'attacked';
31+
select 'safety.sql' as link, 'More about SQLPage security' as title where $attack='attacked';
32+
select 'https://github.com/lovasoa/SQLpage/security' as link, 'Report a vulnerability' as title where $attack='attacked';

examples/official-site/documentation.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
-- ensure that the component exists and do not render this page if it does not
2+
select 'redirect' as component,
3+
'component_not_found.sql?component=' || sqlpage.url_encode($component) as link
4+
where $component is not null and not exists (select 1 from component where name = $component);
5+
16
-- This line, at the top of the page, tells web browsers to keep the page locally in cache once they have it.
27
select 'http_header' as component, 'public, max-age=600, stale-while-revalidate=3600, stale-if-error=86400' as "Cache-Control";
8+
39
select
410
'dynamic' as component,
511
json_set(

examples/official-site/safety.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ and to respect [security best practices](https://cheatsheetseries.owasp.org/chea
9999
Passwords are [hashed with a salt](https://en.wikipedia.org/wiki/Salt_(cryptography)) using the
100100
[argon2](https://en.wikipedia.org/wiki/Argon2) algorithm.
101101
102+
However, if you implement your own session management system using the [`cookie` component](/documentation.sql?component=cookie#component),
103+
you should be careful to follow the [OWASP session management best practices](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#cookies).
104+
Implementing your own session management system is not recommended if you are a non-technical user and don''t have a good understanding of web security.
105+
102106
## Database connections
103107
104108
SQLPage uses a fixed pool of database connections, and will never open more connections than the ones you

0 commit comments

Comments
 (0)