You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We noticed that having report = no in a fileclass definition changes the SQL query generated for policy rules that use this fileclass as target_fileclass.
Here'a an example, with the following policy definition:
SELECT ENTRIES.id AS id FROM ENTRIES
WHERE
ENTRIES.type='file' AND
(ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) AND
( ( (ENTRIES.uid='kilian' OR ENTRIES.uid IS NULL) AND ENTRIES.fileclass LIKE BINARY '%+test_fc+%') OR
( (ENTRIES.uid='kilian' OR ENTRIES.uid IS NULL) ) )
LIMIT 100000
We can see that the SQL query will only return entries matching the fileclass definition, with:
WHERE ... ENTRIES.fileclass LIKE BINARY '%+test_fc+%'
But if we add report = no to the fileclass definition (which according to the documentation, should only hide that fileclass from rbh-report --classinfo report), like this:
we can see that the fileclass filter doesn't exist anymore in the generated SQL query:
SELECT ENTRIES.id AS id FROM ENTRIES
WHERE
ENTRIES.type='file' AND
(ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) AND
( ( (ENTRIES.uid='kilian' OR ENTRIES.uid IS NULL) ) OR
( (ENTRIES.uid='kilian' OR ENTRIES.uid IS NULL) ) )
LIMIT 100000
As a consequence, the resulting file list contains many unwanted entries that are processed unnecessarily.
Is that expected?
The text was updated successfully, but these errors were encountered:
Thank you kilian for the precise report.
"report = yes/no" is actually not well named. If enabled, this parameter results in storing the fileclass name in the DB so it is available for further matching and reporting. When "report = no", the fileclass definition is actually "inlined" (replaced by its definition) where the fileclass name is used. It should however be replaced in the SQL request with ENTRIES.type == "symlink".
Notice that in your case this would be a non-sense as the scope of the policy is "type == file".
But as you mentioned, the generated SQL query (with report = no) should indeed contain WHERE ENTRIES.type == "symlink". And it doesn't seem to be the case.
To make things easier and remove the file/symlink thing from the equation, I did another test with this:
SELECT ENTRIES.id AS id FROM ENTRIES
WHERE
ENTRIES.type='file' AND
(ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) AND
( ( (ENTRIES.uid='user1' OR ENTRIES.uid IS NULL) ) OR
( (ENTRIES.uid='user2' OR ENTRIES.uid IS NULL) ) )
LIMIT 100000
Shouldn't the fileclass condition (group == "foo") have been inlined and be present in the SQL WHERE condition as well, in the ENTRIES.uid='user1' part?
Right now, it looks like the fileclass definition is entirely skipped when report = no 🤔
HI!
We noticed that having
report = no
in afileclass
definition changes the SQL query generated for policy rules that use thisfileclass
astarget_fileclass
.Here'a an example, with the following policy definition:
The generated SQL query is:
We can see that the SQL query will only return entries matching the
fileclass
definition, with:But if we add
report = no
to thefileclass
definition (which according to the documentation, should only hide thatfileclass
fromrbh-report --classinfo
report), like this:we can see that the
fileclass
filter doesn't exist anymore in the generated SQL query:As a consequence, the resulting file list contains many unwanted entries that are processed unnecessarily.
Is that expected?
The text was updated successfully, but these errors were encountered: