Repository navigation
v1.0.1: security hardening, single-source version, tag-driven release workflow - #4
Merged
Merged
Conversation
TailClass parses repository content and then writes files, so a cloned
repository can influence output paths, CSS payloads and glob patterns.
This commit fixes what an adversarial review turned up and adds
regression tests plus a written review (docs/security-review.md).
Security
- Confine config-supplied outputCss/dictionaryFile/manifestFile to the
project root (apply/list/revert, incl. the --clean unlink path). A
malicious tailclass.config.json could previously write, and with
`revert --clean` delete, arbitrary files outside the project.
- Reject CSS-breaking class tokens (`;`, `{`, `}`, control chars, `*/`)
from `@apply`; they are preserved inline on the element instead. This
closes CSS injection via arbitrary values like
`text-[red;}html{display:none}]`.
- Replace the regex-based glob matcher with a backtracking-free DP
matcher: `**`-heavy patterns used to hang the process (config-driven
ReDoS); malformed `[` classes now degrade to literals instead of
throwing. Compiled matchers are cached and length-capped.
- Validate classPrefix/tailwindPrefix, sanitize dictionary labels,
categories and element hints, and validate selectors/payloads in the
generator (comment + CSS injection hardening).
- Refuse to overwrite scanned source files, or stylesheets/manifests
that do not look like TailClass output, without --force.
- Sanitize manifest-driven reverts and report corrupt manifests.
- Always exclude .git/, node_modules/ and .tailclass-backup/, even with
replaceDefaultExcludes.
- Validate configuration up front with actionable errors; unknown keys
become stderr warnings; JSON errors name the offending file.
Fixes
- `pointer-fine:` variants are recognised again (stray space in the
variant regex).
- Numeric custom class names are prefixed (tc-) so selectors stay valid.
- <style>/<textarea> skipping no longer lower-cases whole files, which
could shift offsets on Unicode input and re-allocated per tag.
- Analyzer subset matching memoises occurrence token sets.
Performance
- Glob fast paths (literal/prefix/suffix) plus scratch-buffer reuse keep
large-project runs at or below previous wall-clock time.
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Version
- Bump to 1.0.1 (security/robustness patch on top of 1.0.0).
- Add src/version.js as the single source of truth and reuse it for the
generated stylesheet header, revert manifest, dictionary payload and CLI,
removing three hard-coded "1.0.0" fallbacks that could drift.
- Test asserts package.json, src/version.js and the CLI agree.
Release automation (.github/workflows/publish.yml)
- Still triggered by pushing a `v*` tag; now also:
* validates the tag is `vX.Y.Z`,
* fails fast unless the tagged commit is already on `main` (so nothing is
published if the tag is created before the branch is merged),
* verifies the tag against both package.json and src/version.js,
* runs lint, the full test suite, the demo and `npm pack --dry-run`,
* publishes via npm OIDC trusted publishing with provenance,
* creates a matching GitHub Release (idempotent) with generated notes,
* writes publish/release summaries to the job summary,
* is serialised per tag so a re-pushed tag cannot double-publish.
Docs
- README: new "Security & Hardening (v1.0.1)" and "Releases & Versioning"
sections, security/release badges, refreshed version strings, --force flag.
- SECURITY.md: supported-version table updated, hardening guarantees kept.
- CHANGELOG: `[1.0.1] — 2026-11-09` entry.
- CONTRIBUTING: step-by-step release checklist.
- docs/security-review.md: note that all findings are fixed in v1.0.1.
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- Remove the README "Releases & Versioning" section and the release badge; the tag-driven behaviour is documented in .github/workflows/publish.yml. - Remove the CONTRIBUTING "Releasing" checklist for the same reason. - Drop the workflow bullet from the 1.0.1 CHANGELOG entry (version bump, test-suite and documentation notes remain). No workflow or version changes in this commit; v1.0.1 still releases on a `v*` tag push. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- Delete docs/security-review.md (findings, PoCs and remediation detail); the hardening behaviour it described is user-facing and stays documented as guarantees in SECURITY.md and the README "Configuration Safety" section. - Drop the "Security & Hardening (v1.0.1)" summary section and the security badge from the README, plus review links in SECURITY.md, CHANGELOG.md and the README Security section. - Remove "docs/" from the published package `files` list. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
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
Security and robustness hardening of the scanner, generator and rewriter, plus release prep for v1.0.1. TailClass parses repository content (
tailclass.config.json,tailclass.map.json, existingtailclass.css, markup) and then writes files, so everything it reads is treated as untrusted input.Security fixes
outputCss,dictionaryFile,manifestFilecoming from a config file must stay inside the project root. Previously"outputCss": "../../x.css"could overwrite files outside the project, andrevert --cleancould delete them. CLI paths (-o,--dict,--report) remain unrestricted. All writes go through one checked resolver.;,{,}, control characters or comment terminators are never emitted into@apply— they stay inline on the element. Closes CSS injection via arbitrary values such astext-[red;}html{display:none}]. Selectors, comments and dictionary metadata are re-validated in the generator.**repeated hundreds of times used to hang the process (config-driven ReDoS); they now finish in milliseconds. Malformed[classes degrade to literals instead of throwing. Matchers are cached and patterns length-capped.classPrefix/tailwindPrefixvalidated (and sanitized again in the namer); dictionarylabel/category/elementssanitized before reaching generated CSS comments.applyrefuses to overwrite a scanned source file, or a stylesheet/manifest that does not look like TailClass output, unless the new--forceflag is passed..git/,node_modules/,.tailclass-backup/are never scanned, even withreplaceDefaultExcludes.Invalid exclude[1]: expected a string, received null); JSON errors name the file; unknown keys warn on stderr so--jsonoutput stays clean.Correctness & performance
pointer-fine:*utilities are recognised again (stray space in the variant regex).tc-123btn) so selectors stay valid CSS.<style>/<textarea>skipping no longer lower-cases whole files (offset drift on Unicode) and no longer allocates per tag.Setmembership.Version & release
src/version.jsis now the single source of truth for the generated CSS header, revert manifest, dictionary payload and CLI (previously three hard-coded"1.0.0"fallbacks could drift).publish.yml(still triggered by pushing av*tag) now validates the tag shape, fails fast unless the tagged commit is onmain, checks the tag against both version files, publishes via npm OIDC trusted publishing with provenance, and creates the matching GitHub Release.Tests
test/glob.test.js(glob semantics, pathological-pattern timings, caching) andtest/security.test.js(path traversal, source clobbering, CSS injection, prefix/dictionary sanitisation, config validation, manifest hardening).npm run check→ lint + 50 tests passing;npm run demoruns clean;npm pack --dry-runverified.Behaviour notes for reviewers
@apply).--force.Release
Once merged:
git tag -a v1.0.1 -m "TailClass v1.0.1" && git push origin v1.0.1.