mirror of
https://github.com/perlbot/perlbuut
synced 2025-06-07 22:15:45 -04:00
fixing massive security bug
This commit is contained in:
parent
abd28e6ddd
commit
084607c197
4 changed files with 10 additions and 5 deletions
|
@ -68,12 +68,17 @@ sub get_plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_plugin {
|
sub get_plugin {
|
||||||
my( $self, $name ) = @_;
|
my( $self, $name, $said ) = @_;
|
||||||
|
|
||||||
# Loops are cool.
|
# Loops are cool.
|
||||||
# O(n) but nobody cares because it's rarely used.
|
# O(n) but nobody cares because it's rarely used.
|
||||||
# HA HA THIS IS A LIE.
|
# HA HA THIS IS A LIE.
|
||||||
for( @{ $self->{plugins} } ) {
|
|
||||||
|
#this fixes a security flaw, but not completely because i'm lazy right now
|
||||||
|
my $filtered = $self->{plugins};
|
||||||
|
$filtered = $self->_filter_plugin_list($said, $filtered) if ($said);
|
||||||
|
|
||||||
|
for( @{$filtered} ) {
|
||||||
if( $name eq $_->{name} ) {
|
if( $name eq $_->{name} ) {
|
||||||
return $_;
|
return $_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ sub runplugin {
|
||||||
return( 0, "Error, cannot parse call to find command name, probably empty call in compose" );
|
return( 0, "Error, cannot parse call to find command name, probably empty call in compose" );
|
||||||
defined($body) or $body = "";
|
defined($body) or $body = "";
|
||||||
|
|
||||||
my $plugin = $pm->get_plugin( $cmd )
|
my $plugin = $pm->get_plugin( $cmd, $said )
|
||||||
or return( 0, "Compose failed to find a plugin named: $cmd" );
|
or return( 0, "Compose failed to find a plugin named: $cmd" );
|
||||||
|
|
||||||
local $said->{body} = $body;
|
local $said->{body} = $body;
|
||||||
|
|
|
@ -456,7 +456,7 @@ sub basic_get_fact {
|
||||||
|
|
||||||
if( $fact->{predicate} =~ /\S/ ) {
|
if( $fact->{predicate} =~ /\S/ ) {
|
||||||
if( $fact->{compose_macro} ) {
|
if( $fact->{compose_macro} ) {
|
||||||
my $plugin = $pm->get_plugin("compose");
|
my $plugin = $pm->get_plugin("compose", $said);
|
||||||
|
|
||||||
local $said->{macro_arg} = $arg;
|
local $said->{macro_arg} = $arg;
|
||||||
local $said->{body} = $fact->{predicate};
|
local $said->{body} = $fact->{predicate};
|
||||||
|
|
|
@ -6,7 +6,7 @@ sub {
|
||||||
my $plugin_name = $said->{recommended_args}->[0];
|
my $plugin_name = $said->{recommended_args}->[0];
|
||||||
|
|
||||||
if( length $plugin_name ) {
|
if( length $plugin_name ) {
|
||||||
my $plugin = $pm->get_plugin( $plugin_name );
|
my $plugin = $pm->get_plugin( $plugin_name, $said );
|
||||||
|
|
||||||
if( $plugin ) {
|
if( $plugin ) {
|
||||||
print $plugin->{help_text};
|
print $plugin->{help_text};
|
||||||
|
|
Loading…
Add table
Reference in a new issue