Bitbucket Repository Security Essentials Quiz Quiz

Challenge your knowledge of repository security best practices, permissions, and common threats in the tools ecosystem. This quiz covers essential strategies and features to protect code repositories and maintain secure collaboration workflows.

  1. Repository Access Levels

    Which access level should be granted to a user who needs to review code but must not push any changes to the repository?

    1. Read-only
    2. Admin
    3. Write
    4. Review-only

    Explanation: Read-only access allows users to view and review code without making any modifications, which is appropriate for reviewers. Admin rights include broad powers, such as changing settings, and are unnecessary for simple code reviews. Write access permits pushing changes, which exceeds the requirement. 'Review-only' is not a standard granular permission; it may be mistaken for read-only but is not typically an option.

  2. Securing Sensitive Information

    If a developer accidentally commits an API key to a repository, what is the most secure immediate action to take?

    1. Remove the key from the latest commit
    2. Delete the repository entirely
    3. Rotate the exposed credentials and purge history
    4. Notify the team but do nothing else

    Explanation: Rotating the exposed credentials ensures that the old key cannot be used maliciously, and purging history removes traces of the key from previous commits. Merely removing the key from the latest commit is not enough since it exists in the history. Deleting the entire repository is an extreme and impractical option. Notifying the team without further action leaves your system vulnerable.

  3. Branch Protection Mechanisms

    Which repository feature helps prevent unauthorized or accidental changes to important branches like main or master?

    1. Branch protection rules
    2. Commit hooks
    3. Repository mirroring
    4. Tagging

    Explanation: Branch protection rules offer controls such as preventing force pushes, requiring pull request reviews, and restricting direct commits to critical branches. Commit hooks are scripts run at certain events but do not enforce permanent protections. Repository mirroring relates to duplicating content, not branch safety. Tagging is used for marking points in history and does not prevent modifications.

  4. Least Privilege Principle

    Applying the principle of least privilege in a repository means which of the following actions?

    1. Giving all users admin access for convenience
    2. Granting users only the permissions needed for their role
    3. Allowing everyone to approve pull requests
    4. Disabling two-factor authentication

    Explanation: The principle of least privilege seeks to minimize risk by providing each user with only the necessary access rights. Granting all users admin access increases risk and breaks this principle. Allowing everyone to approve pull requests gives more permissions than needed. Disabling two-factor authentication reduces security and is unrelated to access granularity.

  5. Risks of Insecure Dependencies

    A developer includes a third-party dependency in the repository without reviewing it. What is the main security risk in this scenario?

    1. Reduced commit frequency
    2. Potential introduction of vulnerabilities
    3. Branch name conflicts
    4. Slower cloning speeds

    Explanation: Unreviewed third-party dependencies may contain known or unknown security flaws, potentially introducing vulnerabilities into the project. Reduced commit frequency and slower cloning speeds do not directly relate to security. Branch name conflicts can cause confusion but are not a primary security hazard in this context.