You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SecurityProperties.java 3.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.core.config;
  21. import java.util.List;
  22. import org.sonar.api.PropertyType;
  23. import org.sonar.api.config.PropertyDefinition;
  24. import static java.util.Arrays.asList;
  25. import static org.sonar.api.CoreProperties.CATEGORY_SECURITY;
  26. import static org.sonar.api.CoreProperties.CORE_ALLOW_PERMISSION_MANAGEMENT_FOR_PROJECT_ADMINS_DEFAULT_VALUE;
  27. import static org.sonar.api.CoreProperties.CORE_ALLOW_PERMISSION_MANAGEMENT_FOR_PROJECT_ADMINS_PROPERTY;
  28. import static org.sonar.api.CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE;
  29. import static org.sonar.api.CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY;
  30. import static org.sonar.api.CoreProperties.SONAR_VALIDATE_WEBHOOKS_DEFAULT_VALUE;
  31. import static org.sonar.api.CoreProperties.SONAR_VALIDATE_WEBHOOKS_PROPERTY;
  32. class SecurityProperties {
  33. private SecurityProperties() {
  34. // only static stuff
  35. }
  36. static List<PropertyDefinition> all() {
  37. return asList(
  38. PropertyDefinition.builder(CORE_FORCE_AUTHENTICATION_PROPERTY)
  39. .defaultValue(Boolean.toString(CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE))
  40. .name("Force user authentication")
  41. .description(
  42. "Forcing user authentication prevents anonymous users from accessing the SonarQube UI, or project data via the Web API. "
  43. + "Some specific read-only Web APIs, including those required to prompt authentication, are still available anonymously."
  44. + "<br><strong>Disabling this setting can expose the instance to security risks.</strong>")
  45. .type(PropertyType.BOOLEAN)
  46. .category(CATEGORY_SECURITY)
  47. .build(),
  48. PropertyDefinition.builder(CORE_ALLOW_PERMISSION_MANAGEMENT_FOR_PROJECT_ADMINS_PROPERTY)
  49. .defaultValue(Boolean.toString(CORE_ALLOW_PERMISSION_MANAGEMENT_FOR_PROJECT_ADMINS_DEFAULT_VALUE))
  50. .name("Enable permission management for project administrators")
  51. .description(
  52. "Set if users with 'Administer' role in a project should be allowed to change project permissions. By default users with 'Administer' " +
  53. "role are allowed to change both project configuration and project permissions.")
  54. .type(PropertyType.BOOLEAN)
  55. .category(CATEGORY_SECURITY)
  56. .build(),
  57. PropertyDefinition.builder(SONAR_VALIDATE_WEBHOOKS_PROPERTY)
  58. .defaultValue(Boolean.toString(SONAR_VALIDATE_WEBHOOKS_DEFAULT_VALUE))
  59. .name("Enable local webhooks validation")
  60. .description(
  61. "Forcing local webhooks validation prevents the creation and triggering of local webhooks"
  62. + "<br><strong>Disabling this setting can expose the instance to security risks.</strong>")
  63. .type(PropertyType.BOOLEAN)
  64. .category(CATEGORY_SECURITY)
  65. .build()
  66. );
  67. }
  68. }