feat(config): add agent registration schema (ADR 0058 Phase 1) - #2768
Conversation
PR Summary by QodoAdd agent registration config schema with validation and defaults (ADR 0058 P1)
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Site previewPreview: https://4edce2f5-site.fullsend-ai.workers.dev Commit: |
|
🤖 Finished Review · ✅ Success · Started 12:56 AM UTC · Completed 1:07 AM UTC |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Code Review by Qodo
1. Agent URL checks bypassable
|
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Previous run (2)ReviewFindingsLow
Previous run (3)ReviewFindingsLow
Previous run (4)ReviewFindingsLow
Previous run (5)ReviewFindingsMedium
Low
Previous run (6)ReviewFindingsLow
Previous runReviewFindingsLow
Previous runReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Labels: PR adds agent registration config schema (Go feature) touching harness and install-related config code. Previous run (7)ReviewFindingsLow
Previous run (8)ReviewFindingsLow
Previous runReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Labels: PR adds agent registration config schema (Go feature) touching harness and install-related config code. Previous run (9)ReviewFindingsLow
Previous run (10)ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Labels: PR adds agent registration config schema (Go feature) touching harness and install-related config code. Previous run (11)ReviewFindingsMedium
Low
Previous run (12)ReviewFindingsMedium
Low
Labels: PR adds agent registration config schema (Go feature) touching harness and install-related config code. |
ascerra
left a comment
There was a problem hiding this comment.
Review
Findings
Medium
-
[security / defense-in-depth]
internal/config/config.go—validateAgentEntries()uses case-sensitivestrings.HasPrefix(entry.Source, "https://")for URL detection. A mixed-case scheme likeHTTPS://falls through to the local-path branch, bypassing integrity hash and allowlist checks at validation time. Not a blocker because config validation is a UX layer, not a security boundary — Phase 3 runtime resolution usesharness.IsURL()(viaurl.Parse) which normalizes the scheme, so a malicious URL would be caught or rejected at load time regardless. Should be fixed before Phase 3 ships, ideally by delegating toharness.IsURL()or lowercasing before the prefix check. -
[security / defense-in-depth]
internal/config/config.go— The newisValidHex(),hasAllowlistPrefix(), and manual#sha256=parsing duplicate weaker versions of existing hardened helpers (harness.ParseIntegrityHashusesLastIndex+ lowercase normalization;harness.MatchingAllowedPrefixInListdoes percent-decoding and dot-segment cleaning). Again, not a blocker because the runtime harness loader enforces the hardened checks — validation disagreeing with runtime just means a bad entry could be stored in config but would fail at load time rather than at config parse time. Worth consolidating before Phase 3 to avoid user confusion (entry passes validation, fails at runtime). Ifconfigcan't importharnessdue to circular deps, extracting the shared logic into a leaf package likeinternal/urlutilwould work.
Low
- [correctness]
AgentName()usesfilepath.Base()which is OS-dependent (\separator on Windows). For URL sources,path.Base()would be more correct. Low risk since the CLI is predominantly run on Linux, and Phase 2'sfullsend agent addwill construct entries programmatically rather than relying on name derivation from raw user input.
Overall: clean Phase 1 foundation. Schema matches ADR 0058, legacy format detection is a nice touch, test coverage is thorough (96.5% patch). The medium findings are defense-in-depth improvements that should land before Phase 3 runtime resolution ships.
4677afb to
ae846de
Compare
|
🤖 Review · |
ae846de to
d90110a
Compare
|
🤖 Finished Review · ✅ Success · Started 1:51 AM UTC · Completed 2:04 AM UTC |
d90110a to
5816301
Compare
|
🤖 Finished Review · ✅ Success · Started 2:11 AM UTC · Completed 2:23 AM UTC |
5816301 to
7f1d1da
Compare
|
🤖 Finished Review · ✅ Success · Started 2:29 AM UTC · Completed 2:48 AM UTC |
|
🤖 Finished Review · ❌ Failure · Started 3:31 AM UTC · Completed 3:45 AM UTC |
4c09de0 to
f5eb2e1
Compare
|
🤖 Finished Review · ✅ Success · Started 3:50 AM UTC · Completed 4:02 AM UTC |
f5eb2e1 to
9978306
Compare
|
🤖 Finished Review · ✅ Success · Started 4:09 AM UTC · Completed 4:23 AM UTC |
Implements Phase 1 of ADR-0058: agent registration config schema. Adds AgentEntry type with custom YAML unmarshaler supporting both string shorthand and object form. Includes DerivedName() for name derivation from source filenames, URL integrity hash validation, allowlist prefix matching, and defense-in-depth path validation. Extracts shared URL utilities into internal/urlutil/ leaf package to break the config→harness circular import. Signed-off-by: Greg Allen <gallen@redhat.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Greg Allen <gallen@redhat.com>
9978306 to
86ab284
Compare
|
🤖 Finished Review · ✅ Success · Started 4:29 AM UTC · Completed 4:44 AM UTC |
|
🤖 Finished Retro · ✅ Success · Started 11:34 AM UTC · Completed 11:46 AM UTC |
Retro: PR #2768 —
|
Summary
Implements Phase 1 of ADR 0058 — config schema for agent registration.
AgentEntrytype with custom YAML unmarshaler supporting string shorthand (source-url) and object form ({name, source})AgentsandAllowedRemoteResourcesfields to bothOrgConfigandPerRepoConfig#sha256=integrity fragment, HTTPS scheme, and allowlist prefix..traversalrole/name/slugagent entries with clear error (previously silently ignored)DefaultAllowedRemoteResources()inNewPerRepoConfigDefaultAgentEntries()builder for install-time default URL computationThis is the foundation PR — Phase 2 (CLI) and Phase 3 (runtime resolution) can begin in parallel after this merges.
Test plan
internal/configtests pass (including updated legacy agents test)internal/harnesstests passgo build ./...succeeds🤖 Generated with Claude Code