Skip to content

feat: add Rust (crates.io) and Go module publishing stages#589

Merged
imran-siddique merged 4 commits intomicrosoft:mainfrom
imran-siddique:feat/rust-go-publishing
Mar 30, 2026
Merged

feat: add Rust (crates.io) and Go module publishing stages#589
imran-siddique merged 4 commits intomicrosoft:mainfrom
imran-siddique:feat/rust-go-publishing

Conversation

@imran-siddique
Copy link
Copy Markdown
Member

Summary

Adds build, test, and publish pipeline stages for the Rust and Go SDKs to the unified ESRP publishing pipeline.

Rust (crates.io)

  • Build: \cargo build --release\
  • Test: \cargo test --release\
  • Package: \cargo package\ with artifact upload
  • Publish: \cargo publish\ using \CRATES_IO_TOKEN\ pipeline variable
  • Crate: [\�gentmesh](packages/agent-mesh/sdks/rust/agentmesh/)

Go (module proxy)

  • Build: \go build ./...\
  • Vet: \go vet ./...\
  • Test: \go test -v -race -coverprofile=coverage.out ./...\
  • Publish: Tags the module for proxy.golang.org indexing
  • Module: [\packages/agent-mesh/sdks/go](packages/agent-mesh/sdks/go/)

Pipeline changes

  • Added
    ust\ and \go\ to the \ arget\ parameter (\pypi,
    pm,
    uget, **
    ust*, **\go*, \�ll)
  • Added
    ustVersion\ and \goVersion\ parameters
  • All new stages have \dependsOn: []\ (run independently)
  • Both support \dryRun\ mode

Prerequisites for ADO

  • Rust: Add \CRATES_IO_TOKEN\ as a secret pipeline variable
  • Go: No additional secrets needed (publishes via git tag)

Docs

  • Updated \PUBLISHING.md\ with Rust and Go sections

@github-actions github-actions bot added documentation Improvements or additions to documentation size/L Large PR (< 500 lines) labels Mar 29, 2026
Copy link
Copy Markdown

@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 Agent: code-reviewer

Review Summary

This pull request introduces new pipeline stages for building, testing, and publishing Rust crates and Go modules. While the implementation is generally well-structured, there are critical security concerns, potential breaking changes, and areas for improvement that need to be addressed.


🔴 CRITICAL

1. Hardcoded Environment Variable Name for CRATES_IO_TOKEN

  • Issue: The cargo publish step uses the CRATES_IO_TOKEN environment variable directly. If this variable is not properly secured or misconfigured, it could lead to unauthorized publishing or token leakage.
  • Recommendation: Use Azure DevOps secure files or a dedicated secret management solution to handle sensitive tokens. Ensure that the pipeline explicitly validates the presence of the token before proceeding.

2. Lack of Validation for Rust Crate Metadata

  • Issue: The pipeline does not validate critical metadata fields like license, repository, or rust-version before publishing. This could lead to publishing crates with incomplete or incorrect metadata, violating compliance requirements.
  • Recommendation: Add a validation step to check Cargo.toml for required fields (license, repository, rust-version, etc.) before publishing.

3. Go Module Tagging Vulnerability

  • Issue: The Tag Go Module Release job uses git tag and git push without validating the tag format or ensuring that the repository is in a clean state. This could lead to accidental or malicious tagging.
  • Recommendation: Validate the repository state (git status) and enforce strict tag format rules. Reject tags that do not match the expected format (packages/agent-mesh/sdks/go/vX.Y.Z).

4. Thread Safety in Rust Crate

  • Issue: The agentmesh crate is being published without any checks for thread safety in concurrent execution. This is critical for a security-focused library.
  • Recommendation: Ensure that the crate includes tests for thread safety, especially if it involves cryptographic operations or shared state.

🟡 WARNING

1. Breaking Changes in Go Module Tagging

  • Issue: The Go module tagging format (packages/agent-mesh/sdks/go/vX.Y.Z) deviates from standard semantic versioning practices. This could confuse users or break downstream tooling that expects tags like vX.Y.Z.
  • Recommendation: Consider aligning the tag format with standard Go module practices, or clearly document the reasoning behind this deviation.

2. Backward Compatibility for Rust Crate

  • Issue: The pipeline assumes that the agentmesh crate is ready for publishing without verifying backward compatibility with previous versions.
  • Recommendation: Add a step to check for breaking changes in the Rust crate using tools like cargo semver or similar.

💡 SUGGESTIONS

1. Dry Run Enhancements

  • Observation: The dryRun parameter is implemented, but its functionality is limited to skipping the publish stages.
  • Suggestion: Extend dryRun to include validation steps for metadata, repository state, and tag format. This would allow developers to catch issues earlier.

2. Pipeline Artifact Naming

  • Observation: The artifact names (rust-agentmesh, go-coverage) are descriptive but could be standardized for consistency.
  • Suggestion: Use a consistent naming convention like artifact-rust-agentmesh and artifact-go-coverage.

3. Documentation Improvements

  • Observation: The PUBLISHING.md file provides basic instructions but lacks details on troubleshooting common issues (e.g., crates.io token errors, Go module proxy delays).
  • Suggestion: Add a "Troubleshooting" section to the documentation.

4. Testing Coverage

  • Observation: The pipeline runs tests for both Rust and Go, but there is no mention of coverage thresholds or reporting.
  • Suggestion: Enforce minimum test coverage thresholds and integrate coverage reports into the pipeline.

5. Concurrency in Rust Crate

  • Observation: The Rust crate is being built and tested, but there is no mention of concurrency testing.
  • Suggestion: Add tests for concurrent execution scenarios to ensure thread safety.

6. Error Handling in Go Module Tagging

  • Observation: The Tag Go Module Release job does not handle errors gracefully (e.g., if git push fails).
  • Suggestion: Add error handling and logging for each step in the tagging process.

7. Security Hardening

  • Observation: The pipeline does not include security scanning for Rust (cargo audit) or Go (gosec).
  • Suggestion: Integrate security scanning tools into the pipeline to detect vulnerabilities in dependencies.

Summary of Actions

  1. 🔴 Secure handling of CRATES_IO_TOKEN and validate its presence.
  2. 🔴 Add validation for Rust crate metadata before publishing.
  3. 🔴 Validate repository state and enforce strict tag format for Go module tagging.
  4. 🔴 Ensure thread safety in the Rust crate.
  5. 🟡 Align Go module tag format with semantic versioning or document the deviation.
  6. 🟡 Check backward compatibility for Rust crate using tools like cargo semver.
  7. 💡 Enhance dryRun functionality to include validation steps.
  8. 💡 Standardize pipeline artifact naming conventions.
  9. 💡 Add troubleshooting guidance to PUBLISHING.md.
  10. 💡 Enforce test coverage thresholds and integrate coverage reporting.
  11. 💡 Add concurrency tests for the Rust crate.
  12. 💡 Improve error handling in Go module tagging.
  13. 💡 Integrate security scanning tools (cargo audit, gosec) into the pipeline.

Addressing these issues will improve the security, reliability, and usability of the pipeline and the published SDKs.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

🤖 AI Agent: security-scanner — Security Review for Pull Request: Add Rust (crates.io) and Go Module Publishing Stages

Security Review for Pull Request: Add Rust (crates.io) and Go Module Publishing Stages


1. Prompt Injection Defense Bypass

No issues detected. The changes in this PR do not involve user input or prompt handling mechanisms that could lead to prompt injection vulnerabilities.

Rating: 🔵 LOW


2. Policy Engine Circumvention

The PR introduces new publishing stages for Rust and Go SDKs. The Rust publishing process uses a CRATES_IO_TOKEN stored as a secret pipeline variable, and the Go module relies on git tags for proxy indexing. While these mechanisms are standard, there are potential risks:

  • Rust (cargo publish): The CRATES_IO_TOKEN is critical for publishing. If the token is compromised, an attacker could publish malicious versions of the crate.
  • Go (git tag): The Go module proxy automatically indexes based on git tags. If tag creation is not restricted to authorized users, an attacker could create malicious tags.

Recommendations:

  • For Rust:
    • Ensure the CRATES_IO_TOKEN is stored securely and has minimal permissions (e.g., scoped to the specific crate).
    • Implement monitoring for unauthorized crate uploads.
  • For Go:
    • Restrict tag creation to authorized users via branch protection rules and CI/CD pipeline controls.
    • Monitor the Go module proxy for unexpected versions.

Rating: 🟠 HIGH


3. Trust Chain Weaknesses

No explicit changes to trust chain mechanisms (e.g., SPIFFE/SVID validation, certificate pinning) were introduced. However, the reliance on external registries (crates.io and proxy.golang.org) introduces inherent risks if these registries are compromised.

Recommendations:

  • Periodically verify the integrity of published artifacts using cryptographic signatures.
  • Consider integrating a Software Bill of Materials (SBOM) to track dependencies and their origins.

Rating: 🟡 MEDIUM


4. Credential Exposure

The CRATES_IO_TOKEN is mentioned as a secret pipeline variable, which is good practice. However, there is no explicit mention of safeguards to prevent accidental logging of this token during pipeline execution.

Recommendations:

  • Ensure that the CRATES_IO_TOKEN is masked in all pipeline logs.
  • Add automated checks to prevent secrets from being logged or exposed in error messages.

Rating: 🟠 HIGH


5. Sandbox Escape

No changes related to container or process isolation were introduced in this PR. The pipeline stages appear to execute standard build and test commands without any custom sandboxing mechanisms.

Rating: 🔵 LOW


6. Deserialization Attacks

No deserialization mechanisms (e.g., YAML, JSON, or pickle loading) were introduced or modified in this PR.

Rating: 🔵 LOW


7. Race Conditions

The Go module publishing process relies on git tags for indexing. If multiple tags are pushed concurrently, there could be a race condition leading to inconsistent module versions or indexing issues.

Recommendations:

  • Implement safeguards in the CI/CD pipeline to serialize tag creation and ensure only one tag is pushed at a time.
  • Use a locking mechanism or a dedicated release branch to manage versioning.

Rating: 🟡 MEDIUM


8. Supply Chain

The PR introduces dependencies on external registries (crates.io and proxy.golang.org). These dependencies are common in the Rust and Go ecosystems but introduce supply chain risks, such as dependency confusion or malicious package injection.

Recommendations:

  • Use tools like cargo-audit for Rust and go mod verify for Go to detect vulnerabilities in dependencies.
  • Regularly audit the dependencies of the Rust crate and Go module for known vulnerabilities.
  • Consider implementing a dependency allowlist to restrict the use of untrusted packages.

Rating: 🟠 HIGH


Summary of Findings

Category Rating Issue Recommendation
Prompt Injection Defense Bypass 🔵 LOW No prompt injection risks detected. No action needed.
Policy Engine Circumvention 🟠 HIGH Potential misuse of CRATES_IO_TOKEN or unauthorized git tag creation for Go module. Secure token storage, restrict tag creation, and monitor publishing activity.
Trust Chain Weaknesses 🟡 MEDIUM Reliance on external registries introduces inherent risks. Verify artifact integrity and consider SBOM integration.
Credential Exposure 🟠 HIGH Potential risk of CRATES_IO_TOKEN being logged during pipeline execution. Ensure token masking in logs and implement automated checks for secret exposure.
Sandbox Escape 🔵 LOW No changes related to sandboxing or isolation. No action needed.
Deserialization Attacks 🔵 LOW No deserialization mechanisms introduced. No action needed.
Race Conditions 🟡 MEDIUM Potential race condition in Go module tagging process. Serialize tag creation in CI/CD pipeline and use a locking mechanism.
Supply Chain 🟠 HIGH Dependency on external registries (crates.io, proxy.golang.org) introduces supply chain risks. Audit dependencies, use tools like cargo-audit and go mod verify, and consider a dependency allowlist.

Overall Risk Assessment: 🟠 HIGH

While the PR introduces valuable functionality, there are significant risks related to policy circumvention, credential exposure, and supply chain vulnerabilities. Addressing these issues is critical to maintaining the security of the publishing pipeline and the integrity of the published artifacts.

Action Items

  1. Secure the CRATES_IO_TOKEN and ensure it is not logged.
  2. Restrict git tag creation for Go module publishing to authorized users.
  3. Implement artifact integrity verification and SBOM generation.
  4. Audit dependencies for vulnerabilities and consider a dependency allowlist.
  5. Serialize tag creation in the CI/CD pipeline to avoid race conditions.

@imran-siddique imran-siddique force-pushed the feat/rust-go-publishing branch from 53d2850 to 9cfc2c4 Compare March 29, 2026 17:01
Copy link
Copy Markdown

@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 Agent: code-reviewer

Feedback on Pull Request: feat: add Rust (crates.io) and Go module publishing stages


🔴 CRITICAL: Security Issues

  1. Rust cargo publish Token Exposure

    • The CRATES_IO_TOKEN is passed directly as an environment variable (CARGO_REGISTRY_TOKEN) during the cargo publish step. If the pipeline logs are not properly sanitized, this token could be exposed in logs or error messages.
    • Actionable Fix: Use a secure secret management mechanism in Azure DevOps to ensure the token is masked in logs. Add a step to validate that no sensitive information is logged during the pipeline execution.
  2. Go Module Tagging

    • The git tag and git push commands are executed directly in the pipeline without additional safeguards. This could lead to accidental or malicious tagging and pushing of incorrect versions.
    • Actionable Fix: Add a validation step to ensure the version being tagged matches the expected semantic versioning format (e.g., vX.Y.Z). Additionally, implement a confirmation step or a dry-run mode for tagging.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Target Changes

    • Adding rust and go as new targets to the target parameter in the pipeline introduces potential breaking changes for existing users of the pipeline. If any automation relies on the previous set of targets (pypi, npm, nuget, all), it may fail if the new targets are not handled properly.
    • Actionable Fix: Ensure that downstream consumers of this pipeline are notified of the new targets and update their configurations accordingly.
  2. Go Module Tagging Format

    • The new tagging format for Go modules (packages/agent-mesh/sdks/go/v0.1.0) may not align with existing tagging conventions in the repository. This could cause confusion or conflicts with other modules.
    • Actionable Fix: Document the tagging format clearly in the repository's contribution guidelines and ensure consistency across all modules.

💡 Suggestions for Improvement

  1. Thread Safety in Concurrent Execution

    • While the pipeline stages are independent (dependsOn: []), concurrent execution of Rust and Go stages could lead to race conditions if they share resources (e.g., temporary directories, environment variables).
    • Suggestion: Use isolated working directories for each stage and ensure environment variables are scoped to individual jobs.
  2. Enhanced Validation for Rust Crate Packaging

    • The cargo package --allow-dirty command allows packaging even if the working directory has uncommitted changes. This could lead to unintended artifacts being published.
    • Suggestion: Add a step to verify that the working directory is clean before running cargo package. Use git status or git diff to ensure no uncommitted changes exist.
  3. Go Module Version Extraction

    • The current implementation relies on parsing doc.go for the version string (// Version: v0.1.0). This approach is fragile and prone to errors if the format changes or the comment is missing.
    • Suggestion: Use a more robust method to manage versions, such as a dedicated VERSION file or a standardized metadata file. Alternatively, use git describe to infer the version from existing tags.
  4. Pipeline Documentation

    • The PUBLISHING.md file has been updated, but the new Rust and Go sections could benefit from additional details, such as:
      • Example usage of the dryRun parameter for Rust and Go stages.
      • Explanation of how to handle errors during publishing (e.g., failed cargo publish or git push).
    • Suggestion: Expand the documentation to include these details for better clarity.
  5. Testing Coverage

    • The Go module testing includes -race and -coverprofile, which is excellent. However, the pipeline does not enforce a minimum coverage threshold.
    • Suggestion: Add a step to validate that the coverage percentage meets a predefined threshold (e.g., 80%).
  6. Error Handling in Go Tagging

    • The Go module tagging script does not handle errors robustly. For example, if git push fails, the pipeline will proceed without retrying or reporting the failure.
    • Suggestion: Add error handling and retries for critical steps like git push. Use set -e in the script to ensure the pipeline fails if any command fails.
  7. Pipeline Artifact Naming

    • The artifact names (rust-agentmesh, go-coverage) could be more descriptive to avoid confusion in multi-target pipelines.
    • Suggestion: Use names like rust-agentmesh-crate and go-module-coverage for better clarity.
  8. Backward Compatibility

    • Ensure that the addition of Rust and Go stages does not inadvertently affect existing Python, npm, or .NET publishing workflows.
    • Suggestion: Run a full pipeline dry-run with all targets (all) to validate that existing stages are unaffected.

Summary of Actions

  1. 🔴 Secure CRATES_IO_TOKEN to prevent accidental exposure in logs.
  2. 🔴 Add validation for Go module tagging to prevent accidental or malicious tags.
  3. 🟡 Notify downstream consumers of pipeline target changes.
  4. 🟡 Document Go module tagging format in contribution guidelines.
  5. 💡 Ensure thread safety in concurrent pipeline execution.
  6. 💡 Validate clean working directory before cargo package.
  7. 💡 Improve Go module version management and error handling.
  8. 💡 Expand pipeline documentation for Rust and Go stages.
  9. 💡 Enforce minimum test coverage for Go modules.
  10. 💡 Use descriptive artifact names for clarity.
  11. 💡 Validate backward compatibility with existing pipeline targets.

Let me know if you need further clarification or assistance!

Copy link
Copy Markdown

@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 Agent: code-reviewer

Review Summary

This pull request introduces new pipeline stages for publishing Rust crates to crates.io and Go modules to the Go module proxy. While the implementation appears functional and adheres to the repository's existing patterns, there are several areas that require attention to ensure security, correctness, and compliance with best practices.


🔴 CRITICAL: Security Concerns

  1. Hardcoded Environment Variable Name for CRATES_IO_TOKEN

    • The cargo publish step uses the CRATES_IO_TOKEN environment variable directly. If this token is compromised, it could allow unauthorized publishing of malicious crates under the agentmesh name.
    • Recommendation: Use Azure Key Vault or another secure secret management system to store and retrieve the token securely. Ensure that the token is rotated periodically and has minimal permissions.
  2. Missing Validation for doc.go Version Tag

    • The Go module publishing stage relies on extracting the version from doc.go but does not validate the format or ensure that the version matches the semantic versioning standard.
    • Recommendation: Add validation for the version format (e.g., vX.Y.Z) before proceeding with tagging. This prevents accidental or malformed tags that could disrupt the Go module proxy.
  3. Potential for Overwriting Existing Tags

    • The Go module tagging logic does not prevent overwriting existing tags. While the script checks if a tag exists, it does not fail the pipeline if the tag already exists.
    • Recommendation: Add a strict check to fail the pipeline if the tag already exists. This ensures that accidental overwrites are avoided.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Parameter Changes
    • Adding new parameters (rustVersion, goVersion) and new targets (rust, go) to the pipeline may break existing workflows if they rely on the previous parameter set or target list.
    • Recommendation: Ensure that all dependent workflows and documentation are updated to reflect these changes. Communicate these changes to the team to avoid disruptions.

💡 Suggestions for Improvement

  1. Thread Safety in Rust Crate

    • The agentmesh crate should be reviewed for thread safety, especially if it involves concurrent operations. Ensure that shared resources are properly synchronized and that unsafe code is minimized.
    • Recommendation: Add a thread safety audit for the Rust crate as part of the CI pipeline.
  2. OWASP Agentic Top 10 Compliance

    • Ensure that both the Rust and Go SDKs comply with OWASP Agentic Top 10 guidelines, especially regarding secure defaults, cryptographic operations, and input validation.
    • Recommendation: Add automated static analysis tools for Rust (e.g., cargo-audit) and Go (e.g., gosec) to the pipeline to detect vulnerabilities.
  3. Backward Compatibility

    • For both Rust and Go, ensure that changes to public APIs are backward-compatible. Breaking changes should be flagged and documented.
    • Recommendation: Integrate tools like semver for Rust and gopkg.in for Go to enforce semantic versioning and detect breaking changes.
  4. Improved Documentation

    • The PUBLISHING.md file is comprehensive but could benefit from more details on the Rust and Go publishing processes, especially around error handling and troubleshooting.
    • Recommendation: Add examples of common errors during publishing and how to resolve them.
  5. Testing Coverage

    • While the pipeline includes testing steps for both Rust and Go, there is no indication of coverage thresholds or reporting.
    • Recommendation: Define minimum coverage thresholds and integrate coverage reporting tools (e.g., tarpaulin for Rust and codecov for Go).
  6. Dry Run Validation

    • The dryRun mode is a useful addition, but it does not validate the publish steps (e.g., token presence, version correctness).
    • Recommendation: Extend dryRun to include validation of publish prerequisites without actually publishing.

Final Notes

The addition of Rust and Go publishing stages is a valuable enhancement to the pipeline. However, addressing the flagged security concerns and improving validation mechanisms will ensure robustness and compliance with best practices.

Copy link
Copy Markdown

@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 Agent: code-reviewer

Review Summary

This pull request introduces new stages for building, testing, and publishing Rust and Go SDKs as part of the unified ESRP publishing pipeline. The changes are well-structured and follow a clear pattern for integrating new languages into the existing CI/CD workflow. However, there are several areas that require attention, particularly regarding security, potential breaking changes, and best practices.

Actionable Feedback

🔴 CRITICAL Issues

  1. CRATES_IO_TOKEN Handling:

    • Ensure that the CRATES_IO_TOKEN is securely managed and not exposed in logs or error messages. Consider implementing additional checks to ensure that the token is valid before attempting to publish. This will help prevent unauthorized access to the crates.io account.
    • Recommendation: Use environment variable masking in the CI/CD pipeline to prevent token leakage.
  2. Go Module Tagging Logic:

    • The logic for tagging the Go module relies on parsing the doc.go file for the version. If the version is not correctly formatted or missing, it can lead to unintentional behavior. This could result in skipping the tagging process without clear feedback to the developer.
    • Recommendation: Implement stricter validation for the version format and provide clearer error messages or warnings if the version is not found or is invalid.

🟡 WARNING Issues

  1. Pipeline Changes:

    • The addition of Rust and Go stages modifies the existing pipeline structure. While this is a necessary enhancement, it could potentially break existing workflows if not properly documented or if users are not aware of the changes.
    • Recommendation: Clearly document these changes in the README or relevant documentation to inform users about the new parameters and stages.
  2. Dry Run Mode:

    • The dryRun parameter is a good addition, but ensure that all stages correctly handle this mode. If any stage does not respect the dryRun flag, it could lead to unintended changes in the production environment.
    • Recommendation: Conduct thorough testing to ensure that all stages behave as expected when dryRun is enabled.

💡 SUGGESTION Improvements

  1. Documentation Updates:

    • The documentation updates are comprehensive, but consider adding examples of how to use the new Rust and Go publishing features. This will help users understand the new functionality better.
    • Recommendation: Include example commands or workflows for building, testing, and publishing the Rust and Go SDKs in the PUBLISHING.md file.
  2. Error Handling:

    • Improve error handling in the scripts, especially in the Go tagging stage. Instead of just echoing warnings, consider using exit codes to indicate failure conditions.
    • Recommendation: Implement structured error handling to ensure that any issues during the build or publish process are clearly communicated and can be acted upon.
  3. Testing Coverage:

    • The Go testing stage includes coverage reporting, which is excellent. However, consider integrating coverage thresholds to ensure that the code meets a minimum coverage requirement before allowing a publish.
    • Recommendation: Set a coverage threshold and fail the pipeline if the coverage falls below this threshold.
  4. Rust Version Management:

    • The Rust version is set to stable, which is generally a good practice. However, consider allowing users to specify a version range or specific version to ensure compatibility with their projects.
    • Recommendation: Update the rustVersion parameter to accept version ranges or specific versions to provide more flexibility.

Conclusion

Overall, the pull request is a significant enhancement to the publishing pipeline for Rust and Go SDKs. Addressing the critical security issues and potential breaking changes will help ensure a smooth integration into the existing workflow. Implementing the suggested improvements will further enhance the robustness and usability of the pipeline.

Copy link
Copy Markdown

@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 Agent: code-reviewer

Feedback on Pull Request: feat: add Rust (crates.io) and Go module publishing stages


🔴 CRITICAL: Security Concerns

  1. Rust Crate Publishing Token Exposure

    • The CRATES_IO_TOKEN is used directly in the pipeline without additional safeguards. If this token is leaked or misused, it could allow unauthorized publishing or tampering with the crate.
    • Action: Use a secure secret management system (e.g., Azure Key Vault) and ensure the token is scoped to minimal permissions. Rotate the token regularly and audit its usage.
  2. Go Module Proxy Tagging

    • The pipeline automatically tags and pushes to the repository without verifying the authenticity of the doc.go file or the version string. This could lead to accidental or malicious tagging.
    • Action: Validate the doc.go file and version string against a predefined schema or regex pattern before proceeding with tagging. Ensure that the tag format adheres to semantic versioning.
  3. Lack of Code Signing for Rust Crates

    • Unlike other package types (e.g., PyPI, npm, NuGet), Rust crates are not signed in this pipeline. This could lead to supply chain attacks if the crate is tampered with during publishing.
    • Action: Integrate code signing for Rust crates using ESRP or another trusted signing mechanism.
  4. Go Module Proxy Indexing

    • The pipeline assumes that pushing a tag will trigger indexing by the Go module proxy. However, there is no verification step to ensure the module is correctly indexed and accessible.
    • Action: Add a post-publish verification step to confirm that the module is indexed and accessible via proxy.golang.org.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Parameter Changes

    • The addition of rustVersion and goVersion parameters changes the pipeline's interface. Existing pipeline consumers may need to update their configurations to accommodate these new parameters.
    • Action: Document these changes clearly in the release notes and ensure backward compatibility by providing default values.
  2. Tagging Format for Go Modules

    • The tagging format (packages/agent-mesh/sdks/go/v0.1.0) deviates from standard Go module tagging conventions. This could confuse developers or tools expecting simpler tags like v0.1.0.
    • Action: Consider aligning the tagging format with Go module standards or provide clear documentation on the rationale for this format.

💡 Suggestions for Improvement

  1. Pipeline Dry Run Enhancements

    • The dryRun mode currently skips publishing but does not validate the publishable artifacts (e.g., crate or module). Enhance the dry run mode to include artifact validation and simulate the publishing process.
    • Action: Add a validation step to ensure that the artifacts meet registry requirements (e.g., metadata completeness, versioning).
  2. Improved Logging

    • The pipeline logs could be more descriptive, especially for critical steps like publishing and tagging. This will help in debugging and auditing.
    • Action: Use structured logging (e.g., JSON format) for critical steps and include timestamps, pipeline parameters, and artifact details.
  3. Concurrency and Thread Safety

    • While this pipeline does not directly involve concurrent agent execution, ensure that the Rust crate and Go module are thread-safe for concurrent builds and tests.
    • Action: Add concurrency tests for the Rust and Go SDKs to validate thread safety.
  4. OWASP Agentic Top 10 Compliance

    • Ensure that the Rust and Go SDKs comply with OWASP Agentic Top 10 guidelines, particularly around trust/identity and sandboxing.
    • Action: Conduct a security review of the Rust and Go SDKs, focusing on cryptographic operations, credential handling, and sandbox escape vectors.
  5. Backward Compatibility for Rust Crates

    • Rust crates often have strict versioning requirements. Ensure that the crate adheres to semantic versioning and does not introduce breaking changes without incrementing the major version.
    • Action: Add a compatibility check to the pipeline that compares the new crate version with the previous one to detect breaking changes.
  6. Documentation

    • The PUBLISHING.md file has been updated, but it lacks detailed examples for common scenarios (e.g., troubleshooting failed builds, handling version conflicts).
    • Action: Expand the documentation with detailed examples, FAQs, and links to relevant resources.

Summary of Actions

  • 🔴 Address security concerns:

    • Secure CRATES_IO_TOKEN and rotate it regularly.
    • Validate doc.go and version strings before tagging Go modules.
    • Integrate code signing for Rust crates.
    • Add post-publish verification for Go module indexing.
  • 🟡 Mitigate breaking changes:

    • Document pipeline parameter changes and tagging format for Go modules.
  • 💡 Implement improvements:

    • Enhance dry run mode with artifact validation.
    • Improve logging for critical pipeline steps.
    • Conduct concurrency tests and OWASP compliance reviews for Rust and Go SDKs.
    • Expand documentation with examples and troubleshooting guidance.

By addressing these issues and suggestions, the pipeline will be more secure, robust, and user-friendly.

Copy link
Copy Markdown

@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 Agent: code-reviewer

Review Summary

This pull request introduces Rust and Go SDK publishing stages to the ESRP pipeline, enabling the publishing of Rust crates to crates.io and Go modules to the Go module proxy. The changes include updates to the pipeline YAML file and documentation. Below is a detailed review of the changes:


🔴 CRITICAL: Security Issues

  1. Missing Validation for CRATES_IO_TOKEN:

    • The cargo publish step uses the CRATES_IO_TOKEN environment variable directly without validating its presence or format.
    • Recommendation: Add a validation step to ensure the token is present and matches the expected format before proceeding with publishing. For example:
      if [ -z "$CRATES_IO_TOKEN" ]; then
          echo "##[error]CRATES_IO_TOKEN is missing or invalid."
          exit 1
      fi
  2. Potential Credential Leakage in Logs:

    • The cargo publish step uses the CARGO_REGISTRY_TOKEN environment variable, which could be inadvertently logged if cargo outputs debug information.
    • Recommendation: Ensure that sensitive environment variables are masked in logs using Azure DevOps's ##vso[task.setvariable] command or equivalent.
  3. Go Module Tagging Vulnerability:

    • The Go module tagging logic does not validate the VERSION extracted from doc.go. If doc.go is tampered with, it could lead to unintended tags being created.
    • Recommendation: Validate the VERSION format (e.g., using a regex like ^v[0-9]+\.[0-9]+\.[0-9]+$) before proceeding with tagging.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Parameter Changes:

    • Adding rustVersion and goVersion parameters to the pipeline introduces new configuration options. If these are not set correctly, it could break existing workflows.
    • Recommendation: Ensure backward compatibility by providing default values and documenting these parameters clearly in the pipeline documentation.
  2. Go Module Tagging Format:

    • The tagging format for Go modules (packages/agent-mesh/sdks/go/v0.1.0) is unconventional and may confuse users who expect simpler tags like v0.1.0.
    • Recommendation: Consider aligning the tag format with standard Go module practices unless there is a specific reason for the directory prefix.

💡 Suggestions for Improvement

  1. Dry Run Mode Enhancements:

    • The dryRun mode currently skips publishing but does not validate the publishing steps (e.g., checking token validity or simulating tagging).
    • Recommendation: Enhance dryRun mode to include validation of credentials and metadata without performing actual publishing.
  2. Pipeline Artifact Naming:

    • The artifact names (rust-agentmesh, go-coverage) could be more descriptive to avoid confusion in multi-target pipelines.
    • Recommendation: Use names like rust-agentmesh-crate and go-module-coverage.
  3. Documentation Consistency:

    • The documentation for Rust and Go publishing is detailed but could benefit from examples of common errors and troubleshooting steps.
    • Recommendation: Add a "Troubleshooting" section for each language, including common issues like missing tokens, incorrect metadata, or failed tests.
  4. Improved Logging:

    • The pipeline steps lack detailed logging, which could make debugging difficult.
    • Recommendation: Add more informative log messages, especially for critical steps like publishing and tagging.
  5. Concurrency Considerations:

    • The pipeline stages for Rust and Go run independently (dependsOn: []). If multiple targets are published simultaneously, there could be race conditions or resource contention.
    • Recommendation: Evaluate whether concurrency controls (e.g., limiting parallel jobs) are necessary to avoid conflicts.

Final Notes

The addition of Rust and Go publishing stages is a valuable enhancement to the ESRP pipeline. However, the pull request introduces several critical security concerns and potential breaking changes that must be addressed before merging. Additionally, improving validation, logging, and documentation will enhance the robustness and usability of the pipeline.

Action Items:

  • Address the critical security issues related to credential handling and validation.
  • Review and test the pipeline changes for backward compatibility.
  • Implement the suggested improvements for better usability and maintainability.

Copy link
Copy Markdown

@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 Agent: code-reviewer

Feedback on the Pull Request

🔴 CRITICAL: Security Issues

  1. Missing Verification of Crates.io Token:

    • The CRATES_IO_TOKEN is directly passed to the cargo publish command without validation. If the token is invalid or compromised, this could lead to unauthorized publishing or leakage of sensitive information.
    • Recommendation: Validate the token before using it. For example, use cargo login with the token and verify the login succeeds before proceeding with the publish step.
  2. Potential for Supply Chain Attacks:

    • The pipeline downloads the Rust toolchain using curl without verifying the integrity of the downloaded script (https://sh.rustup.rs). This opens the pipeline to potential supply chain attacks if the script is tampered with.
    • Recommendation: Pin the version of rustup and verify the checksum of the downloaded script before executing it. Alternatively, use a pre-installed version of rustup or a trusted container image with Rust pre-installed.
  3. Go Module Tagging Logic:

    • The logic for tagging Go modules relies on parsing doc.go for the version. If doc.go is tampered with, it could lead to incorrect or malicious tags being pushed to the repository.
    • Recommendation: Validate the version against a trusted source (e.g., a VERSION file or a CI-provided parameter) rather than relying on doc.go.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Parameter Changes:

    • Adding rustVersion and goVersion parameters changes the pipeline interface. If other teams or projects are using this pipeline, they may encounter issues if these parameters are not properly documented or default values are not set.
    • Recommendation: Ensure that all dependent teams are aware of these changes and update documentation to highlight the new parameters.
  2. Go Module Tagging Format:

    • The Go module tagging format (packages/agent-mesh/sdks/go/v0.1.0) deviates from standard semantic versioning practices. This could cause confusion or compatibility issues for downstream consumers.
    • Recommendation: Consider aligning the tag format with standard Go module versioning practices (e.g., v0.1.0).

💡 Suggestions for Improvement

  1. Pipeline Independence:

    • While the new stages are independent (dependsOn: []), consider adding a mechanism to ensure that Rust and Go stages are skipped if their respective directories are unchanged. This can save CI/CD resources.
    • Recommendation: Use path filters in the pipeline to trigger Rust and Go stages only when relevant files are modified.
  2. Enhanced Error Handling:

    • The Go module tagging stage does not fail the pipeline if no version is found in doc.go. This could lead to silent failures or missed releases.
    • Recommendation: Fail the pipeline explicitly if the version is missing, and provide clear instructions for fixing the issue.
  3. Documentation Updates:

    • The PUBLISHING.md file has been updated with detailed information about Rust and Go publishing. However, it would be helpful to include examples of common errors and troubleshooting steps for these new stages.
    • Recommendation: Add a "Troubleshooting" section for Rust and Go publishing to guide developers in resolving common issues.
  4. Testing Coverage:

    • The Go module testing includes -race and -coverprofile, which is excellent. However, the Rust crate testing does not include coverage analysis.
    • Recommendation: Consider integrating code coverage tools for Rust (e.g., tarpaulin) to ensure comprehensive testing.
  5. Dry Run Mode:

    • The dry run mode is a useful addition, but it currently skips the publish stages entirely. It might be beneficial to simulate the publish steps (e.g., by running cargo publish --dry-run for Rust) to validate the publish process without actually publishing.
    • Recommendation: Implement dry-run simulation for both Rust and Go publishing stages.
  6. Concurrency and Thread Safety:

    • The pipeline does not address potential concurrency issues when multiple agents execute the Rust or Go stages simultaneously. For example, simultaneous cargo publish commands could lead to race conditions or conflicts.
    • Recommendation: Add locking mechanisms or ensure unique workspace directories for each agent to avoid conflicts.

Summary

  • Critical Issues: Address token validation and supply chain security concerns.
  • Warnings: Ensure backward compatibility for pipeline parameters and review Go module tagging format.
  • Suggestions: Improve pipeline efficiency, error handling, documentation, and testing coverage.

By addressing these issues and suggestions, the pipeline will be more secure, robust, and maintainable.

@imran-siddique imran-siddique force-pushed the feat/rust-go-publishing branch from f78ab85 to 3383e56 Compare March 29, 2026 20:07
@github-actions github-actions bot added agent-mesh agent-mesh package size/XL Extra large PR (500+ lines) labels Mar 29, 2026
Copy link
Copy Markdown

@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 Agent: code-reviewer

🔴 CRITICAL: Security Concerns

  1. Rust Crate Publishing Without ESRP Integration:

    • The pull request mentions that ESRP does not currently support crates.io, and publishing uses a CRATES_IO_TOKEN stored in ADO pipeline variables. This bypasses ESRP signing and validation, which is a critical security risk. Any malicious actor gaining access to the pipeline could publish compromised crates under the Microsoft namespace.
    • Recommendation: Integrate ESRP signing and validation for Rust crates before publishing. If ESRP support for crates.io is unavailable, consider delaying the implementation until it is supported or explore alternative secure signing mechanisms.
  2. Go Module Proxy Indexing:

    • The Go module publishing relies on git tags for proxy indexing. While this is standard for Go modules, there is no mention of ESRP signing or validation for the Go module artifacts before tagging.
    • Recommendation: Ensure Go module artifacts are signed and validated via ESRP before tagging. Add explicit checks in the pipeline to verify the integrity of the module before pushing tags.
  3. Audit Logger Tampering:

    • The Go audit logger tests reveal that tampering with fields such as PreviousHash, AgentID, or Decision invalidates the chain. However, the AuditLogger implementation does not appear to enforce immutability or prevent direct modification of entries (al.entries).
    • Recommendation: Make AuditLogger.entries immutable or encapsulate it to prevent direct modification. Use defensive programming techniques to ensure the integrity of the audit log.
  4. Thread Safety in AuditLogger:

    • The AuditLogger implementation does not appear to be thread-safe. Concurrent calls to Log or Verify could lead to race conditions, especially if the logger is used in a multi-threaded environment.
    • Recommendation: Add synchronization mechanisms (e.g., mutex locks) to ensure thread safety for AuditLogger.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Target Changes:

    • Adding rust and go to the target parameter in the ESRP pipeline introduces new stages. If existing users rely on the pipeline without these targets, their workflows may break if the pipeline behavior changes unexpectedly.
    • Recommendation: Ensure backward compatibility by maintaining the behavior of existing targets (pypi, npm, nuget) and document the new targets clearly.
  2. Go Module Tagging Format:

    • The required tag format for Go modules (packages/agent-mesh/sdks/go/v0.1.0) deviates from standard semver tagging. This could confuse developers and lead to incorrect tagging.
    • Recommendation: Provide clear documentation and validation in the pipeline to enforce the correct tag format.

💡 SUGGESTIONS

  1. Comprehensive Testing:

    • The new tests for the Go audit logger and client are thorough, but consider adding tests for edge cases, such as:
      • Logging entries with invalid or empty fields.
      • Handling large audit logs (e.g., performance testing with 10,000+ entries).
      • Concurrent logging and verification to simulate real-world usage.
  2. Documentation Improvements:

    • The PUBLISHING.md file has been updated with detailed instructions for Rust and Go publishing. However, consider adding a section on security best practices, such as the importance of ESRP signing and artifact validation before publishing.
  3. Pipeline Dry Run:

    • The dryRun mode is a useful addition, but ensure it is well-documented and tested. Provide examples of how to use dryRun for each target in the documentation.
  4. Go Client Tests:

    • The new tests for NewClient are incomplete and truncated. Ensure all test cases are fully implemented and cover edge cases, such as invalid configurations or missing required fields.
  5. Rust Crate Metadata Validation:

    • Add automated checks in the pipeline to validate Rust crate metadata (e.g., license, repository URL, keywords) before publishing. This ensures compliance with crates.io policies.
  6. Docker Image Healthchecks:

    • The Docker publishing section mentions HEALTHCHECK but does not enforce it. Add validation in the pipeline to ensure all Dockerfiles include a HEALTHCHECK directive.

Summary

This pull request introduces valuable enhancements for Rust and Go SDK publishing but raises critical security concerns, particularly around ESRP integration and audit logger integrity. Addressing these issues is essential to maintain the security and reliability of the Agent Governance Toolkit.

imran-siddique and others added 2 commits March 29, 2026 13:24
Add build/test/publish pipeline stages for:
- Rust: cargo build → cargo test → cargo publish to crates.io
  (requires CRATES_IO_TOKEN pipeline variable)
- Go: go build → go vet → go test → git tag for module proxy indexing
  (Go modules publish via proxy.golang.org on tag push)

Both stages run independently (dependsOn: []) and support dryRun mode.

PUBLISHING.md rewritten to align with Microsoft publishing compliance:
- PyPI: ESRP Release only, no personal accounts
- npm: @microsoft scope via ESRP, no new scopes without approval
- NuGet: via aka.ms/nuget process
- Rust: crates.io via cargo publish (ESRP not yet supported)
- Go: module proxy via git tag
- Docker: MCR only, not GHCR/DockerHub
- Linux: PMC at aka.ms/pmcrepo
- Conda: microsoft channel on anaconda.org
- GitHub Packages: NOT approved for official releases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rust SDK (packages/agent-mesh/sdks/rust/agentmesh/):
  - lib.rs: 4 → 13 tests (client integration, governance pipeline)
  - types.rs: 0 → 27 tests (serde roundtrips, boundary values)
  - policy.rs: 7 → 29 tests (conditions, rate limits, YAML loading)
  - trust.rs: 8 → 20 tests (persistence, bounds, multi-agent)
  - audit.rs: 6 → 18 tests (tamper detection, filtering, chain integrity)
  - identity.rs: 4 → 13 tests (cross-identity, JSON roundtrip, Ed25519)
  Total: 29 → 120 tests (+91)

Go SDK (packages/agent-mesh/sdks/go/):
  - client_test.go: 4 → 16 tests (governance pipeline, trust changes)
  - policy_test.go: 7 → 22 tests (wildcards, conditions, mixed rules)
  - trust_test.go: 7 → 21 tests (concurrency, bounds, persistence)
  - audit_test.go: 5 → 23 tests (large chains, tamper, filtering)
  - identity_test.go: 4 → 19 tests (cross-identity, large data, JSON)
  Total: 27 → 101 tests (+74)

All Go tests pass. Rust tests follow existing patterns.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@imran-siddique imran-siddique force-pushed the feat/rust-go-publishing branch from 3383e56 to 1cce172 Compare March 29, 2026 20:37
Copy link
Copy Markdown

@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 Agent: code-reviewer

Pull Request Review: feat: add Rust (crates.io) and Go module publishing stages


🔴 CRITICAL: Security Issues

  1. Rust Crate Publishing Token Exposure

    • The CRATES_IO_TOKEN is used for publishing Rust crates. Ensure this token is securely stored and rotated periodically. If compromised, attackers could publish malicious crates under the agentmesh name.
    • Actionable Fix: Use Azure Key Vault or similar secure storage for pipeline secrets. Add monitoring for unauthorized crate publishing.
  2. Go Module Proxy Tagging

    • The Go module proxy automatically indexes based on git tags. If tags are pushed without proper validation, malicious or incorrect versions could be indexed.
    • Actionable Fix: Add pre-tagging validation in the pipeline to ensure tags match semver and module path requirements.
  3. Audit Log Tampering

    • The Go audit log tests reveal that tampering with fields like PreviousHash, AgentID, or Decision invalidates the chain. However, there is no runtime mechanism to detect tampering outside of tests.
    • Actionable Fix: Implement runtime tamper detection and logging for audit chains. Consider cryptographic signatures for entries to ensure integrity.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Target Changes

    • Adding rust and go to the target parameter in pipelines/esrp-publish.yml changes the behavior of the pipeline. Existing users relying on all may experience unexpected behavior if Rust or Go stages fail.
    • Actionable Fix: Document these changes clearly in the release notes and ensure backward compatibility by allowing selective inclusion/exclusion of new targets.
  2. Go Module Tag Format

    • The requirement for tags to include the module path (e.g., packages/agent-mesh/sdks/go/v0.1.0) may break existing workflows if contributors are unaware of the new format.
    • Actionable Fix: Add validation and error messages in the pipeline to enforce the new tag format.

💡 Suggestions for Improvement

  1. Thread Safety in Audit Logger

    • The AuditLogger implementation in Go does not appear to be thread-safe. Concurrent logging or verification could lead to race conditions.
    • Actionable Fix: Use synchronization primitives like sync.Mutex or sync.RWMutex to ensure thread safety for Log and Verify methods.
  2. OWASP Agentic Top 10 Compliance

    • The pull request does not address OWASP Agentic Top 10 concerns, such as secure agent communication and trust management.
    • Actionable Fix: Add tests for SPIFFE/SVID-based identity verification and secure communication protocols for agents.
  3. Type Safety in Go SDK

    • The Go SDK lacks type safety for critical fields like AgentID, Action, and Decision. These are defined as string, which could lead to runtime errors.
    • Actionable Fix: Use custom types or enums for these fields to enforce stricter type checking.
  4. Backward Compatibility

    • The addition of new pipeline stages and publishing mechanisms may impact existing workflows.
    • Actionable Fix: Provide clear migration guides and ensure that existing targets (pypi, npm, nuget) remain unaffected.
  5. Documentation Enhancements

    • The updated PUBLISHING.md is comprehensive but could benefit from additional examples for Rust and Go publishing workflows.
    • Actionable Fix: Add example commands for setting up the CRATES_IO_TOKEN and creating valid Go module tags.
  6. Testing Coverage

    • The new Go tests for the audit logger and client are thorough, but additional tests for edge cases (e.g., invalid timestamps, malformed entries) would improve robustness.
    • Actionable Fix: Add tests for invalid input scenarios and edge cases in both audit_test.go and client_test.go.

Summary

This pull request introduces valuable enhancements to the publishing pipeline, enabling support for Rust and Go SDKs. However, it introduces critical security risks and potential breaking changes that must be addressed before merging. Additionally, there are opportunities to improve thread safety, type safety, and documentation.

Recommended Actions Before Merge:

  1. Secure CRATES_IO_TOKEN storage and implement monitoring.
  2. Add pre-tagging validation for Go module proxy indexing.
  3. Implement runtime tamper detection for audit logs.
  4. Document pipeline changes and provide migration guides.
  5. Enhance thread safety in the Go audit logger.
  6. Improve type safety in the Go SDK.

Recommended Actions Post-Merge:

  1. Expand test coverage for edge cases.
  2. Monitor the new pipeline stages for stability and compliance.

Let me know if you need further clarification or assistance!

Copy link
Copy Markdown

@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 Agent: code-reviewer

Feedback on Pull Request: feat: add Rust (crates.io) and Go module publishing stages


🔴 CRITICAL: Security Concerns

  1. Rust Crate Publishing (cargo publish)

    • The pipeline uses a CRATES_IO_TOKEN stored in ADO pipeline variables. Ensure that this token is scoped to the specific crate (agentmesh) and does not have broader permissions. Misuse or leakage of this token could allow unauthorized publishing or tampering with other crates owned by the account.
    • Action: Rotate the token regularly and ensure it is stored securely. Consider implementing additional monitoring for token usage.
  2. Go Module Proxy (proxy.golang.org)

    • Publishing via git tags is inherently less secure than direct registry uploads. Ensure that the pipeline verifies the integrity of the repository and tags before pushing them. A malicious actor could potentially inject unauthorized tags into the repository.
    • Action: Add a step to verify the integrity of the repository (e.g., using git fsck or similar) and validate the tag format before pushing.
  3. Audit Logger Tampering Tests

    • The AuditLogger tests reveal that the system correctly detects tampering with hashes, agent IDs, and decisions. However, there is no explicit test for timestamp tampering.
    • Action: Add a test case to verify that tampering with the Timestamp field invalidates the audit chain. This ensures the integrity of temporal data in the audit log.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Target Changes

    • Adding rust and go to the target parameter in the ESRP pipeline may affect existing workflows that rely on the all target. If any downstream systems or teams are using the all target, they may inadvertently trigger Rust and Go publishing stages.
    • Action: Communicate these changes to all stakeholders and update documentation to reflect the expanded scope of the all target.
  2. Go Module Tagging Format

    • The requirement for tags to include the module path (e.g., packages/agent-mesh/sdks/go/v0.1.0) may conflict with existing tagging conventions. This could break compatibility with tools or scripts that assume simpler tag formats.
    • Action: Ensure all teams using this repository are aware of the new tagging format and update any dependent tooling.

💡 Suggestions for Improvement

  1. Thread Safety in Audit Logger

    • The AuditLogger implementation does not appear to handle concurrent access. If multiple agents log actions simultaneously, race conditions could corrupt the audit chain.
    • Action: Use synchronization primitives (e.g., mutexes) to ensure thread-safe access to the entries list.
  2. OWASP Agentic Top 10 Compliance

    • The AuditLogger and TrustConfig implementations should be reviewed for compliance with OWASP Agentic Top 10 guidelines, particularly around data integrity and trust management.
    • Action: Conduct a thorough review of the codebase against OWASP Agentic Top 10, focusing on areas like cryptographic operations, identity management, and sandboxing.
  3. Type Safety and Validation

    • Ensure that all inputs to AuditLogger and TrustConfig are validated. For example, AgentID, Action, and Decision should be checked for invalid or malicious values.
    • Action: Use Pydantic models or equivalent validation mechanisms for input validation.
  4. Backward Compatibility

    • The addition of Rust and Go SDKs introduces new dependencies and potential changes to the repository structure. Ensure that existing Python, npm, and .NET workflows are unaffected.
    • Action: Run integration tests for all existing packages to verify that the changes do not introduce regressions.
  5. Documentation Updates

    • The PUBLISHING.md file has been updated, but it is lengthy and could benefit from a table of contents for easier navigation.
    • Action: Add a table of contents to the top of the PUBLISHING.md file for better usability.
  6. Go SDK Tests

    • The new Go tests are comprehensive, but the TestNewClientWithAllOptions function is incomplete and appears to be truncated. Ensure that all tests are complete and functional.
    • Action: Complete the implementation of TestNewClientWithAllOptions and verify its correctness.
  7. Dry Run Mode

    • The dryRun mode is a useful addition to the pipeline. However, ensure that it is properly documented and tested to avoid accidental publishing during testing.
    • Action: Add explicit tests for the dryRun mode in the pipeline to confirm that it does not perform actual publishing.
  8. Cryptographic Operations

    • The computeHash function used in the AuditLogger tests should be reviewed to ensure it uses a secure hashing algorithm (e.g., SHA-256) and is resistant to collision attacks.
    • Action: Confirm the hashing algorithm used and document its security properties.

Summary

This pull request introduces valuable functionality for Rust and Go SDK publishing but raises critical security concerns around token management and repository integrity. Additionally, there are potential breaking changes related to pipeline targets and Go module tagging. Addressing these issues and implementing the suggested improvements will enhance the security, reliability, and maintainability of the repository.

@imran-siddique imran-siddique enabled auto-merge (squash) March 30, 2026 00:36
@imran-siddique imran-siddique force-pushed the feat/rust-go-publishing branch from ace3553 to fa27e89 Compare March 30, 2026 01:43
@github-actions github-actions bot added the ci/cd CI/CD and workflows label Mar 30, 2026
Copy link
Copy Markdown

@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 Agent: code-reviewer

Pull Request Review: feat: add Rust (crates.io) and Go module publishing stages


🔴 CRITICAL: Security Issues

  1. Rust Crate Publishing Token Exposure

    • The CRATES_IO_TOKEN is used for publishing Rust crates. Ensure that this token is stored securely in Azure DevOps pipeline variables and is not exposed in logs or error messages during pipeline execution.
    • Action: Add explicit logging suppression for sensitive variables in the pipeline configuration.
  2. Go Module Proxy Indexing

    • The Go module publishing relies on pushing git tags for proxy indexing. Ensure that the pipeline validates the integrity of the tags and prevents unauthorized or accidental tagging.
    • Action: Implement a pre-publish validation step in the pipeline to verify the module's integrity and ensure that the tag follows the correct format.
  3. Audit Logger Tampering

    • The AuditLogger implementation in the Go SDK does not prevent direct manipulation of the entries array, allowing tampering with audit logs.
    • Action: Make the entries field private and provide controlled access through methods. This ensures that tampering cannot occur outside the AuditLogger class.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Target Parameter

    • The addition of rust and go to the target parameter in the ESRP pipeline may affect existing workflows if they rely on the previous set of targets.
    • Action: Document this change clearly in the release notes and ensure backward compatibility by defaulting to the previous behavior if no target is specified.
  2. Go Module Tagging Format

    • The requirement for specific tag formats (packages/agent-mesh/sdks/go/v0.1.0) may break existing workflows that use simpler tag formats.
    • Action: Provide clear documentation and validation for the tag format in the pipeline to avoid confusion and errors.

💡 Suggestions for Improvement

  1. Pipeline Dry Run Enhancements

    • The dryRun mode is a great addition, but it would be beneficial to include a detailed summary of what actions would have been performed during the dry run (e.g., files to be published, registry targets, etc.).
    • Action: Enhance the dryRun output to include detailed information about the artifacts and their destinations.
  2. Audit Logger Tests

    • The new tests for AuditLogger are comprehensive, but consider adding tests for edge cases such as:
      • Logging entries with invalid or empty fields (e.g., empty AgentID, Action, or Decision).
      • Handling large numbers of entries (e.g., 10,000+ entries) to test performance and memory usage.
    • Action: Add edge case tests to ensure robustness.
  3. Pipeline Documentation

    • The updated PUBLISHING.md is thorough but could benefit from a visual diagram showing the pipeline stages and their dependencies.
    • Action: Add a pipeline flow diagram to the documentation for better clarity.
  4. Go Module Race Condition

    • The Go test command includes the -race flag, which is excellent for detecting race conditions. However, ensure that the pipeline fails if race conditions are detected.
    • Action: Explicitly check the exit code of the go test -race command and fail the pipeline if any race conditions are found.
  5. Dockerfile Best Practices

    • The Dockerfile section mentions best practices but does not enforce them in the pipeline.
    • Action: Add a linting step for Dockerfiles in the CI pipeline to ensure compliance with best practices.
  6. Backward Compatibility

    • The addition of Rust and Go stages is a significant change. Ensure that the pipeline is tested thoroughly for backward compatibility with existing Python, npm, and .NET publishing workflows.
    • Action: Run regression tests for all existing targets (pypi, npm, nuget) to confirm no unintended side effects.

General Observations

  • The new tests for the Go SDK's AuditLogger are comprehensive and cover a wide range of scenarios, including tampering and filtering. This is a positive step toward ensuring the correctness of the audit logging mechanism.
  • The pipeline changes are well-documented, but the addition of Rust and Go stages introduces complexity. Consider modularizing the pipeline further to isolate language-specific stages.

Summary

  • Security: Address token exposure and audit log tampering.
  • Breaking Changes: Document and test changes to pipeline targets and Go module tagging.
  • Suggestions: Enhance testing, documentation, and pipeline robustness.

This PR introduces valuable features but requires additional safeguards to ensure security, backward compatibility, and robustness.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@imran-siddique imran-siddique force-pushed the feat/rust-go-publishing branch from fa27e89 to 236defa Compare March 30, 2026 01:56
Copy link
Copy Markdown

@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 Agent: code-reviewer

Feedback on Pull Request: feat: add Rust (crates.io) and Go module publishing stages


🔴 CRITICAL: Security Issues

  1. Rust Crates.io Token Handling

    • The CRATES_IO_TOKEN is stored as a secret pipeline variable, but there is no mention of how this token is rotated or audited. Tokens for publishing should have limited scopes and be rotated regularly to prevent misuse.
    • Action: Implement token rotation and auditing mechanisms. Add documentation on how to revoke and regenerate the token securely.
  2. Go Module Proxy Indexing

    • The Go module proxy automatically indexes modules based on git tags. However, there is no validation of the tags before they are pushed. Malicious tags could lead to unintended module versions being indexed.
    • Action: Add a pre-push validation step in the pipeline to ensure tags conform to expected semver and module path formats.
  3. Audit Logger Tampering Detection

    • The AuditLogger tests show that tampering with fields like PreviousHash, AgentID, or Decision invalidates the chain. However, there is no runtime mechanism to detect and alert on tampering attempts.
    • Action: Implement runtime tampering detection and logging. For example, log an alert if Verify() fails due to tampering.

🟡 WARNING: Potential Breaking Changes

  1. Pipeline Target Parameter

    • Adding rust and go to the target parameter in the ESRP pipeline changes the behavior of the pipeline. Existing users of the pipeline may encounter unexpected behavior if they are not aware of these new targets.
    • Action: Clearly document the new target options in the pipeline configuration and communicate this change to users.
  2. Go Module Tag Format

    • The tag format for Go modules (packages/agent-mesh/sdks/go/v0.1.0) is unconventional and may confuse developers who expect simpler tags like v0.1.0.
    • Action: Consider aligning the tag format with standard Go module practices or provide clear documentation on the rationale for the chosen format.

💡 Suggestions for Improvement

  1. Thread Safety in Audit Logger

    • The AuditLogger does not appear to be thread-safe. Concurrent logging or verification could lead to race conditions.
    • Action: Use synchronization primitives (e.g., sync.Mutex in Go) to ensure thread safety during logging and verification.
  2. OWASP Agentic Top 10 Compliance

    • The pipeline changes do not address OWASP Agentic Top 10 concerns such as secure agent communication or identity verification.
    • Action: Add tests and validations for secure communication (e.g., TLS enforcement) and identity verification (e.g., SPIFFE/SVID compliance).
  3. Type Safety in Go SDK

    • The Go SDK does not use strong type validation for audit log entries. For example, AgentID, Action, and Decision are plain strings.
    • Action: Use custom types or enums for these fields to enforce stricter validation.
  4. Backward Compatibility

    • The AuditLogger changes introduce new methods like GetEntries with filtering capabilities. Ensure these changes do not break existing code that uses the logger.
    • Action: Add deprecation warnings or migration guides for any changes that might impact existing users.
  5. Documentation Improvements

    • The PUBLISHING.md file is comprehensive but could benefit from a clear table of contents for easier navigation.
    • Action: Add a table of contents at the beginning of the document.
  6. Test Coverage

    • The new tests for AuditLogger are thorough, but they do not cover edge cases like extremely large chains or invalid timestamps.
    • Action: Add tests for edge cases, such as chains with thousands of entries or entries with invalid timestamps.

Summary of Actions

  • 🔴 Address critical security issues with token handling, tag validation, and tampering detection.
  • 🟡 Mitigate potential breaking changes by documenting pipeline updates and tag formats.
  • 💡 Improve thread safety, type safety, OWASP compliance, and test coverage.

This pull request introduces valuable features but requires additional security and compatibility measures to ensure robustness and reliability.

Copy link
Copy Markdown

@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 Agent: code-reviewer

Pull Request Review: feat: add Rust (crates.io) and Go module publishing stages


🔴 CRITICAL: Security Concerns

  1. Lack of validation for CRATES_IO_TOKEN:

    • The CRATES_IO_TOKEN is used for publishing Rust crates. Ensure that the token is securely stored and rotated periodically. Additionally, validate that the token has the correct permissions and is scoped to the intended crates.io account.
    • Action: Add a check in the pipeline to verify the token's validity before proceeding with the cargo publish step.
  2. Go module tagging vulnerability:

    • The Go module publishing relies on Git tags for indexing by proxy.golang.org. Ensure that the tags are created and pushed securely to prevent unauthorized or malicious tags.
    • Action: Implement a mechanism to verify the integrity of the tags before pushing them to the repository. Consider using signed tags (git tag -s) for additional security.
  3. Audit log tampering detection:

    • The AuditLogger implementation in the Go SDK has been extended with comprehensive tests, which is good. However, the Verify() method should include additional checks for hash collisions and other potential tampering vectors.
    • Action: Enhance the Verify() method to include checks for hash collisions and ensure that the hash computation algorithm is cryptographically secure (e.g., SHA-256 or SHA-3).

🟡 WARNING: Potential Breaking Changes

  1. Pipeline parameter changes:

    • Adding rust and go to the target parameter in the ESRP pipeline may affect backward compatibility if existing scripts or workflows depend on the previous set of targets.
    • Action: Clearly document these changes in the release notes and ensure that all dependent teams are notified.
  2. Go module tagging format:

    • The Go module tagging format (packages/agent-mesh/sdks/go/v0.1.0) is non-standard and may cause confusion for developers unfamiliar with this convention.
    • Action: Provide clear documentation and examples for this tagging format in the PUBLISHING.md file.

💡 Suggestions for Improvement

  1. Thread safety in AuditLogger:

    • The AuditLogger implementation does not appear to be thread-safe. If multiple agents are logging actions concurrently, race conditions could corrupt the audit log.
    • Action: Use synchronization primitives (e.g., sync.Mutex) to ensure thread safety in the Log() and Verify() methods.
  2. OWASP Agentic Top 10 compliance:

    • The AuditLogger should include mechanisms to detect and mitigate replay attacks, such as timestamp validation or sequence numbers.
    • Action: Add logic to ensure that timestamps are strictly increasing and validate the integrity of the audit log against replay attacks.
  3. Type safety in Go SDK:

    • The Go SDK does not appear to use strong type validation for critical fields like AgentID, Action, and Decision. This could lead to unexpected behavior or security vulnerabilities.
    • Action: Use custom types or validation functions to enforce constraints on these fields.
  4. Documentation clarity:

    • The PUBLISHING.md file is comprehensive but could benefit from clearer organization and formatting. For example, the "Policy" sections could be consolidated into a single section at the top, with links to specific registry requirements.
    • Action: Reorganize the documentation to improve readability and navigation.
  5. Testing coverage:

    • The Go SDK tests are thorough but could include additional edge cases, such as:
      • Logging actions with invalid or empty fields.
      • Verifying behavior when the audit log exceeds a certain size.
    • Action: Add tests for edge cases and stress testing.
  6. Backward compatibility for Python packages:

    • Ensure that changes to the ci.yml file do not inadvertently affect the existing Python package publishing process.
    • Action: Test the pipeline with all existing targets (pypi, npm, nuget) before merging.

Summary of Actions

  • 🔴 Critical: Secure CRATES_IO_TOKEN and Go module tagging.
  • 🟡 Warning: Document pipeline parameter changes and Go module tagging format.
  • 💡 Suggestions: Improve thread safety, OWASP compliance, type safety, documentation, and testing coverage.

This pull request introduces valuable enhancements to the publishing pipeline but requires additional security and compatibility measures before merging.

@imran-siddique imran-siddique disabled auto-merge March 30, 2026 04:11
@imran-siddique imran-siddique merged commit ed381d1 into microsoft:main Mar 30, 2026
53 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-mesh agent-mesh package ci/cd CI/CD and workflows documentation Improvements or additions to documentation size/L Large PR (< 500 lines) size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant