Skip to content
Tutorials Center
My learning

Topics

Lesson 31 of 37 ยท Administration

SonarQube Users, Groups and Permissions

Manage SonarQube access: global and project permissions, groups, permission templates, project visibility, and the safe defaults to set on a new server, with a permission checker.

SonarQube controls access through permissions granted to users and groups. Good administration keeps three rules: grant to groups, not individuals; give people the least they need; and set defaults so new projects start safe. This lesson shows where each setting lives and how permissions combine. The server is not runnable on this site, so the TryIts model the logic.

First steps on a fresh server

  1. Log in as admin with the initial password and change it immediately (the server forces this). The default account has the Administer System permission.
  2. Create a personal administrator account for yourself and, where possible, reduce use of the shared admin.
  3. Set the default visibility of new projects (public or private) under Administration > Projects > Management (the setting is also available on the project creation page).
  4. Configure authentication (see Authentication, SSO and tokens).

Users and groups

Administration > Security > Users lists accounts. Local accounts have a login and password; accounts created by LDAP, SAML or a GitHub login are marked as external and are managed through that provider.

Two groups exist from the start:

  • sonar-users: every authenticated user belongs to it automatically.
  • sonar-administrators: members receive broad administrator rights.

Create groups per team or role, for example shop-developers, security-champions, quality-managers, and add users to them (Administration > Security > Groups). With SAML or LDAP, group membership can be synchronised from the identity provider so you do not maintain two lists.

Global permissions

Set in Administration > Security > Global Permissions:

Permission Allows
Administer System Everything: settings, upgrades, users, plugins
Administer Quality Gates Create and edit gates
Administer Quality Profiles Create and edit profiles
Execute Analysis Run scanners on any project (rarely needed globally)
Create Projects Create new projects (the creator becomes its admin)
Create Portfolios / Applications Where those features exist in your edition

Keep Administer System to a very small group. A common pattern is to give Create Projects to a team lead group only, or to rely on the GitHub or GitLab integration for creation.

Project permissions

Set per project under Project Settings > Permissions:

Permission Allows
Browse See the project (only matters for private projects)
See Source Code View source in the UI
Administer Issues Change issue status (false positive, accepted) and severity
Administer Security Hotspots Review hotspots (set Safe, Fixed, Acknowledged)
Administer Change project settings, delete the project
Execute Analysis Run analysis on this project

Public projects are visible to anyone who can log in (and sometimes anonymous users when Force user authentication is off). Private projects are visible only to users granted Browse. For internal source code, turn Administration > Configuration > General > Security > Force user authentication on so nobody can read anything without logging in.

Permission templates

A permission template is a set of project permissions applied when a project is created. Under Administration > Security > Permission Templates define one default template, for instance:

  • sonar-administrators: Administer, Administer Issues, Administer Security Hotspots, See Source Code, Browse.
  • sonar-users: Browse, See Source Code (read access for all employees), or nothing for private-by-default.
  • A project creator row that gives the creator Administer.

Templates can also match project keys by a regular expression, such as ^shop-.*, to give team-specific groups access to all matching projects. Changing a template does not change existing projects; use Bulk Apply Permission Template in the project management page.

Effective permission: how it combines

A user's rights on a project are the union of what they hold directly and what each of their groups holds (including sonar-users and "Anyone" on public projects). There is no deny rule. So to remove a right, remove it from every group and user where it was granted.

Stand-in: permission calculator

The stand-in below models users, groups and the union rule, and answers "can this user do X on this project?".

JS Stand-in: union of user and group permissions

Press Run (or Ctrl + Enter) to see the console output here.

No output.

In this stand-in admin implies everything for simplicity. In SonarQube the Administer permission is its own right and does not automatically include every other one, so grant what each role needs explicitly.

Stand-in: audit for risky settings

Periodic audits catch drift. This script scans a list of projects for common problems: public visibility on private code, too many administrators, and missing hotspot reviewers.

JS Stand-in: permission audit

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Good practice

  • Grant permissions to groups, and add people to groups through the identity provider.
  • Split duties: developers get Browse, See Source Code, Administer Issues; a few champions get Administer Security Hotspots; only leads get Administer.
  • Review the list of Administer System members every quarter.
  • Use private projects and Force user authentication for non-public code.
  • Document the template in your team handbook so new projects are consistent.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the project permission Administer Security Hotspots allow?

    It is the permission to review hotspots.
  2. 2. A user is in two groups. One gives Browse, the other gives Administer Issues. What are their rights?

    Permissions are a union; SonarQube has no deny rules.
  3. 3. You change the default permission template. What happens to existing projects?

    Templates apply at project creation; use Bulk Apply Permission Template for existing projects.
  4. 4. Which group contains every authenticated user?

    sonar-users is the built-in group for all logged-in users.

Summary

  • Change the default admin password, make personal admin accounts and keep Administer System small.
  • Use groups, permission templates and private visibility with forced authentication for internal code.
  • Permissions combine as a union; remove a right everywhere to revoke it.
  • Separate duties between developers, hotspot reviewers and administrators.

Next: Authentication, SSO and tokens