Skip to content

Get spec version directly from file#2710

Open
l0r1s wants to merge 1 commit into
devnet-readyfrom
spec-version
Open

Get spec version directly from file#2710
l0r1s wants to merge 1 commit into
devnet-readyfrom
spec-version

Conversation

@l0r1s
Copy link
Copy Markdown
Collaborator

@l0r1s l0r1s commented Jun 2, 2026

Summary

  • Read the local runtime spec_version directly from runtime/src/lib.rs in deploy-check workflows.
  • Remove the unused spec-version support binary and its runtime dependency.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

echo "network spec_version: $spec_version"
: ${spec_version:?bad spec version}
local_spec_version=$(cargo run -p subtensor-tools --bin spec-version | tr -d '\n')
local_spec_version=$(sed -n 's/ *spec_version: \([0-9]*\),/\1/p' runtime/src/lib.rs | head -n 1 | tr -d '\n')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[HIGH] Textual spec_version extraction is spoofable

This now trusts the first textual spec_version: <n>, match anywhere in runtime/src/lib.rs. A future PR can place an earlier matching token in a cfg-disabled item or macro before the real RuntimeVersion; Rust will still compile/use the real VERSION, but this deploy check will compare the fake value and can pass without an actual runtime spec bump. Keep avoiding cargo run from PR code, but make this parser target exactly one enabled #[sp_version::runtime_version] pub const VERSION block and fail on zero/multiple matches or any ambiguity.

echo "network spec_version: $spec_version"
: ${spec_version:?bad spec version}
local_spec_version=$(cargo run -p subtensor-tools --bin spec-version | tr -d '\n')
local_spec_version=$(sed -n 's/ *spec_version: \([0-9]*\),/\1/p' runtime/src/lib.rs | head -n 1 | tr -d '\n')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[HIGH] Textual spec_version extraction is spoofable

Same issue as the devnet workflow: the first regex hit in runtime/src/lib.rs controls the gate, not necessarily the real VERSION.spec_version. A future PR can add an earlier cfg-disabled or macro-contained spec_version: 999999, line and make this check pass while the deployed runtime version is unchanged. The workflow should extract from a single unambiguous runtime-version declaration and fail closed on ambiguity.

echo "network spec_version: $spec_version"
: ${spec_version:?bad spec version}
local_spec_version=$(cargo run -p subtensor-tools --bin spec-version | tr -d '\n')
local_spec_version=$(sed -n 's/ *spec_version: \([0-9]*\),/\1/p' runtime/src/lib.rs | head -n 1 | tr -d '\n')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[HIGH] Textual spec_version extraction is spoofable

Same issue as the other deploy checks: this accepts the first textual spec_version field in runtime/src/lib.rs. That lets a future PR spoof the CI comparison with an earlier non-runtime token while leaving the actual VERSION.spec_version unchanged. The check needs to fail closed unless it can identify exactly the real runtime VERSION declaration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🛡️ AI Review — Skeptic (security review)

VERDICT: VULNERABLE

BASELINE scrutiny: established write-permission contributor with substantial prior subtensor history; branch spec-version -> devnet-ready.

No prior Skeptic findings were present. The PR does not modify .github/ai-review/* or .github/copilot-instructions.md.

Findings

Sev File Finding
HIGH .github/workflows/check-devnet.yml:49 Textual spec_version extraction is spoofable inline
HIGH .github/workflows/check-finney.yml:47 Textual spec_version extraction is spoofable inline
HIGH .github/workflows/check-testnet.yml:48 Textual spec_version extraction is spoofable inline

Conclusion

The PR removes PR-code execution from the spec-version check, but the replacement parser makes the deploy gate spoofable by future PRs. That is a steady-state CI bypass for the runtime spec_version bump check, so the verdict is VULNERABLE until the extraction is tied unambiguously to the real VERSION constant and fails on ambiguous matches.


# 🔍 AI Review — Auditor (domain review) has not yet run on this PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🔄 AI review updated — Skeptic: VULNERABLE

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.

2 participants