<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AHardening_new_Roles_system</id>
	<title>Development:Hardening new Roles system - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AHardening_new_Roles_system"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Hardening_new_Roles_system&amp;action=history"/>
	<updated>2026-05-06T23:59:17Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Hardening_new_Roles_system&amp;diff=11218&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Hardening_new_Roles_system&amp;diff=11218&amp;oldid=prev"/>
		<updated>2024-10-21T08:51:19Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 08:51, 21 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Hardening_new_Roles_system&amp;diff=11217&amp;oldid=prev</id>
		<title>1&gt;TimHunt: /* Basic risks */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Hardening_new_Roles_system&amp;diff=11217&amp;oldid=prev"/>
		<updated>2008-08-13T04:45:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Basic risks&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Hardening a role, refers to limiting the ability of a role to assign or to aquire permissions.&lt;br /&gt;
&lt;br /&gt;
New roles add great freedom when assigning capabilities to students. The problem might arise when students are assigned permission that allows adding of content that is not cleaned before display - such as editting Resources, adding activities, etc. They could then use any type of XSS attack to gain full administrative access quite easily.&lt;br /&gt;
&lt;br /&gt;
The solution has two parts: educate admins and teachers about the risks associated with each capability and optionally allow central management of risks.&lt;br /&gt;
&lt;br /&gt;
==Risk bitmask in capabilities==&lt;br /&gt;
Add risk bitmask field to each capability. Each bit indicates presence of different risk associated with given capability.&lt;br /&gt;
&lt;br /&gt;
===Basic risks===&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RISK_SPAM&amp;#039;&amp;#039;&amp;#039; - user can add visible content to site, send messages to other users; originally protected by !isguest()&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RISK_PERSONAL&amp;#039;&amp;#039;&amp;#039; - access to private personal information - ex: backups with user details, non public information in profile (hidden email), etc.; originally protected by isteacher()&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RISK_XSS&amp;#039;&amp;#039;&amp;#039; - user can submit content that is not cleaned (both HTML with active content and unprotected files); originally protected by isteacher()&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RISK_CONFIG&amp;#039;&amp;#039;&amp;#039; - user can change global configuration, actions are missing sanity checks&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RISK_MANAGETRUST&amp;#039;&amp;#039;&amp;#039; - manage trust bitmasks of other users&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;RISK_DATALOSS&amp;#039;&amp;#039;&amp;#039; - can destroy large amounts of information that cannot easily be recovered.&lt;br /&gt;
&lt;br /&gt;
In default configuration Guest role should have only capabilities without risks, Student roles also SPAM, Teacher roles PERSONAL and XSS too. Admins have all capabilitites by default.&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
* add new LONGINT column &amp;#039;&amp;#039;riskbitmask&amp;#039;&amp;#039; to table &amp;#039;&amp;#039;capabilities&amp;#039;&amp;#039; (DONE)&lt;br /&gt;
* define risks and assign them to capabilities in mod/xxx/db/access.php and lib/db/access.php (DONE)&lt;br /&gt;
* link wiki pages with explanation to each risk from capabilities page&lt;br /&gt;
* allow risk based filtering of capabilities admin/roles/manage.php (optional)&lt;br /&gt;
&lt;br /&gt;
The user interface will be minimal, icons and maybe colors indicating each risk together with description links which we need anyway.&lt;br /&gt;
Developers are deciding about the risks, the risk assignment is hardcoded in access.php description file, no GUI needed to change risks.&lt;br /&gt;
&lt;br /&gt;
===Benefits===&lt;br /&gt;
# proper documentation of risks associated with capabilities, easy to explain&lt;br /&gt;
# solid foundation for regular code audits (mainly XSS prevention and personal information disclosure)&lt;br /&gt;
&lt;br /&gt;
==User trust bitmask==&lt;br /&gt;
Indicate what kind of trust each user has. Match the risk bitmask of capability and user trust bitmask in both has_capability() and require_capability().&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
* add new LONGINT column &amp;#039;&amp;#039;trustbitmask&amp;#039;&amp;#039; to &amp;#039;&amp;#039;user&amp;#039;&amp;#039; table&lt;br /&gt;
* add capability &amp;#039;&amp;#039;moodle/site:managetrustbitmasks&amp;#039;&amp;#039; with RISK_MANAGETRUST risk&lt;br /&gt;
* add trust checks to has_capability() and require_capability()&lt;br /&gt;
* add GUI&lt;br /&gt;
** switch in global configuration to enable trust bitmask checking&lt;br /&gt;
** preseting of trust bitmask for new users&lt;br /&gt;
** changing of trust bitmasks&lt;br /&gt;
** add trust bitmask setting to user/edit.php&lt;br /&gt;
** request trust level change form - something like new course request (optional)&lt;br /&gt;
* fix upgrade to assign trust bitmaps based on original teacher or administrator rights&lt;br /&gt;
* patch user import script and synchronizations (optional)&lt;br /&gt;
&lt;br /&gt;
===Benefits===&lt;br /&gt;
# This part is optional and can be implemented later.&lt;br /&gt;
# Trust manager or admin has full control over potentially dangerous capabilities - it is necessary for large sites (or connected sites in the future). &lt;br /&gt;
# Trust bitmask mechanism can be turned off by single configuration switch (both GUI and checks) - needed for small insecure workshop sites.&lt;br /&gt;
# General protection against future bugs in role and capability framework or user errors when configuring roles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Note: trusttext moved to its own page at [[Trusttext cleaning bypass]]&amp;#039;&amp;#039;&lt;br /&gt;
[[Category:Developer|Hardening new Roles system]]&lt;br /&gt;
[[Category:Roles]]&lt;/div&gt;</summary>
		<author><name>1&gt;TimHunt</name></author>
	</entry>
</feed>