<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Security_definer</id>
	<title>Security definer - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Security_definer"/>
	<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Security_definer&amp;action=history"/>
	<updated>2026-04-24T06:26:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://tech.uvoo.io/index.php?title=Security_definer&amp;diff=5625&amp;oldid=prev</id>
		<title>Busk: Created page with &quot;PostgreSQL, SECURITY DEFINER is an attribute applied to functions, procedures, or views that dictates the security context under which they execute. How it works: Default Beha...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Security_definer&amp;diff=5625&amp;oldid=prev"/>
		<updated>2025-08-19T03:41:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;PostgreSQL, SECURITY DEFINER is an attribute applied to functions, procedures, or views that dictates the security context under which they execute. How it works: Default Beha...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;PostgreSQL, SECURITY DEFINER is an attribute applied to functions, procedures, or views that dictates the security context under which they execute.&lt;br /&gt;
How it works:&lt;br /&gt;
Default Behavior (SECURITY INVOKER):&lt;br /&gt;
By default, when a function or procedure is invoked, it runs with the privileges of the calling user (the user executing the function). This is known as SECURITY INVOKER.&lt;br /&gt;
SECURITY DEFINER:&lt;br /&gt;
When a function, procedure, or view is defined with SECURITY DEFINER, it executes with the privileges of the owner of that object (the user who created or last altered it). This means that even if a low-privileged user calls the SECURITY DEFINER function, the operations within that function will be performed with the potentially higher privileges of the owner.&lt;br /&gt;
Purpose and Use Cases:&lt;br /&gt;
The primary purpose of SECURITY DEFINER is to allow controlled elevation of privileges. This is useful in scenarios where a less privileged user needs to perform a specific action that requires higher privileges, but without directly granting them those elevated permissions.&lt;br /&gt;
Examples:&lt;br /&gt;
Controlled Data Access:&lt;br /&gt;
A SECURITY DEFINER function owned by a superuser could allow a regular user to access or modify specific data in a table they wouldn't normally have direct access to, but only through the controlled logic within the function.&lt;br /&gt;
System Administration Tasks:&lt;br /&gt;
A SECURITY DEFINER function could allow a non-superuser to perform limited administrative tasks, such as creating new roles with specific, predefined permissions, without granting them full CREATEROLE privileges.&lt;br /&gt;
Security Considerations:&lt;br /&gt;
While SECURITY DEFINER is powerful, it introduces security risks if not used carefully:&lt;br /&gt;
Vulnerability to Abuse:&lt;br /&gt;
If a SECURITY DEFINER function is not written securely and allows arbitrary input or operations, it can be exploited to gain unauthorized access or perform malicious actions with the owner's elevated privileges.&lt;br /&gt;
Search Path Manipulation:&lt;br /&gt;
In functions that use SECURITY DEFINER, it is crucial to explicitly schema-qualify all database objects (tables, functions, etc.) to prevent potential search path manipulation, where a malicious user could create objects with the same name in their own schema to trick the function into executing unintended code.&lt;br /&gt;
Least Privilege Principle:&lt;br /&gt;
Adhere to the principle of least privilege. The owner of a SECURITY DEFINER object should only have the minimum necessary privileges required for the function's intended purpose.&lt;/div&gt;</summary>
		<author><name>Busk</name></author>
	</entry>
</feed>