Skip to content

fix(oplog): keep source credentials out of the operation log - #881

Merged
runkids merged 1 commit into
mainfrom
runkids/oplog-redact-install-source
Nov 13, 2026
Merged

runkids merged 1 commit into
mainfrom
runkids/oplog-redact-install-source

Conversation

@runkids

@runkids runkids commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)
  • Approved feature or large change (the linked issue has the approved label)

What changed

operations.log stored an install source as typed, so a URL with a token in its userinfo or query put that token in the log and the dashboard's log view.

  • oplog.Write now redacts the source, oldSource and newSource args. It drops their userinfo, query and fragment, and drops the same parts from the message where an error echoes them. Every CLI and dashboard writer goes through it: install, search installs (single and batch), dashboard installs, and the dashboard's source edit (skill.source, which logged oldSource/newSource).
  • The redaction reuses update's redactRepoURL, moved to install.RedactRepoURL. It now also covers git+https:// and ssh:// passwords, and a source typed without a scheme such as user:token@host/owner/repo, which install clones over HTTPS. scp-style URLs, GitHub shorthands and local paths are unchanged.
  • logInstallOp logged args[0] as the source. When a flag came first (install --into team <url>), it logged "--into", and the message was never redacted. It now logs the parsed source.

Before, for skillshare install --into team "https://someone:s3cret@host/team/skills.git?token=q-s3cret":

{"cmd":"install","args":{"into":"team","mode":"global","source":"--into"},"status":"error","msg":"failed to clone repository: unable to access 'https://host/team/skills.git?token=q-s3cret.git/': ..."}

After:

{"cmd":"install","args":{"into":"team","mode":"global","source":"https://host/team/skills.git"},"status":"error","msg":"failed to clone repository: unable to access 'https://host/team/skills.git.git/': ..."}

Not covered:

  • Entries written before this change keep their credentials; skillshare log --clear removes them.
  • Terminal output still echoes a query token on a failed clone, and the clone URL appends .git after the query (...skills.git?token=x.git/). That is how the clone URL is built, not the log, so it is left for a follow-up.
  • A very short password is replaced wherever it appears in the logged message. That only affects readability, and update's fetch warnings already behave this way.

Linked Issue

Fixes #878

Checklist

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

Tests: TestRedactRepoURL (internal/install; the table moved from cmd/skillshare/update_batch_redact_test.go, plus git+https, ssh, scheme-less, shorthand and local-path cases), TestWrite_RedactsSourceCredentials (internal/oplog) and TestLog_InstallRedactsSourceCredentials (integration, real CLI with a flag before the source and a scheme-less source). All three failed before the fix. make check passes in the devcontainer. I also ran the built binary against an unreachable credentialed URL in global and project mode and found no credential in either log. Not run: website build (no docs changed) and the E2E runbooks.

An install source typed as a URL can carry a token in its userinfo or
query, and operations.log stored it as typed, so anyone reading the log
or the dashboard's log view could see the credential (#878).

Redact in oplog.Write, which every CLI and dashboard writer goes through:
the source, oldSource and newSource args lose their userinfo, query and
fragment, and the message loses the same parts where an error echoes
them. The redaction reuses update's redactRepoURL, moved to
install.RedactRepoURL. It now also covers git+https:// and ssh://
passwords, and a source typed without a scheme such as
user:token@host/owner/repo, which install clones over HTTPS.

logInstallOp logged args[0] as the source, which is a flag when one comes
first (install --into team <url> logged "--into"), so the message was
never redacted. It now logs the parsed source.

Fixes #878
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T06:42:57.366454Z e100a9e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@runkids
runkids merged commit 40697e0 into main Nov 13, 2026
9 checks passed
@runkids
runkids deleted the runkids/oplog-redact-install-source branch November 13, 2026 06:54
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.

install: operation log records the raw source argument, including any URL credentials

1 participant