azdo-cli 0.5.0-019-fix-pr-command.341 → 0.5.0-019-fix-pr-command.344
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +30 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -766,22 +766,39 @@ async function status() {
|
|
|
766
766
|
|
|
767
767
|
// src/services/git-remote.ts
|
|
768
768
|
import { execSync } from "child_process";
|
|
769
|
+
|
|
770
|
+
// src/services/remote-warning.ts
|
|
771
|
+
var WARNING = "azdo: warning: origin includes embedded credentials; consider removing them with 'git remote set-url origin <clean-url>'\n";
|
|
772
|
+
var warned = false;
|
|
773
|
+
function noticeCredentialBearingRemote() {
|
|
774
|
+
if (warned) {
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
warned = true;
|
|
778
|
+
process.stderr.write(WARNING);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// src/services/git-remote.ts
|
|
769
782
|
var patterns = [
|
|
770
|
-
// HTTPS (current): https://dev.azure.com/{org}/{project}/_git/{repo}
|
|
771
|
-
/^https?:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]
|
|
772
|
-
// HTTPS (legacy + DefaultCollection): https://{org}.visualstudio.com/DefaultCollection/{project}/_git/{repo}
|
|
773
|
-
/^https?:\/\/([^.]+)\.visualstudio\.com\/DefaultCollection\/([^/]+)\/_git\/([^/]
|
|
774
|
-
// HTTPS (legacy): https://{org}.visualstudio.com/{project}/_git/{repo}
|
|
775
|
-
/^https?:\/\/([^.]+)\.visualstudio\.com\/([^/]+)\/_git\/([^/]
|
|
776
|
-
// SSH (current): git@ssh.dev.azure.com:v3/{org}/{project}/{repo}
|
|
777
|
-
/^git@ssh\.dev\.azure\.com:v3\/([^/]+)\/([^/]+)\/([^/]
|
|
778
|
-
// SSH (legacy): {org}@vs-ssh.visualstudio.com:v3/{org}/{project}/{repo}
|
|
779
|
-
/^[^@]+@vs-ssh\.visualstudio\.com:v3\/([^/]+)\/([^/]+)\/([^/]
|
|
783
|
+
// HTTPS (current): https://[user[:token]@]dev.azure.com/{org}/{project}/_git/{repo}[.git]
|
|
784
|
+
/^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+?)(?:\.git)?$/,
|
|
785
|
+
// HTTPS (legacy + DefaultCollection): https://[user[:token]@]{org}.visualstudio.com/DefaultCollection/{project}/_git/{repo}[.git]
|
|
786
|
+
/^https?:\/\/(?:[^@/]+@)?([^.]+)\.visualstudio\.com\/DefaultCollection\/([^/]+)\/_git\/([^/]+?)(?:\.git)?$/,
|
|
787
|
+
// HTTPS (legacy): https://[user[:token]@]{org}.visualstudio.com/{project}/_git/{repo}[.git]
|
|
788
|
+
/^https?:\/\/(?:[^@/]+@)?([^.]+)\.visualstudio\.com\/([^/]+)\/_git\/([^/]+?)(?:\.git)?$/,
|
|
789
|
+
// SSH (current): git@ssh.dev.azure.com:v3/{org}/{project}/{repo}[.git]
|
|
790
|
+
/^git@ssh\.dev\.azure\.com:v3\/([^/]+)\/([^/]+)\/([^/]+?)(?:\.git)?$/,
|
|
791
|
+
// SSH (legacy): {org}@vs-ssh.visualstudio.com:v3/{org}/{project}/{repo}[.git]
|
|
792
|
+
/^[^@]+@vs-ssh\.visualstudio\.com:v3\/([^/]+)\/([^/]+)\/([^/]+?)(?:\.git)?$/
|
|
780
793
|
];
|
|
794
|
+
var httpsUserinfo = /^https?:\/\/[^@/]+@/;
|
|
781
795
|
function parseAzdoRemote(url) {
|
|
782
796
|
for (const pattern of patterns) {
|
|
783
797
|
const match = pattern.exec(url);
|
|
784
798
|
if (match) {
|
|
799
|
+
if (httpsUserinfo.test(url)) {
|
|
800
|
+
noticeCredentialBearingRemote();
|
|
801
|
+
}
|
|
785
802
|
const project = match[2];
|
|
786
803
|
if (/^DefaultCollection$/i.test(project)) {
|
|
787
804
|
return { org: match[1], project: "" };
|
|
@@ -808,6 +825,9 @@ function parseRepoName(url) {
|
|
|
808
825
|
for (const pattern of patterns) {
|
|
809
826
|
const match = pattern.exec(url);
|
|
810
827
|
if (match) {
|
|
828
|
+
if (httpsUserinfo.test(url)) {
|
|
829
|
+
noticeCredentialBearingRemote();
|
|
830
|
+
}
|
|
811
831
|
return match[3];
|
|
812
832
|
}
|
|
813
833
|
}
|