-
-
Notifications
You must be signed in to change notification settings - Fork 763
feat: redact credentials in remote urls #2220
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
474eec1
feat: redact credentials in remote urls
pd93 bf59e9c
chore: improve function naming
pd93 39d172f
fix: TaskfileNotSecureError should use redacted URI
pd93 d47bad9
feat: unexport all node implementation fields
pd93 d025392
fix: unexport HTTPNode.url
pd93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import ( | |
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestGitNode_ssh(t *testing.T) { | ||
|
|
@@ -13,8 +14,8 @@ func TestGitNode_ssh(t *testing.T) { | |
| assert.NoError(t, err) | ||
| assert.Equal(t, "main", node.ref) | ||
| assert.Equal(t, "Taskfile.yml", node.path) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git//Taskfile.yml?ref=main", node.rawUrl) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git", node.URL.String()) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git//Taskfile.yml?ref=main", node.Location()) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git", node.url.String()) | ||
| entrypoint, err := node.ResolveEntrypoint("common.yml") | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git//common.yml?ref=main", entrypoint) | ||
|
|
@@ -27,8 +28,8 @@ func TestGitNode_sshWithDir(t *testing.T) { | |
| assert.NoError(t, err) | ||
| assert.Equal(t, "main", node.ref) | ||
| assert.Equal(t, "directory/Taskfile.yml", node.path) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git//directory/Taskfile.yml?ref=main", node.rawUrl) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git", node.URL.String()) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git//directory/Taskfile.yml?ref=main", node.Location()) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git", node.url.String()) | ||
| entrypoint, err := node.ResolveEntrypoint("common.yml") | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, "ssh://[email protected]/foo/bar.git//directory/common.yml?ref=main", entrypoint) | ||
|
|
@@ -41,8 +42,8 @@ func TestGitNode_https(t *testing.T) { | |
| assert.NoError(t, err) | ||
| assert.Equal(t, "main", node.ref) | ||
| assert.Equal(t, "Taskfile.yml", node.path) | ||
| assert.Equal(t, "https://github.com/foo/bar.git//Taskfile.yml?ref=main", node.rawUrl) | ||
| assert.Equal(t, "https://github.com/foo/bar.git", node.URL.String()) | ||
| assert.Equal(t, "https://github.com/foo/bar.git//Taskfile.yml?ref=main", node.Location()) | ||
| assert.Equal(t, "https://github.com/foo/bar.git", node.url.String()) | ||
| entrypoint, err := node.ResolveEntrypoint("common.yml") | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, "https://github.com/foo/bar.git//common.yml?ref=main", entrypoint) | ||
|
|
@@ -55,8 +56,8 @@ func TestGitNode_httpsWithDir(t *testing.T) { | |
| assert.NoError(t, err) | ||
| assert.Equal(t, "main", node.ref) | ||
| assert.Equal(t, "directory/Taskfile.yml", node.path) | ||
| assert.Equal(t, "https://github.com/foo/bar.git//directory/Taskfile.yml?ref=main", node.rawUrl) | ||
| assert.Equal(t, "https://github.com/foo/bar.git", node.URL.String()) | ||
| assert.Equal(t, "https://github.com/foo/bar.git//directory/Taskfile.yml?ref=main", node.Location()) | ||
| assert.Equal(t, "https://github.com/foo/bar.git", node.url.String()) | ||
| entrypoint, err := node.ResolveEntrypoint("common.yml") | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, "https://github.com/foo/bar.git//directory/common.yml?ref=main", entrypoint) | ||
|
|
@@ -65,18 +66,28 @@ func TestGitNode_httpsWithDir(t *testing.T) { | |
| func TestGitNode_CacheKey(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| node, err := NewGitNode("https://github.com/foo/bar.git//directory/Taskfile.yml?ref=main", "", false) | ||
| assert.NoError(t, err) | ||
| key := node.CacheKey() | ||
| assert.Equal(t, "Taskfile.yml-directory.f1ddddac425a538870230a3e38fc0cded4ec5da250797b6cab62c82477718fbb", key) | ||
| tests := []struct { | ||
| entrypoint string | ||
| expectedKey string | ||
| }{ | ||
| { | ||
| entrypoint: "https://github.com/foo/bar.git//directory/Taskfile.yml?ref=main", | ||
| expectedKey: "git.github.com.directory.Taskfile.yml.f1ddddac425a538870230a3e38fc0cded4ec5da250797b6cab62c82477718fbb", | ||
| }, | ||
| { | ||
| entrypoint: "https://github.com/foo/bar.git//Taskfile.yml?ref=main", | ||
| expectedKey: "git.github.com.Taskfile.yml.39d28c1ff36f973705ae188b991258bbabaffd6d60bcdde9693d157d00d5e3a4", | ||
| }, | ||
| { | ||
| entrypoint: "https://github.com/foo/bar.git//multiple/directory/Taskfile.yml?ref=main", | ||
| expectedKey: "git.github.com.directory.Taskfile.yml.1b6d145e01406dcc6c0aa572e5a5d1333be1ccf2cae96d18296d725d86197d31", | ||
| }, | ||
| } | ||
|
|
||
| node, err = NewGitNode("https://github.com/foo/bar.git//Taskfile.yml?ref=main", "", false) | ||
| assert.NoError(t, err) | ||
| key = node.CacheKey() | ||
| assert.Equal(t, "Taskfile.yml-..39d28c1ff36f973705ae188b991258bbabaffd6d60bcdde9693d157d00d5e3a4", key) | ||
|
|
||
| node, err = NewGitNode("https://github.com/foo/bar.git//multiple/directory/Taskfile.yml?ref=main", "", false) | ||
| assert.NoError(t, err) | ||
| key = node.CacheKey() | ||
| assert.Equal(t, "Taskfile.yml-directory.1b6d145e01406dcc6c0aa572e5a5d1333be1ccf2cae96d18296d725d86197d31", key) | ||
| for _, tt := range tests { | ||
| node, err := NewGitNode(tt.entrypoint, "", false) | ||
| require.NoError(t, err) | ||
| key := node.CacheKey() | ||
| assert.Equal(t, tt.expectedKey, key) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.