Skip to content

feat: add constrained Docker Secret template support - #178

Merged
soulteary merged 1 commit into
mainfrom
fix/issue-143-secret-files
Sep 6, 2026
Merged

soulteary merged 1 commit into
mainfrom
fix/issue-143-secret-files

Conversation

@soulteary

Copy link
Copy Markdown
Owner

Summary

  • add getSecret for reading one named file from /run/secrets or an absolute WEBHOOK_SECRET_DIR
  • confine reads with os.OpenRoot, reject arbitrary paths, non-regular files, and files larger than 1 MiB
  • add explicit trimSpace support without exposing a general-purpose cat function
  • document the safe Docker/Docker Swarm usage in English and Chinese
  • cover successful reads, missing files, traversal, symlink escape, file type, size limits, and fail-closed template loading

Closes #143.

Testing

  • go test -race ./internal/hook ./internal/flags ./internal/rules ./internal/doctor
  • go vet ./internal/hook ./internal/flags ./internal/rules ./internal/doctor
  • mkdocs build --strict

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-06T13:41:29.061306Z cda05c8 Manual request
ℹ️ 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.

Comment thread internal/hook/template_secret.go Fixed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e98bdfc43

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
defer secretRoot.Close()

secretFile, err := secretRoot.Open(name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid blocking before rejecting FIFO secret entries

When the selected secret is a FIFO with no writer, secretRoot.Open(name) blocks indefinitely, so execution never reaches the later regular-file check. A hook configuration referencing such an entry can therefore hang validation or server startup instead of rejecting the documented unsupported file type; open the entry without blocking or otherwise verify its type before a potentially blocking read.

Useful? React with 👍 / 👎.

@soulteary
soulteary force-pushed the fix/issue-143-secret-files branch from 0e98bdf to cda05c8 Compare September 6, 2026 13:34
@soulteary

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: cda05c8398

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@soulteary
soulteary merged commit fdfa044 into main Sep 6, 2026
11 checks passed
@soulteary
soulteary deleted the fix/issue-143-secret-files branch September 6, 2026 13:42
soulteary pushed a commit that referenced this pull request Sep 21, 2026
The version/documentation preparation PR that Release-Guide's
prerequisites require before a tag is pushed. release-preflight.sh
refuses a release whose version is not referenced by README.md, both
Container-Images.md, both Migration-Guide.md, and
example/quickstart/compose.yaml, so those move first.

7.3.1 rather than 7.4.0: the four PRs since 7.3.0 are two rate-limit
fixes and two dependency bumps. No hook syntax, flag, response or
container contract changes.

README-zhCN.md was still pinning 7.2.0 everywhere while README.md was
on 7.3.0 -- it is not in the preflight's file list, so it drifted a
whole release without anything noticing. It is now on 7.3.1 with the
English one. Its `extend-<version>` sentence is the exception: the
English reads "since 7.2.0", naming when the alias was introduced,
while the Chinese read "7.2.0 继续提供", naming the release that was
current when it was written -- which is why that line moved with every
release. It now says 自 7.2.0 起 and will not need bumping again.

Both release guides get a real 7.3.1 scope section instead of 7.3.0's,
and the prerequisite line names the PRs actually in this release
(#182, #183, #185, #186) rather than 7.3.0's #177 and #178.

Left alone on purpose: "WebHook 7.2.0 or later" in both
OwlMail-Integration.md is a minimum-version requirement, not a current
pin; web_test.go's 7.2.0 is an arbitrary injected build version; and
build.yml's error message uses a version only as an example of the
shape it wants.

Verified: go build ./... clean, all release-metadata and GoReleaser
tests pass, example/owlmail passes, and the preflight's six version
references all resolve to 7.3.1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HarHYzcGnvPbsnzD1esjpe
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.

cat function not available in webhook template engine (hooks.json validation failure)

2 participants