[tracker/wip/carlosg/portal: 21/41] libtracker-data: Check graph permissions on graph manipulation syntax
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/portal: 21/41] libtracker-data: Check graph permissions on graph manipulation syntax
- Date: Tue, 23 Jun 2020 11:53:42 +0000 (UTC)
commit 2a50b5978511026f6747fd51de49f6d550692a8b
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jan 25 13:54:20 2020 +0100
libtracker-data: Check graph permissions on graph manipulation syntax
Check when handling CREATE/DROP/ADD/MOVE/COPY that the graph can be
accessed.
src/libtracker-data/tracker-sparql.c | 40 ++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index c544776b2..b2fdfdcaa 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -3893,6 +3893,14 @@ translate_Drop (TrackerSparql *sparql,
}
for (l = graphs; l; l = l->next) {
+ if (!tracker_sparql_graph_is_whitelisted (sparql, l->data)) {
+ inner_error = g_error_new (TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_CONSTRAINT,
+ "Graph '%s' disallowed by policy",
+ (const gchar *) l->data);
+ break;
+ }
+
if (!tracker_data_manager_drop_graph (sparql->data_manager,
l->data, &inner_error))
break;
@@ -3931,6 +3939,14 @@ translate_Create (TrackerSparql *sparql,
goto error;
}
+ if (!tracker_sparql_graph_is_whitelisted (sparql, graph_name)) {
+ inner_error = g_error_new (TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_CONSTRAINT,
+ "Graph '%s' disallowed by policy",
+ graph_name);
+ goto error;
+ }
+
if (!tracker_data_manager_create_graph (sparql->data_manager,
graph_name,
&inner_error))
@@ -3979,6 +3995,14 @@ translate_Add (TrackerSparql *sparql,
goto error;
}
+ if (!tracker_sparql_graph_is_whitelisted (sparql, destination)) {
+ inner_error = g_error_new (TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_CONSTRAINT,
+ "Graph '%s' disallowed by policy",
+ destination);
+ goto error;
+ }
+
if (destination &&
!tracker_sparql_find_graph (sparql, destination)) {
if (!tracker_data_manager_create_graph (sparql->data_manager,
@@ -4041,6 +4065,14 @@ translate_Move (TrackerSparql *sparql,
goto error;
}
+ if (!tracker_sparql_graph_is_whitelisted (sparql, destination)) {
+ inner_error = g_error_new (TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_CONSTRAINT,
+ "Graph '%s' disallowed by policy",
+ destination);
+ goto error;
+ }
+
if (destination &&
!tracker_sparql_find_graph (sparql, destination)) {
if (!tracker_data_manager_create_graph (sparql->data_manager,
@@ -4115,6 +4147,14 @@ translate_Copy (TrackerSparql *sparql,
goto error;
}
+ if (!tracker_sparql_graph_is_whitelisted (sparql, destination)) {
+ inner_error = g_error_new (TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_CONSTRAINT,
+ "Graph '%s' disallowed by policy",
+ destination);
+ goto error;
+ }
+
if (destination &&
!tracker_sparql_find_graph (sparql, destination)) {
if (!tracker_data_manager_create_graph (sparql->data_manager,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]