Skip to content

Commit bdc9678

Browse files
henryasAraqdom96
authored
possible fix for #910 (#911)
* fix #910 * Update src/nimblepkg/publish.nim Co-authored-by: Andreas Rumpf <[email protected]> * update detection algorithm * quit if url is insecure * raise exception instead of quit * Update src/nimblepkg/publish.nim Co-authored-by: Andreas Rumpf <[email protected]> Co-authored-by: Dominik Picheta <[email protected]>
1 parent 8eca18a commit bdc9678

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/nimblepkg/publish.nim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,17 @@ proc publish*(p: PackageInfo, o: Options) =
205205
if url.endsWith(".git"): url.setLen(url.len - 4)
206206
downloadMethod = "git"
207207
let parsed = parseUri(url)
208+
208209
if parsed.scheme == "":
209210
# Assuming that we got an ssh write/read URL.
210211
let sshUrl = parseUri("ssh://" & url)
211212
url = "https://" & sshUrl.hostname & "/" & sshUrl.port & sshUrl.path
213+
elif parsed.username != "" or parsed.password != "":
214+
# check for any confidential information
215+
# TODO: Use raiseNimbleError(msg, hintMsg) here
216+
raise newException(NimbleError,
217+
"Cannot publish the repository URL because it contains username and/or password. Fix the remote URL. Hint: \"git remote -v\"")
218+
212219
elif dirExists(os.getCurrentDir() / ".hg"):
213220
downloadMethod = "hg"
214221
# TODO: Retrieve URL from hg.

0 commit comments

Comments
 (0)