Skip to content

Commit

Permalink
Merge pull request #607 from RotherOSS/issue-#605-disable_banner_check
Browse files Browse the repository at this point in the history
Issue #605 disable banner check
  • Loading branch information
bschmalhofer authored Nov 2, 2020
2 parents fadb9c1 + 748b5f6 commit 3b33358
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions Kernel/Output/HTML/Layout.pm
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ sub new {
# empty action if not defined
$Self->{Action} //= '';

# use the old behavior per default, where printing to STDOUT is the thing to do
$Self->{StdoutIsCaptured} //= 1;

my $ConfigObject = $Kernel::OM->Get('Kernel::Config');

# get/set some common params
Expand All @@ -105,6 +102,7 @@ sub new {

# Determine the language to use based on the browser setting, if there
# is none yet.
my $ParamObject = $Kernel::OM->Get('Kernel::System::Web::Request');
if ( !$Self->{UserLanguage} ) {
my @BrowserLanguages = split /\s*,\s*/, $Self->{Lang} || $ENV{HTTP_ACCEPT_LANGUAGE} || '';
my %Data = %{ $ConfigObject->Get('DefaultUsedLanguages') };
Expand Down Expand Up @@ -660,15 +658,18 @@ sub Redirect {
}

sub Login {
my ( $Self, %Param ) = @_;
my $Self = shift;
my %Param = @_;

# set Action parameter for the loader
$Self->{Action} = 'Login';
$Param{IsLoginPage} = 1;

# get singletons
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');

my $Output = '';

if ( $ConfigObject->Get('SessionUseCookie') ) {

# always set a cookie, so that at the time the user submits
Expand Down Expand Up @@ -883,9 +884,6 @@ sub Login {
Data => \%Param,
);

# remove the version tag from the header if configured
$Self->_DisableBannerCheck( OutputRef => \$Output );

return $Output;
}

Expand Down Expand Up @@ -1246,8 +1244,10 @@ generates the HTML for the page begin in the Agent interface.
=cut

sub Header {
my ( $Self, %Param ) = @_;
my $Self = shift;
my %Param = @_;

# extract params
my $Type = $Param{Type} || '';

# check params
Expand Down Expand Up @@ -1606,9 +1606,6 @@ sub Header {
Data => \%Param
);

# remove the version tag from the header if configured
$Self->_DisableBannerCheck( OutputRef => \$Output );

return $Output;
}

Expand Down Expand Up @@ -2616,7 +2613,7 @@ returns browser output to display/download a attachment
# scripts, flash etc.
);
or for AJAX html snippets
or for AJAX html snippets
$HTML = $LayoutObject->Attachment(
Type => 'inline', # optional, default: attachment, possible: inline|attachment
Expand Down Expand Up @@ -3899,7 +3896,8 @@ sub HumanReadableDataSize {
}

sub CustomerLogin {
my ( $Self, %Param ) = @_;
my $Self = shift;
my %Param = @_;

my $Output = '';
$Param{TitleArea} = $Self->{LanguageObject}->Translate('Login') . ' - ';
Expand Down Expand Up @@ -4128,14 +4126,12 @@ sub CustomerLogin {
Data => \%Param,
);

# remove the version tag from the header if configured
$Self->_DisableBannerCheck( OutputRef => \$Output );

return $Output;
}

sub CustomerHeader {
my ( $Self, %Param ) = @_;
my $Self = shift;
my %Param = @_;

my $Type = $Param{Type} || '';

Expand Down Expand Up @@ -4264,9 +4260,6 @@ sub CustomerHeader {
Data => \%Param,
);

# remove the version tag from the header if configured
$Self->_DisableBannerCheck( OutputRef => \$Output );

return $Output;
}

Expand Down Expand Up @@ -6006,20 +5999,6 @@ sub _BuildSelectionOutput {
return $String;
}

sub _DisableBannerCheck {
my ( $Self, %Param ) = @_;

return 1 if !$Kernel::OM->Get('Kernel::Config')->Get('Secure::DisableBanner');
return if !$Param{OutputRef};

# remove the version tag from the header
${ $Param{OutputRef} } =~ s{
^ X-Powered-By: .+? Open \s Ticket \s Request \s System \s \(http .+? \)$ \n
}{}smx;

return 1;
}

=head2 _RemoveScriptTags()
This function will remove the surrounding <script> tags of a
Expand Down

0 comments on commit 3b33358

Please sign in to comment.