Skip to content

wip: capture wip/2026-07-28-capture-BytePort-fresh (audit 2026-07-24..08-02) - #329

Open
KooshaPari wants to merge 21 commits into
mainfrom
wip/2026-07-28-capture-BytePort-fresh
Open

wip: capture wip/2026-07-28-capture-BytePort-fresh (audit 2026-07-24..08-02)#329
KooshaPari wants to merge 21 commits into
mainfrom
wip/2026-07-28-capture-BytePort-fresh

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Aug 3, 2026

Copy link
Copy Markdown
Owner

User description

Automated audit capture of local dirty state.

  • Branch: wip/2026-07-28-capture-BytePort-fresh
  • Captured and pushed during the cross-drive audit sessions (2026-07-24 to 2026-08-02).
  • Working tree changes preserved; no destructive operations.

CodeAnt-AI Description

Add owner-scoped compute-mesh desired state with deployment handoff tracking

What Changed

  • Protected clients can submit and list workload desired state through new mesh endpoints; ownership comes from authentication rather than request data.
  • Workload requests now require a verified SHA-256 composition digest, artifact reference, supported execution backend, and valid placement details.
  • Accepted mesh intents persist with deployment records and retain composition and artifact metadata for later reconciliation.
  • Deployment creation accepts and returns composition handoff metadata, validating digest format and artifact references.
  • Provider error messages are capped at 64 KB, and provider requests honor caller cancellation and deadlines.
  • Removed committed runtime secrets from deployment and runtime configuration, and aligned build and validation tooling with the current backend layout.

Impact

✅ Owner-scoped workload submissions
✅ Persistent composition-to-artifact traceability
✅ Bounded provider error memory usage

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Copilot AI review requested due to automatic review settings August 3, 2026 01:07
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@codeant-ai

codeant-ai Bot commented Aug 3, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 672cd3b Aug 03, 2026 · 01:07 01:10

@codeant-ai

codeant-ai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Aug 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

Comment on lines +30 to +31
if err := request.Validate(""); err == nil {
t.Fatal("missing authenticated owner accepted")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The test name claims to reject owner impersonation, but this assertion only validates an empty authenticated owner. Since DesiredStateRequest has no owner field, it never exercises a request containing an attacker-supplied owner or verifies that such a value is ignored; add an explicit handler-level impersonation test or rename the test to reflect the condition it actually covers. [inconsistent naming]

Severity Level: Minor 🧹
- ⚠️ Application test name overstates impersonation coverage.
- ⚠️ Handler-level impersonation coverage already exists.
- ⚠️ No production ownership behavior is changed by this test gap.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** backend/internal/application/meshworkload/submit_test.go
**Line:** 30:31
**Comment:**
	*Inconsistent Naming: The test name claims to reject owner impersonation, but this assertion only validates an empty authenticated owner. Since `DesiredStateRequest` has no owner field, it never exercises a request containing an attacker-supplied owner or verifies that such a value is ignored; add an explicit handler-level impersonation test or rename the test to reflect the condition it actually covers.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +9 to +24
func validateCompositionMetadata(digest, artifactRef string) error {
if digest != "" {
const prefix = "sha256:"
encoded := strings.TrimPrefix(digest, prefix)
if encoded == digest || len(encoded) != 64 {
return fmt.Errorf("composition_digest must be sha256 followed by 64 hexadecimal characters")
}
if _, err := hex.DecodeString(encoded); err != nil {
return fmt.Errorf("composition_digest must be sha256 followed by 64 hexadecimal characters")
}
}
if len(artifactRef) > 512 || strings.IndexFunc(artifactRef, func(r rune) bool { return r < 0x20 || r == 0x7f }) >= 0 {
return fmt.Errorf("artifact_ref must be at most 512 characters and contain no control characters")
}
return nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: This validator permits a digest without an artifact reference and an artifact reference without a digest, while the mesh contract requires both fields. The deployment creation path persists metadata whenever either field is present, so incomplete composition records can enter the same storage used by mesh listing and be exposed as incomplete workloads. Require both fields together or keep these metadata records out of the mesh representation. [incomplete implementation]

Severity Level: Major ⚠️
- ⚠️ Regular deployments can appear as incomplete mesh workloads.
- ⚠️ Mesh consumers receive missing digest or artifact data.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** backend/internal/application/deployment/composition_metadata.go
**Line:** 9:24
**Comment:**
	*Incomplete Implementation: This validator permits a digest without an artifact reference and an artifact reference without a digest, while the mesh contract requires both fields. The deployment creation path persists metadata whenever either field is present, so incomplete composition records can enter the same storage used by mesh listing and be exposed as incomplete workloads. Require both fields together or keep these metadata records out of the mesh representation.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +31 to +41
func (s *DeploymentStore) Save(ctx context.Context, owner string, req DesiredStateRequest) error {
dep, err := domain.NewDeployment(req.Name, owner, nil)
if err != nil {
return err
}
dep.SetCompositionMetadata(domain.CompositionMetadata{Digest: req.CompositionDigest, ArtifactRef: req.ArtifactRef})
dep.SetProvider("execution_backend", req.ExecutionBackend)
if len(req.Placement.Labels)+len(req.Placement.Constraints) > 0 {
dep.SetProvider("placement", req.Placement)
}
return s.repository.Create(ctx, dep)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Creating the deployment directly through repository.Create bypasses the existing ValidateDeployment contract, which checks for duplicate names within an owner. Repeated submissions with the same owner and name will therefore create multiple desired states because the database only enforces UUID uniqueness. Validate the deployment before persisting and enforce the uniqueness atomically at the persistence layer. [api mismatch]

Severity Level: Major ⚠️
- ❌ Repeated submissions create duplicate owner workloads.
- ⚠️ Reconciliation receives ambiguous desired-state records.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** backend/internal/application/meshworkload/submit.go
**Line:** 31:41
**Comment:**
	*Api Mismatch: Creating the deployment directly through `repository.Create` bypasses the existing `ValidateDeployment` contract, which checks for duplicate names within an owner. Repeated submissions with the same owner and name will therefore create multiple desired states because the database only enforces UUID uniqueness. Validate the deployment before persisting and enforce the uniqueness atomically at the persistence layer.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +56 to +57
backend, _ := dep.Providers()["execution_backend"].(string)
responses = append(responses, DesiredStateResponse{Name: dep.Name(), Owner: dep.Owner(), CompositionDigest: metadata.Digest, ArtifactRef: metadata.ArtifactRef, ExecutionBackend: backend, Status: dep.Status().String(), AcceptedAt: dep.CreatedAt()})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The placement is persisted under the provider map, but the response construction only reads execution_backend and never reconstructs Placement. Consequently, GET /mesh/workloads returns an empty placement for every workload that supplied labels or constraints. Decode the stored placement and assign it to the response. [logic error]

Severity Level: Major ⚠️
- ❌ Placement labels disappear from mesh workload listings.
- ❌ Reconciliation clients cannot recover scheduling constraints.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** backend/internal/application/meshworkload/submit.go
**Line:** 56:57
**Comment:**
	*Logic Error: The placement is persisted under the provider map, but the response construction only reads `execution_backend` and never reconstructs `Placement`. Consequently, `GET /mesh/workloads` returns an empty placement for every workload that supplied labels or constraints. Decode the stored placement and assign it to the response.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 672cd3ba14

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .cargo/audit.toml
Comment on lines -10 to -23
ignore = [
# --- Real vulnerabilities: no resolvable fixed version yet ---
# RUSTSEC-2026-0194 / RUSTSEC-2026-0195: quick-xml <0.41.0 quadratic
# runtime / unbounded namespace allocation. quick-xml is pulled in
# transitively via plist -> tauri (macOS Info.plist / bundle metadata
# parsing at build/bundle time, not on any attacker-reachable runtime
# path). Upstream `plist` v1.9.0 (latest release) still pins
# `quick-xml = "^0.39.2"`, so no combination of `cargo update` can reach
# the fixed 0.41.0 line without plist publishing a new release. Bumped
# plist 1.7.4 -> 1.9.0 / quick-xml 0.38.4 -> 0.39.4 (closest available)
# in this change; re-evaluate for a further bump once plist relaxes its
# quick-xml constraint upstream.
"RUSTSEC-2026-0194",
"RUSTSEC-2026-0195",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore the cargo-audit advisory suppressions

Deleting this config re-enables the previously documented RustSec failures while Cargo.lock still pins quick-xml 0.39.4, which is below the RustSec patched range for RUSTSEC-2026-0195 (>=0.41.0). In CI paths that run cargo audit/rustsec/audit-check, the removed [advisories].ignore entries were the only suppression for RUSTSEC-2026-0194/0195, so the required supply-chain gate will fail until the config is restored or the dependency is actually upgraded.

Useful? React with 👍 / 👎.

continue
}
backend, _ := dep.Providers()["execution_backend"].(string)
responses = append(responses, DesiredStateResponse{Name: dep.Name(), Owner: dep.Owner(), CompositionDigest: metadata.Digest, ArtifactRef: metadata.ArtifactRef, ExecutionBackend: backend, Status: dep.Status().String(), AcceptedAt: dep.CreatedAt()})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve placement when listing workloads

For a workload submitted with placement, POST /mesh/workloads echoes the placement but the persisted GET /mesh/workloads response is rebuilt here without assigning Placement; region/zone/node_pool-only placement is also skipped during Save, so schedulers lose the placement intent after the first read. Include the stored placement in this response and persist it whenever any placement field is set.

Useful? React with 👍 / 👎.

switch {
case errors.As(err, &validationErr):
c.JSON(http.StatusBadRequest, ErrorResponse{Error: validationErr.Error(), Code: "VALIDATION_ERROR"})
case errors.Is(err, context.Canceled):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: context.DeadlineExceeded is not handled alongside context.Canceled. When a request's deadline expires, ctx.Err() returns context.DeadlineExceeded, which falls through to the default case and returns 500 instead of 408. Add errors.Is(err, context.DeadlineExceeded) to the switch.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

// List returns persisted desired state for the authenticated owner.
func (h *MeshWorkloadHandler) List(c *gin.Context) {
owner := getUserUUID(c)
responses, err := h.useCase.List(c.Request.Context(), owner)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: The List handler does not handle context.Canceled or context.DeadlineExceeded. If the context is cancelled or its deadline expires during the store read, the error falls through to the 500 case. Add the same context error handling as the Submit handler.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.


// WorkloadIntent is an owner-scoped desired-state request for the compute mesh.
// Provider credentials and provider-specific state stay behind adapters.
type WorkloadIntent struct {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: WorkloadIntent is defined and tested but never imported or used outside the mesh package. The mesh workload endpoint uses meshworkload.DesiredStateRequest instead. Either wire WorkloadIntent into the handler or remove it to avoid dead code.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

return nil, err
}
responses := make([]DesiredStateResponse, 0, len(deployments))
for _, dep := range deployments {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: DeploymentStore.List returns every deployment for the owner that has composition metadata, including regular deployments created through the standard deployment flow. This could expose non-mesh deployments through the mesh listing endpoint. Consider adding a marker or filter to distinguish mesh intents from regular deployments.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

return nil, req.Context().Err()
}

func TestVercelValidateCredentialsHonorsCallerDeadline(t *testing.T) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: This test only covers VercelProvider.ValidateCredentials for deadline handling. NetlifyProvider and RailwayProvider also make HTTP calls that should honor caller cancellation and deadlines. Add equivalent tests for those providers.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 10 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 7
SUGGESTION 2
Issue Details (click to expand)

CRITICAL

File Line Issue
.cargo/audit.toml 23 Deletion removes cargo-audit advisory suppressions, re-enabling RustSec failures (RUSTSEC-2026-0194/0195) that were previously documented as safe-to-ignore

WARNING

File Line Issue
backend/internal/application/deployment/composition_metadata.go 24 Validator permits a digest without an artifact reference and an artifact reference without a digest, while the mesh contract requires both fields
backend/internal/application/meshworkload/submit.go 41 DeploymentStore.Save creates deployments directly through repository.Create, bypassing ValidateDeployment and its duplicate-name check
backend/internal/application/meshworkload/submit.go 57 DeploymentStore.List does not reconstruct Placement from the stored provider map, so GET /mesh/workloads returns empty placement for every workload
backend/internal/infrastructure/http/handlers/mesh_workload_handler.go 59 context.DeadlineExceeded is not handled alongside context.Canceled; deadline expiry returns 500 instead of 408
backend/internal/infrastructure/http/handlers/mesh_workload_handler.go 31 List handler has no context cancellation or deadline handling; cancelled requests fall through to 500
backend/internal/application/meshworkload/submit.go 51 DeploymentStore.List returns all deployments with composition metadata for the owner, including regular deployments that are not mesh intents
backend/lib/cloud/provider_timeout_test.go 18 Only tests VercelProvider for deadline handling; NetlifyProvider and RailwayProvider also make HTTP calls that should honor caller cancellation

SUGGESTION

File Line Issue
backend/internal/application/meshworkload/submit_test.go 31 Test name claims to reject owner impersonation but only validates an empty authenticated owner; DesiredStateRequest has no owner field so impersonation is handled at the handler level
backend/internal/application/mesh/intent.go 12 WorkloadIntent is defined and tested but never imported or used outside the mesh package — dead code
Files Reviewed (7 files)
  • backend/internal/application/mesh/intent.go - 1 issue
  • backend/internal/application/mesh/intent_test.go - 0 issues
  • backend/internal/application/meshworkload/submit.go - 3 issues
  • backend/internal/application/meshworkload/submit_test.go - 1 issue
  • backend/internal/application/deployment/composition_metadata.go - 1 issue
  • backend/internal/application/deployment/composition_metadata_test.go - 0 issues
  • backend/internal/infrastructure/http/handlers/mesh_workload_handler.go - 2 issues
  • backend/internal/infrastructure/http/handlers/mesh_workload_handler_test.go - 0 issues
  • backend/lib/cloud/http_helpers.go - 0 issues
  • backend/lib/cloud/http_helpers_test.go - 0 issues
  • backend/lib/cloud/provider_timeout_test.go - 1 issue
  • backend/lib/cloud/provider_netlify.go - 0 issues
  • backend/lib/cloud/provider_railway.go - 0 issues
  • backend/lib/cloud/provider_vercel.go - 0 issues
  • .cargo/audit.toml (deleted) - 1 issue

Fix these issues in Kilo Cloud


Reviewed by ling-3.0-flash-free · Input: 133.7K · Output: 33.7K · Cached: 1M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants