atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

github token in comments when network connectivity lost mid-plan

Open camilosantana opened this issue 7 years ago • 4 comments

same as #615 except with github auth

Summary

our EKS cluster is having connectivity issues. some outbound calls are failing. atlantis, running in EKS, fails on reaching github. the web token is exposed in the comment.

Plan Error

running "/atlantis-data/bin/terraform0.11.10 init -input=false -no-color -upgrade" in "/atlantis-data/repos/company/terraform/9999/default/staging/us_east_1/project": exit status 1
Upgrading modules...
- module.tagging_project_firehydrant
  Updating source "github.com/company/terraform-aws-modules.git//modules/tagging?ref=v0.1.8"
Error downloading modules: Error loading modules: error downloading 'https://github.com/company/terraform-aws-modules.git?ref=v0.1.8': /usr/bin/git exited with 128: Cloning into '.terraform/modules/fc5cb94f6d78085f387ec232d65eb133'...
fatal: unable to access 'https://[email protected]/company/terraform-aws-modules.git/': Could not resolve host: github.com

Expected

trap error and mask token (above token is a randomly generated 41 char string)

Workflow

custom workflow being used

version: 3
automerge: true
projects:
...
...
...
workflows:
  default:
    plan:
      steps:
        - run: rm -rf ./terraform
        - init
        - run: terraform${ATLANTIS_TERRAFORM_VERSION} plan -lock=false -input=false -refresh -no-color -out $PLANFILE -var atlantis_user=$PULL_AUTHOR -var atlantis_repo=$BASE_REPO_OWNER/$BASE_REPO_NAME -var atlantis_repo_name=$BASE_REPO_NAME -var atlantis_repo_owner=$BASE_REPO_OWNER -var atlantis_pull_num=$PULL_NUM
    apply:
      steps:
        - apply

camilosantana avatar May 23 '19 23:05 camilosantana

Thanks for the report. I think I need to redact creds in the actually logger.

lkysow avatar May 23 '19 23:05 lkysow

Hmm actually, are you doing something special to get Terraform to clone those modules with the password in the URL? That's an error from TF, not Atlantis.

Also, I don't think it makes sense for Atlantis to redact output from custom steps. What a custom step outputs is up to the user.

lkysow avatar May 24 '19 14:05 lkysow

are you doing something special to get Terraform to clone those modules with the password in the URL

I'm using the following configmap that ends up as ~/.gitconfig for passwordless auth to private module repo.

gitconfig: |
  [url "https://[email protected]"]
  insteadOf = https://github.com

What a custom step outputs is up to the user

Understood. I'll launch custom script and parse output. thanks.

camilosantana avatar May 24 '19 17:05 camilosantana

I'm using the following configmap that ends up as ~/.gitconfig for passwordless auth to private module repo.

Ahh gotcha, yeah if you can't find a way to redact through the workflow let me know.

lkysow avatar May 24 '19 17:05 lkysow