diff options
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/CGI.pm | 4 | ||||
-rw-r--r-- | Bugzilla/Config/GroupSecurity.pm | 26 | ||||
-rw-r--r-- | Bugzilla/Constants.pm | 4 | ||||
-rw-r--r-- | Bugzilla/DB/Schema.pm | 12 | ||||
-rw-r--r-- | Bugzilla/Install.pm | 9 | ||||
-rw-r--r-- | Bugzilla/Logging.pm | 2 | ||||
-rw-r--r-- | Bugzilla/PSGI.pm | 42 | ||||
-rw-r--r-- | Bugzilla/Product.pm | 60 | ||||
-rw-r--r-- | Bugzilla/Template.pm | 4 |
9 files changed, 158 insertions, 5 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 3737b97e2..05e2bd749 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -113,7 +113,7 @@ sub new { # Under mod_perl, CGI's global variables get reset on each request, # so we need to set them up again every time. - $class->_init_bz_cgi_globals() if $ENV{MOD_PERL}; + $class->_init_bz_cgi_globals() if BZ_PERSISTENT; my $self = $class->SUPER::new(@args); @@ -597,6 +597,8 @@ sub header { sub param { my $self = shift; + local $CGI::LIST_CONTEXT_WARN = 0; + # When we are just requesting the value of a parameter... if (scalar(@_) == 1) { my @result = $self->SUPER::param(@_); diff --git a/Bugzilla/Config/GroupSecurity.pm b/Bugzilla/Config/GroupSecurity.pm index 68c852fe6..c1d2faac1 100644 --- a/Bugzilla/Config/GroupSecurity.pm +++ b/Bugzilla/Config/GroupSecurity.pm @@ -84,6 +84,32 @@ sub get_param_list { name => 'strict_isolation', type => 'b', default => 0 + }, + { + name => 'always_filleable_groups', + type => 'l', + default => join(", ", qw( + addons-security + bugzilla-security + client-services-security + consulting + core-security + finance + infra + infrasec + l20n-security + marketing-private + mozilla-confidential + mozilla-employee-confidential + mozilla-foundation-confidential + mozilla-engagement + mozilla-messaging-confidential + partner-confidential + payments-confidential + tamarin-security + websites-security + webtools-security + )), } ); return @param_list; diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 00f0f8104..2971c7a53 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -194,6 +194,8 @@ use Memoize; EMAIL_LIMIT_EXCEPTION JOB_QUEUE_VIEW_MAX_JOBS + + BZ_PERSISTENT ); @Bugzilla::Constants::EXPORT_OK = qw(contenttypes); @@ -705,6 +707,8 @@ sub _bz_locations { }; } +use constant BZ_PERSISTENT => $main::BUGZILLA_PERSISTENT; + # This makes us not re-compute all the bz_locations data every time it's # called. BEGIN { memoize('_bz_locations') }; diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 3307464db..41afaeacf 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -1410,6 +1410,18 @@ use constant ABSTRACT_SCHEMA => { NOTNULL => 1, DEFAULT => "'---'"}, allows_unconfirmed => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'}, + default_op_sys_id => {TYPE => 'INT2', + REFERENCES => {TABLE => 'op_sys', + COLUMN => 'id', + DELETE => 'SET NULL'}}, + default_platform_id => {TYPE => 'INT2', + REFERENCES => {TABLE => 'rep_platform', + COLUMN => 'id', + DELETE => 'SET NULL'}}, + security_group_id => {TYPE => 'INT3', + REFERENCES => {TABLE => 'groups', + COLUMN => 'id', + DELETE => 'SET NULL'}}, ], INDEXES => [ products_name_idx => {FIELDS => ['name'], diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm index 6d47a143f..6ac16821e 100644 --- a/Bugzilla/Install.pm +++ b/Bugzilla/Install.pm @@ -284,6 +284,12 @@ use constant DEFAULT_PRODUCT => { defaultmilestone => DEFAULT_MILESTONE, }; +use constant DEFAULT_PRODUCT_GROUP => { + name => 'test-product-security', + description => "Security Sensitive TestProduct Bug", + isbuggroup => 1, +}; + use constant DEFAULT_COMPONENT => { name => 'TestComponent', description => 'This is a test component in the test product database.' @@ -362,7 +368,8 @@ sub create_default_product { print get_text('install_default_product', { name => DEFAULT_PRODUCT->{name} }) . "\n"; - my $product = Bugzilla::Product->create(DEFAULT_PRODUCT); + my $group = Bugzilla::Group->create(DEFAULT_PRODUCT_GROUP); + my $product = Bugzilla::Product->create({ %{DEFAULT_PRODUCT()}, security_group_id => $group->id }); # Get the user who will be the owner of the Component. # We pick the admin with the lowest id, which is probably the diff --git a/Bugzilla/Logging.pm b/Bugzilla/Logging.pm index b69ffa2e9..769485c86 100644 --- a/Bugzilla/Logging.pm +++ b/Bugzilla/Logging.pm @@ -17,7 +17,7 @@ use Bugzilla::Constants qw(bz_locations); use English qw(-no_match_vars $PROGRAM_NAME); sub is_interactive { - return exists $ENV{'SERVER_SOFTWARE'} ? 1 : 0; + return not exists $ENV{SERVER_SOFTWARE} } BEGIN { diff --git a/Bugzilla/PSGI.pm b/Bugzilla/PSGI.pm new file mode 100644 index 000000000..46352b319 --- /dev/null +++ b/Bugzilla/PSGI.pm @@ -0,0 +1,42 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::PSGI; +use 5.10.1; +use strict; +use warnings; + +use base qw(Exporter); + +use Bugzilla::Logging; +our @EXPORT_OK = qw(compile_cgi); + +sub compile_cgi { + my ($script) = @_; + require CGI::Compile; + require CGI::Emulate::PSGI; + + my $cgi = CGI::Compile->compile($script); + my $app = CGI::Emulate::PSGI->handler( + sub { + Bugzilla::init_page(); + $cgi->(); + } + ); + return sub { + my $env = shift; + if ($env->{'psgix.cleanup'}) { + push @{ $env->{'psgix.cleanup.handler'} }, \&Bugzilla::_cleanup; + } + my $res = $app->($env); + Bugzilla::_cleanup() if not $env->{'psgix.cleanup'}; + return $res; + }; +} + + +1;
\ No newline at end of file diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index 3ac1692f0..9cf4bf397 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -47,6 +47,9 @@ use constant DB_COLUMNS => qw( isactive defaultmilestone allows_unconfirmed + default_platform_id + default_op_sys_id + security_group_id ); use constant UPDATE_COLUMNS => qw( @@ -55,6 +58,9 @@ use constant UPDATE_COLUMNS => qw( defaultmilestone isactive allows_unconfirmed + default_platform_id + default_op_sys_id + security_group_id ); use constant VALIDATORS => { @@ -837,6 +843,60 @@ sub is_active { return $_[0]->{'isactive'}; } sub default_milestone { return $_[0]->{'defaultmilestone'}; } sub classification_id { return $_[0]->{'classification_id'}; } +sub default_security_group { + my ($self) = @_; + return $self->default_security_group_obj->name; +} + +sub default_security_group_obj { + my ($self) = @_; + my $group_id = $self->{security_group_id}; + if (!$group_id) { + return Bugzilla::Group->new({ name => Bugzilla->params->{insidergroup}, cache => 1 }); + } + return Bugzilla::Group->new({ id => $group_id, cache => 1 }); +} + +sub default_platform_id { shift->{default_platform_id} } +sub default_op_sys_id { shift->{default_op_sys_id} } + +# you can always file bugs into a product's default security group, as well as +# into any of the groups in @always_fileable_groups +sub group_always_settable { + my ( $self, $group ) = @_; + my @always_fileable_groups = split(/\s*,\s*/, Bugzilla->params->{always_fileable_groups}); + return $group->name eq $self->default_security_group + || ( ( any { $_ eq $group->name } @always_fileable_groups ) ? 1 : 0 ); +} + + +sub default_platform { + my ($self) = @_; + if (!exists $self->{default_platform}) { + $self->{default_platform} = $self->default_platform_id + ? Bugzilla::Field::Choice + ->type('rep_platform') + ->new($self->{default_platform_id}) + ->name + : undef; + } + return $self->{default_platform}; +} + +sub default_op_sys { + my ($self) = @_; + if (!exists $self->{default_op_sys}) { + $self->{default_op_sys} = $self->default_op_sys_id + ? Bugzilla::Field::Choice + ->type('op_sys') + ->new($self->{default_op_sys_id}) + ->name + : undef; + } + return $self->{default_op_sys}; +} + + ############################### #### Subroutines ###### ############################### diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index d27896532..0d2a4cd86 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -570,7 +570,7 @@ sub create { # if a packager has modified bz_locations() to contain absolute # paths. ABSOLUTE => 1, - RELATIVE => $ENV{MOD_PERL} ? 0 : 1, + RELATIVE => 0, COMPILE_DIR => bz_locations()->{'template_cache'}, @@ -1037,7 +1037,7 @@ sub create { # under mod_perl, use a provider (template loader) that preloads all templates into memory my $provider_class - = $ENV{MOD_PERL} + = BZ_PERSISTENT ? 'Bugzilla::Template::PreloadProvider' : 'Template::Provider'; |