Skip to content

Add hostname to lockfile dependencies - #29

Open
kaibocai wants to merge 5 commits into
github:mainfrom
kaibocai:kaibocai-hostname-lockfile-schema
Open

Add hostname to lockfile dependencies#29
kaibocai wants to merge 5 commits into
github:mainfrom
kaibocai:kaibocai-hostname-lockfile-schema

Conversation

@kaibocai

@kaibocai kaibocai commented Sep 4, 2026

Copy link
Copy Markdown

Summary

  • add lockfile schema v0.0.3 with an optional canonical hostname on each dependency
  • accept explicit hostnames only as github.com or a lowercase <tenant>.ghe.com hostname
  • preserve hostnames supplied by v0.0.3 producers while allowing dotcom-only files to omit the field
  • normalize v0.0.1 and v0.0.2 dependencies to github.com in memory without changing either published schema or the source lockfile
  • keep scoped validation correct across canonical pin casing and the full reachable Action.Uses graph
  • retain v0.0.2 benchmarks alongside v0.0.3 for compatibility and performance comparisons

This is the first actions-lockfile step for github/actions-dispatch#1126. Hostname-aware Proxima producers will record the resolved hostname for every direct and transitive dependency. Reader support still needs to roll out before gh-actions-lock starts writing v0.0.3.

Testing

  • go test ./... -count=1
  • go vet ./...
  • bash script/release_test

kaibocai and others added 2 commits September 4, 2026 14:53
Introduce lockfile schema v0.0.3 with a required canonical hostname on every dependency. Preserve hostnames from new lockfiles and default v0.0.1/v0.0.2 dotcom-only entries to github.com in memory.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Ensure equivalent pin casing cannot skip required action-field checks during scoped parsing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 4, 2026 20:30
@kaibocai
kaibocai requested a review from a team as a code owner September 4, 2026 20:30

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Null dependency values can bypass required hostname validation, including during scoped parsing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity go/​pkg/​lockfile/​compat.go — A referenced dependency with a null YAML value bypasses all required-field validation: yaml.v3
What changed in this PR

Adds lockfile schema v0.0.3 with per-dependency hostnames while retaining compatibility with earlier schemas.

Changes:

  • Adds and embeds the v0.0.3 schema.
  • Preserves v0.0.3 hostnames and defaults legacy files to github.com.
  • Updates scoped validation, tests, benchmarks, and documentation.
File Description
schema/​lockfile-v0.0.3.json Defines schema v0.0.3.
README.md Documents hostname support.
go/​pkg/​lockfile/​schema.go Exposes the latest schema.
go/​pkg/​lockfile/​schema_test.go Tests schema and hostname validation.
go/​pkg/​lockfile/​schema_gen.go Embeds the generated schema.
go/​pkg/​lockfile/​lockfile.go Adds hostname metadata and validation.
go/​pkg/​lockfile/​internal/​cmd/​genschema/​main.go Generates all schema constants.
go/​pkg/​lockfile/​compat.go Adds v0.0.3 and legacy migration support.
go/​pkg/​lockfile/​compat_test.go Tests compatibility behavior.
go/​pkg/​lockfile/​bench_test.go Updates benchmarks for v0.0.3.
Files not reviewed (2)
  • go/pkg/lockfile/internal/cmd/genschema/main.go: Generated file
  • go/pkg/lockfile/schema_gen.go: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread go/pkg/lockfile/compat.go
kaibocai and others added 2 commits September 4, 2026 16:04
Traverse each selected workflow's reachable uses graph before applying schema-specific dependency validation. Reject malformed dependency bodies and non-string hostnames while preserving scoped fail-open behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Allow dotcom-only v0.0.3 lockfiles to omit hostname while retaining strict validation when the field is present. Preserve legacy normalization and scoped graph validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2f6db8ef-20bf-421d-878b-6d044d3865ea
import "testing"

var benchV002 = []byte(`version: v0.0.2
var benchV003 = []byte(`version: v0.0.3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Keep benchV002 and its benchmark as the compatibility baseline, then add benchV003 as a distinct entry. Replacing v0.0.2 drops coverage and prevents comparing parse cost across schema versions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point. I restored benchV002, BenchmarkParse_V002, and BenchmarkParseWithPolicy_V002, and kept the v0.0.3 cases separate. That preserves the compatibility baseline and lets us compare parse cost across versions.

"properties": {
"hostname": {
"description": "The optional canonical hostname of the GitHub instance that owns and resolves this dependency (for example, github.com). Hostname-aware producers record the exact canonical hostname for every dependency; when present, consumers use it to select the matching resolver.",
"type": "string",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we constrain this to a canonical hostname, either github.com or a GHE tenant hostname such as octocorp.ghe.com? The value should be the bare hostname only, with no protocol, port, path, query string, fragment, or surrounding whitespace.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated. When present, hostname now accepts only github.com or a lowercase <tenant>.ghe.com hostname. The schema and Go parser reject schemes, ports, paths, queries, fragments, surrounding whitespace, arbitrary domains, and invalid tenant labels. I also added focused coverage and a drift check so schema and parser enforcement stay aligned.

Accept only github.com or canonical GHE tenant hostnames when hostname is present. Restore the v0.0.2 benchmark baseline alongside v0.0.3 for compatibility comparisons.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2f6db8ef-20bf-421d-878b-6d044d3865ea
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.

3 participants