fix(ci): validate sanitized title is non-empty in spec drafter#2160
Merged
imran-siddique merged 1 commit intoMay 12, 2026
Merged
Conversation
The spec-drafter workflow sanitizes a user-supplied issue title down
to `[a-z0-9-]` and uses it in both a git branch name and a file path:
BRANCH="docs/spec-${ISSUE_NUMBER}-${SAFE_TITLE}"
SPEC_FILE="docs/specs/issue-${ISSUE_NUMBER}-${SAFE_TITLE}.md"
If the title contains no `[a-z0-9]` characters at all (e.g. an issue
titled "✨🚀✨" or in a script the sanitizer drops entirely), the
collapse-runs sed yields `-` and `head -c 50` keeps it. The resulting
branch (`docs/spec-123--`) and filename (`docs/specs/issue-123--.md`)
are technically valid but malformed; a fully-empty result would
produce dangling-dash paths.
Strip leading/trailing dashes after the collapse, then abort cleanly
with a workflow warning if the result is empty. The workflow exits 0
so the broader CI run isn't marked failed for a content issue on the
source issue.
🤖 AI Agent: security-scanner — View detailsNo security issues found. |
🤖 AI Agent: docs-sync-checker — Docs SyncDocs Sync
|
🤖 AI Agent: code-reviewer — View detailsTL;DR: 1 blocker, 0 warnings. The sanitization logic may lead to malformed paths if not properly validated.
Ensure that the workflow correctly handles cases where the sanitized title results in an empty string, preventing malformed paths. |
🤖 AI Agent: test-generator — `.github/workflows/ai-spec-drafter.yml`
|
🤖 AI Agent: breaking-change-detector — API CompatibilityAPI Compatibility
|
|
🟡 Contributor Check: MEDIUM
Automated check by AGT Contributor Check. |
PR Review Summary
Verdict: ❌ Changes needed |
MohammadHaroonAbuomar
pushed a commit
to MohammadHaroonAbuomar/agt-acs
that referenced
this pull request
Jun 1, 2026
…soft#2160) The spec-drafter workflow sanitizes a user-supplied issue title down to `[a-z0-9-]` and uses it in both a git branch name and a file path: BRANCH="docs/spec-${ISSUE_NUMBER}-${SAFE_TITLE}" SPEC_FILE="docs/specs/issue-${ISSUE_NUMBER}-${SAFE_TITLE}.md" If the title contains no `[a-z0-9]` characters at all (e.g. an issue titled "✨🚀✨" or in a script the sanitizer drops entirely), the collapse-runs sed yields `-` and `head -c 50` keeps it. The resulting branch (`docs/spec-123--`) and filename (`docs/specs/issue-123--.md`) are technically valid but malformed; a fully-empty result would produce dangling-dash paths. Strip leading/trailing dashes after the collapse, then abort cleanly with a workflow warning if the result is empty. The workflow exits 0 so the broader CI run isn't marked failed for a content issue on the source issue.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
.github/workflows/ai-spec-drafter.yml:84-87sanitizes a user-supplied issue title down to[a-z0-9-]and uses it in both a git branch name and a file path:If the title contains no
[a-z0-9]characters at all (e.g. an issue titled"✨🚀✨"), the sed pipeline collapses to a single-whichhead -c 50keeps. The resulting branch (docs/spec-123--) and filename (docs/specs/issue-123--.md) are malformed; a fully-empty result would produce dangling-dash paths.This builds on the shell-injection hardening from #2138 — same workflow, related defensive layer.
Change
::warning::if the sanitized result is empty.The workflow exits 0 so the broader CI run isn't marked failed for a content issue on the source issue.
Verification
run:block."Add new feature"->add-new-feature(unchanged)"✨🚀✨"-> empty -> workflow exits with warning (was:docs/spec-N--)"---fix---"->fixafter the new strip (was:-fix-)Surfaced during independent audit conducted by @finnoybu (Ken Tannenbaum, AEGIS Initiative); [LOW, Infrastructure/CI].