X1011 / git-directory-deploy

deploy a directory as a git branch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fatal error compromises the token

MoOx opened this issue · comments

see it by yourself https://travis-ci.org/putaindecode/putaindecode.fr#L8587

Any idea how to catch this to avoid the token to be compromised ?

@MoOx, which build number should i be looking at?

Oh shit, travis didn't update the link. Let me take a look so I can find the build

Well to reproduce, juste use an incorrect repo url like repo=https://$GH_TOKEN@github.com/WRONG/PROJECT.git.
When the git failure come, you will get a failure message with the repo url exposed :(

So here is an output

> putaindecode.fr@0.0.0 _deploy /home/travis/build/putaindecode/putaindecode.fr
> GH_OWNER=putaindecode GH_PROJECT_NAME=putaindecode.fr ./scripts/deploy-to-gh-pages.sh -v

+set +o verbose
+git diff --exit-code --quiet --cached
++git log -n 1 --format=%s HEAD
+commit_title='Break things on purpose'
++git log -n 1 --format=%H HEAD
+commit_hash=b51086c4b059e57e49432bcca6b22b523ced2292
++git rev-parse --abbrev-ref HEAD
+previous_branch=HEAD
+'[' ']'
+'[' '!' -d dist ']'
++ls -A dist
+[[ -z 404.html
authors
c-est-quoi-putaindecode
CNAME
favicon.ico
feed.xml
humans.txt
icons
images
index.b51086c.js
index.css
index.html
posts
projets
tests.html
tests.js ]]
+disable_expanded_output
+'[' true ']'
+set +o xtrace
git fetch --force $repo $deploy_branch:$deploy_branch
remote: Invalid username or password.
fatal: Authentication failed for 'https://01aeb894368c34fe923b46607e80ed1cec85982d@github.com/putaindecode/putaindecode.fr.shit.git/'

(don't worry this token is dead)
In this example the remote url is wrong because I added a mistake in the repo. But if we can do something to prevent this, it would be great !

Cool, thanks for the example. I actually have been able to reproduce the issue already, and I'm working on a solution to filter the output of the commands that use $repo. I just haven't had the time to finish it. I'll let you know.

Awesome !
Take your time :)

@X1011 Any ETA on this?

@isiahmeadows unfortunately, no; i have an idea for a solution, and i started implementing it, but i haven't had time to finish it.

@X1011 Could you, maybe, outline your idea here so that contributors could pick this up?

Or, in case you think it isn't an exhaustive solution, consumers could apply it on their own forks.