mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Harden systemd services, restrict file permissions further, add username blocklist and prevent more vulnerabilities
This commit is contained in:
@@ -32,10 +32,15 @@ ALTER DEFAULT PRIVILEGES REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
|
||||
CREATE FUNCTION internal.generate_slug (TEXT)
|
||||
RETURNS TEXT
|
||||
AS $$
|
||||
SELECT
|
||||
REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(TRIM(REGEXP_REPLACE(unaccent ($1), '\s+', '-', 'g'))), '[^\w-]', '', 'g'), '-+', '-', 'g'), '^-+', '', 'g'), '-+$', '', 'g')
|
||||
BEGIN
|
||||
IF $1 ~ '[/\\.]' THEN
|
||||
RAISE invalid_parameter_value
|
||||
USING message = 'Title cannot contain "/", "\" or "."';
|
||||
END IF;
|
||||
RETURN REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(LOWER(TRIM(REGEXP_REPLACE(unaccent ($1), '\s+', '-', 'g'))), '[^\w-]', '', 'g'), '-+', '-', 'g'), '^-+', '', 'g'), '-+$', '', 'g');
|
||||
END;
|
||||
$$
|
||||
LANGUAGE sql
|
||||
LANGUAGE plpgsql
|
||||
IMMUTABLE;
|
||||
|
||||
GRANT EXECUTE ON FUNCTION internal.generate_slug TO authenticated_user;
|
||||
|
||||
Reference in New Issue
Block a user