Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message expose API token #201

Open
pierresebastien opened this issue Sep 20, 2023 · 2 comments · May be fixed by #205
Open

Error message expose API token #201

pierresebastien opened this issue Sep 20, 2023 · 2 comments · May be fixed by #205
Assignees
Labels
p1 High priority

Comments

@pierresebastien
Copy link

Terraform Version

Terraform v1.5.6 on linux_amd64

Affected Resource(s)

  • sonarqube_user_external_identity (not tested with other resources)

Terraform Configuration Files

resource "sonarqube_user" "john_doe" {
  login_name = "gitlab-john-doe"
  name       = "John Doe"
  email      = "[email protected]"
  is_local   = false
}

resource "sonarqube_user_external_identity" "john_doe" {
  login_name        = sonarqube_user.john_doe.login_name
  external_identity = "john-doe"
  external_provider = "gitlab"
}

Expected Behavior

Show me an error without exposing sensitive data.

Actual Behavior

The API token used by the provider is exposed in the logs. Example : Error updating SonarQube user: failed to execute http request: POST https://squ_0000000000000000000000000000000000000000:@sonarqube.example.com/api/users/update_identity_provider?login=gitlab-john-doe&newExternalIdentity=john-doe&newExternalProvider=gitlab giving up after 5 attempt(s). Request: &{0xab1940 0xc00021c600}

Steps to Reproduce

  1. terraform apply

With the current behavior, the token used to connect to my self-hosted SonarQube instance is displayed in my CI/CD logs and so other people having read access to my GitLab repository could use it to gain more access to SonarQube.

@agaillar
Copy link

We had the same problem when trying to configure permissions and groups....
The application was not available (error 502), and the credentials were included in the logs.

@jdamata jdamata linked a pull request Oct 3, 2023 that will close this issue
@jdamata jdamata linked a pull request Oct 3, 2023 that will close this issue
@jdamata jdamata self-assigned this Oct 17, 2023
@jdamata jdamata added the p1 High priority label Dec 18, 2023
@lkwg82
Copy link

lkwg82 commented Apr 16, 2024

A workaround until solved can be

(GNU sed)

terraform apply 2>&1 | sed -e 's/\(http request: GET https\?:\/\/\)[^@]*/\1***/g'

⚠️ plz check with an invalid host in ur environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants