Skip to content

Remote Taskfiles: redact credentials of remote URLs in prompts and logs - #2045

Closed
iwittkau wants to merge 2 commits into
go-task:mainfrom
iwittkau:redact-git-urls
Closed

Remote Taskfiles: redact credentials of remote URLs in prompts and logs#2045
iwittkau wants to merge 2 commits into
go-task:mainfrom
iwittkau:redact-git-urls

Conversation

@iwittkau

@iwittkau iwittkau commented Feb 6, 2025

Copy link
Copy Markdown
Contributor

This is to improve #1317.

I've implemented redaction support for the taskfile.Node interface, specifically for the taskfile.GitNode implementation which was logged with the clear-text user access tokens before.

@iwittkau iwittkau mentioned this pull request Feb 6, 2025
18 tasks
Comment thread taskfile/node_git.go
Comment thread taskfile/node_git.go
Comment thread taskfile/node_git.go Outdated
Comment thread taskfile/node.go Outdated
@iwittkau iwittkau changed the title Remote Taskfiles: redact credentials of git URLs in prompts and logs Remote Taskfiles: redact credentials of remote URLs in prompts and logs Feb 9, 2025
Comment thread taskfile/node.go
@iwittkau
iwittkau marked this pull request as draft February 9, 2025 10:38
@iwittkau

iwittkau commented Feb 9, 2025

Copy link
Copy Markdown
Contributor Author

I've turned this into a draft for now.

Comment thread taskfile/node_git.go

func (node *GitNode) FilenameAndLastDir() (string, string) {
return filepath.Base(node.path), filepath.Base(filepath.Dir(node.path))
return filepath.Base(filepath.Dir(node.filepath)), filepath.Base(node.filepath)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taskfile/cache.go uses it like this:

lastDir, filename := node.FilenameAndLastDir()

@iwittkau
iwittkau force-pushed the redact-git-urls branch 2 times, most recently from 03a5551 to 3fc6d75 Compare February 9, 2025 20:58
@iwittkau
iwittkau marked this pull request as ready for review February 9, 2025 21:02
@iwittkau

Copy link
Copy Markdown
Contributor Author

Compiling it and running this as a development version actually breaks my own git-based Remote Taskfiles setup 😅

Back to draft, I guess.

@iwittkau
iwittkau marked this pull request as draft February 10, 2025 11:27
Comment thread taskfile/node_git.go Outdated
@iwittkau
iwittkau force-pushed the redact-git-urls branch 2 times, most recently from 8b53b31 to 8d0a6cd Compare March 11, 2025 09:37
@pd93 pd93 linked an issue Mar 12, 2025 that may be closed by this pull request
@iwittkau
iwittkau marked this pull request as ready for review March 12, 2025 21:35
@iwittkau
iwittkau requested review from pd93 and vmaerten March 12, 2025 21:35
@iwittkau

Copy link
Copy Markdown
Contributor Author

I don't think it makes sense to keep this open.

A lot of the affected code was changed in the meantime. I think it would make more sense to think about URL redaction in the final stages of the experiment when the code has become more stable.

@iwittkau iwittkau closed this Apr 23, 2025
@pd93

pd93 commented Apr 23, 2025

Copy link
Copy Markdown
Member

Hi @iwittkau. Sorry for that. As you said, the code is changing a lot at the moment so things often go out of date very quickly. Thanks for your time though. Hopefully the conversation and changes here are still a useful reference to anyone implementing this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote taskfile could potentially expose secrets

4 participants