Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
matrix:
include:
- name: macOS ARM64
os: macos-14
os: macos-15
artifact: stackcord-darwin-arm64
extension: ""
- name: Windows x64
Expand All @@ -51,7 +51,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version: 1.26.6
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Unit and integration tests
working-directory: cli
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version: 1.26.6
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Plugin, documentation, security, and strict-profile contracts
env:
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version: 1.26.6
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Multi-repository service continuity scenario
env:
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version: 1.26.6
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Build all supported targets without CGO
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
test "$(python3 -c 'import json; print(json.load(open(".codex-plugin/plugin.json"))["version"])')" = "${TAG#v}"
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version: 1.26.6
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Test exact source
working-directory: cli
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
languages: go
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version: 1.26.6
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Build for CodeQL
working-directory: cli
Expand All @@ -44,7 +44,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16
with:
go-version: 1.26.6
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Race tests
working-directory: cli
Expand Down
4 changes: 3 additions & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/kcrmin/Stackcord/cli

go 1.26.0

toolchain go1.26.11

require (
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
github.com/spf13/cobra v1.10.2
Expand All @@ -14,6 +16,6 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/text v0.44.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
4 changes: 2 additions & 2 deletions cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
6 changes: 4 additions & 2 deletions cli/internal/ui/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const maxImportEntries = 4096

var secretPattern = regexp.MustCompile(`(?i)(api[_-]?token|password|secret|private[_-]?key)\s*[:=]\s*[A-Za-z0-9_\-]{16,}`)
var sourceIDPattern = regexp.MustCompile(`^ui\.[a-z0-9]+(?:[.-][a-z0-9]+)*$`)
var windowsAbsolutePath = regexp.MustCompile(`^[A-Za-z]:/`)

// windowsVolumePath matches drive-absolute (C:/x) and drive-relative (C:x) names.
var windowsVolumePath = regexp.MustCompile(`^[A-Za-z]:`)

// Source describes an external UI artifact and its authority.
type Source struct {
Expand Down Expand Up @@ -93,7 +95,7 @@ func registerPlan(source Source) (operation.Plan, error) {
for _, entry := range reader.File {
rawName := strings.ReplaceAll(entry.Name, "\\", "/")
name := path.Clean(rawName)
if name == "." || name == ".." || strings.HasPrefix(name, "../") || strings.HasPrefix(rawName, "/") || windowsAbsolutePath.MatchString(rawName) {
if !filepath.IsLocal(name) || name == "." || name == ".." || strings.HasPrefix(name, "../") || strings.HasPrefix(rawName, "/") || windowsVolumePath.MatchString(rawName) {
return operation.Plan{}, fmt.Errorf("archive path escapes quarantine: %s", entry.Name)
}
pathKey := strings.ToLower(name)
Expand Down
22 changes: 22 additions & 0 deletions cli/internal/ui/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ func TestImportRejectsMaliciousArchives(t *testing.T) {
}
}

func TestImportRejectsArchivePathsOutsideQuarantine(t *testing.T) {
names := map[string]string{
"parent": "../escape.txt",
"nested parent": "screens/../../escape.txt",
"posix absolute": "/etc/escape.txt",
"unc share": `\\server\share\escape.txt`,
"drive absolute slash": "C:/escape.txt",
"drive absolute": `C:\escape.txt`,
"drive relative": "C:escape.txt",
"lower drive relative": "c:screens/escape.txt",
"drive relative backslash": `D:screens\escape.txt`,
}
for label, name := range names {
t.Run(label, func(t *testing.T) {
archive := zipFixtureEntries(t, [][2]string{{"LICENSE", "MIT"}, {name, "x"}})
plan, err := uiimport.ImportPlan(uiimport.Source{Root: t.TempDir(), Archive: archive, ID: "ui.external.escape", Kind: "mockup", Authority: "reference"})
require.ErrorContains(t, err, "escapes quarantine")
require.Empty(t, plan.Files)
})
}
}

func TestImportRejectsDuplicateNormalizedPaths(t *testing.T) {
archive := zipFixtureEntries(t, [][2]string{{"LICENSE", "MIT"}, {"screens/Recovery.html", "one"}, {"screens/recovery.html", "two"}})
plan, err := uiimport.ImportPlan(uiimport.Source{Root: t.TempDir(), Archive: archive, ID: "ui.external.duplicate", Kind: "mockup", Authority: "reference"})
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate_ci_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_ci_runs_product_contract_and_dogfood_checks_without_model_calls(self):

def test_pull_request_uses_two_representative_native_full_test_jobs(self):
ci = (ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8")
for token in ("macos-14", "windows-2025"):
for token in ("macos-15", "windows-2025"):
self.assertIn(token, ci)
for token in ("macos-15-intel", "windows-11-arm"):
self.assertNotIn(token, ci)
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate_release_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validate(root: pathlib.Path) -> list[str]:
if not re.search(r"@[0-9a-f]{40}$", use):
errors.append(f"GitHub Action is not commit-pinned: {path.name}: {use}")
ci = (root / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8") if (root / ".github" / "workflows" / "ci.yml").exists() else ""
for label in ("macos-14", "windows-2025"):
for label in ("macos-15", "windows-2025"):
if label not in ci:
errors.append(f"representative native CI target missing: {label}")
for label in ("macos-15-intel", "windows-11-arm"):
Expand Down
Loading