Protection from malicious rules
by Shur, Bob
We're considering a system in which partners could write and deploy their own rules, but we are worried about security. Is there any support for preventing harmful rules? For example:
rule "bad"
when
then
File f = new File("important.doc");
f.delete();
end
14 years, 4 months
Rule does not fire when JBPM asks to do so in BPMN 2.0 process
by argaldo
Hi,
We're running an application that uses Drools + JBPM 5 + Drools
integration our set-up can be seen as:
Some rule fires and creates a JBPM process ( a fact gets inserted into
drools using "kcontext.getKnowledgeRuntime().startProcess()" ), after a few
nodes processed, the JBPM engine arrives to a node of type
"businessRuleTask" which in turn tells drools to evaluate a group of rules (
which at the moment consists on only one rule ).
Well, the problem is that what we see is that everything runs ok before
the businessRuleTask and at the moment when the rule group would be
evaluated we could see that in drools the rule gets created, activated, but
never fired.
We did some debug and realized that the reason the rule group never got
fired is because this check in RuleFlowGroupImpl.java ( method
setActive(boolean) ):
if ( this.list.isEmpty() ) {
if ( this.autoDeactivate ) {
// if the list of activations is empty and
// auto-deactivate is on, deactivate this group
WorkingMemoryAction action = new DeactivateCallback(
this );
this.workingMemory.queueWorkingMemoryAction( action );
}
}
The problem is that at the moment when drools calls setActive() and
performs the check, this.list is in fact empty and autoDeactivate is true by
default ). Then drools enqueues a deactivation task afterwords, which
deactivates the rule *before* even firing it.
From now on, things get a little weirder, every subsequent invocation of
the method setActive ( in response of bussinessRuleTask from our bussiness
process ) runs ok as that list now is not empty ( has one rule ).
Seems a race condition to me, but,..., Is there any way to deactivate
autodeactivation by default? Are we doing something wrong? Bug report?
Greets,
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-does-not-fire-when-JBPM-asks-to-do...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
Re: [rules-users] How do I write a rule to detect a missing value in a group of facts?
by GPatel@tsys.com
Beautiful!
How would a business user (non-programmer) write such a rule. The only way I can think of is create a dsl sentence for this specific condition
----- Original Message -----
From: Wolfgang Laun [wolfgang.laun(a)gmail.com]
Sent: 02/09/2012 05:02 PM CET
To: Rules Users List <rules-users(a)lists.jboss.org>
Subject: Re: [rules-users] How do I write a rule to detect a missing value in a group of facts?
Don't think procedurally, just write the *rule* for a missing post ;-)
rule "missing fence post"
when
FencePost( $d: distanceFromStart )
FencePost( distanceFromStart == $d + 2*FencePost.GAP )
not FencePost( distanceFromStart == $d + FencePost.GAP )
then
System.out.println( "Missing: " + ($d + FencePost.GAP) );
end
-W
On 9 February 2012 16:41, mikeg <mike(a)thegoldners.com> wrote:
> I need to write a rule to identify a missing element in a group of facts.
>
> For example, let us say I want to ensure that my fence has a fence post
> every 8 feet. My fact declaration is as follows:
>
> declare FencePost
> identifier : String
> distanceFromStart: Long
> end
>
> If I add the following facts into my session:
>
> FencePost("a", 0)
> FencePost("x", 8)
> FencePost("e", 24)
>
> I want a rule that will notify the user that there is a missing fence post
> between "x" and "e".
>
> I've been looking into using "collect" into a TreeSet/TreeMap to get a
> collection sorted on the "distanceFromStart", but I cannot figure out how
> to
> compare adjacent elements in the collection.
>
> Any ideas?
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-do-I-write-a-rule-to-detect-a-missi...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
14 years, 4 months
How do I write a rule to detect a missing value in a group of facts?
by mikeg
I need to write a rule to identify a missing element in a group of facts.
For example, let us say I want to ensure that my fence has a fence post
every 8 feet. My fact declaration is as follows:
declare FencePost
identifier : String
distanceFromStart: Long
end
If I add the following facts into my session:
FencePost("a", 0)
FencePost("x", 8)
FencePost("e", 24)
I want a rule that will notify the user that there is a missing fence post
between "x" and "e".
I've been looking into using "collect" into a TreeSet/TreeMap to get a
collection sorted on the "distanceFromStart", but I cannot figure out how to
compare adjacent elements in the collection.
Any ideas?
--
View this message in context: http://drools.46999.n3.nabble.com/How-do-I-write-a-rule-to-detect-a-missi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
Drools Debugging
by Veera
Hi All,
I have one doubt that is : When i compiling a sample HelloWorld Drools
program it is printing output like :
Hello World
Goodbye cruel world
and i added a simple rule like :
rule "test"
when
eval(true)
then
System.out.println( "Hello!!!" );
end
When i compile the output is :
Hello!!!
Hello World
Goodbye cruel world
But when i debug it is showing output like:
Hello World
Goodbye cruel world
Hello!!!
Can anybody help me how to get the same output when i debug also...
Regards,
Veera
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Debugging-tp3728574p3728574.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months
declared variables in rules loaded to the same knowledge base
by Salina Fung/UFL - ICIL
We have 2 rules - rule 1 and rule 2, both have
declared variable @role(event)
In the program with statements to define the rule
<<
String rule1 = "package test001 import com.icil.event.*; declare EventImpl
@role(event) end rule \"test 001\" when Integer() then
System.out.println(\"rule test 001: there is an integer\"); end ";
String rule2 = "package test002 import com.icil.event.*; declare EventImpl
@role(event) end rule \"test 002\" when Integer() then
System.out.println(\"rule test 002: there is an integer\"); end ";
>>
and then try to load these two into the same knowledge base using Drools 5.3,
will get an runtime exception. But Drools 5.2, this is ok, with
no error.
Then in Drools 5.2
We try to print the address of the variable 'event' in the RHS of both rules, the
address is the same in both rules, which means they are sharing the same instance?
Is it the declared variables with the same name in separate
rules being loaded in the same knowledge base, will just
have ONE instance?
Thanks
Salina
14 years, 4 months
Can I change the value of a global in a rule consequence?
by Shur, Bob
The manual says "It is strongly discouraged to set or change a global value from inside your rules..." but it doesn't say it won't work.
I tried this:
========================
global Integer m;
declare DoneInit end
rule "init"
when
then
insert(new DoneInit());
System.out.println("m from Java: " + m);
m = 100;
System.out.println("m modified in init: " + m);
end
rule "use it"
when
DoneInit()
then
System.out.println("use m: " + m);
end
==========================
and got this output:
m from Java: 13
m modified in init: 100
use m: 13
Is this the expected behavior? I'm in a stateless session in case that matters.
14 years, 4 months
Unable to save or validate facts in Guvnor
by arup
Hi,
I can't save or validate any facts or pojo models in my guvnor. The guvnor
console is coming and i can browse through it but when i'm trying to save or
validate any items i'm getting some errors as below. Is there any repository
related problem??... how can i solve it??
0000039 SystemErr R Exception in thread "pool-1-thread-1"
java.lang.AbstractMethodError:
org/drools/repository/UserInfo$Command.process(Ljava/lang/String;)V
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
org.drools.repository.UserInfo.eachUser(UserInfo.java:179)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
org.drools.guvnor.server.repository.MailboxService.processOutgoing(MailboxService.java:81)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
org.drools.guvnor.server.repository.MailboxService$3.run(MailboxService.java:127)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
[2/8/12 13:56:49:148 IST] 00000039 SystemErr R at
java.lang.Thread.run(Thread.java:810)
[2/8/12 13:56:49:155 IST] 0000003a SystemErr R Exception in thread
"pool-1-thread-2" java.lang.AbstractMethodError:
org/drools/repository/UserInfo$Command.process(Ljava/lang/String;)V
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
org.drools.repository.UserInfo.eachUser(UserInfo.java:179)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
org.drools.guvnor.server.repository.MailboxService.processOutgoing(MailboxService.java:81)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
org.drools.guvnor.server.repository.MailboxService$1.run(MailboxService.java:67)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
[2/8/12 13:56:49:156 IST] 0000003a SystemErr R at
java.lang.Thread.run(Thread.java:810)
--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-save-or-validate-facts-in-Guv...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 4 months