-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(reborn-ironhub): deep-link register/install gateway + private manifest source #5409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
neo-sky
wants to merge
8
commits into
nearai:codex/ironhub-reborn-port
from
neo-sky:feat/private-manifest-source
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1accc2a
feat(ironhub): install from a private org-scoped manifest source
neo-sky e125294
fix: migrate extension fixtures to capability_provider/v1 host_api
neo-sky 3ae8980
feat(ironhub): add private provenance tier for org-scoped artifacts
neo-sky fde1dcb
feat(ironhub): allow private artifacts from the configured catalog host
neo-sky f6c318f
feat(reborn): port IronHub deep-link register/install gateway
neo-sky acbd10d
Guard private-manifest replays; address review cleanups
neo-sky d011d2c
feat(reborn-ironhub): thread caller through install, cover link paths
neo-sky 26d603a
Harden the ironhub deep-link install signature and trust boundary
neo-sky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
crates/ironclaw_product_workflow/src/reborn_services/ironhub_link.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| use async_trait::async_trait; | ||
| use ironclaw_host_api::UserId; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| use super::error::{RebornServicesError, RebornServicesErrorCode}; | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Eq, Deserialize)] | ||
| pub struct IronhubRegisterRequest { | ||
| pub uid: String, | ||
| pub aid: String, | ||
| pub ts: u64, | ||
| pub nonce: String, | ||
| pub sig: String, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Eq, Deserialize)] | ||
| pub struct IronhubInstallDeliveryRequest { | ||
| pub slug: String, | ||
| pub version: String, | ||
| pub uid: String, | ||
| pub aid: String, | ||
| pub ts: u64, | ||
| pub nonce: String, | ||
| pub artifact_digest: String, | ||
| pub sig: String, | ||
| #[serde(default)] | ||
| pub private_manifest_url: Option<String>, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Eq, Serialize)] | ||
| pub struct IronhubInstallDeliveryResult { | ||
| pub installed: bool, | ||
| pub slug: String, | ||
| pub message: String, | ||
| } | ||
|
|
||
| #[derive(Debug, thiserror::Error)] | ||
| pub enum IronhubLinkError { | ||
| #[error("invalid agent-link signature")] | ||
| InvalidSignature, | ||
| #[error("agent-link timestamp outside the accepted window")] | ||
| StaleTimestamp, | ||
| #[error("agent-link request replayed")] | ||
| Replay, | ||
| #[error("ironhub install failed: {reason}")] | ||
| Install { reason: String }, | ||
| #[error("invalid ironhub install request: {reason}")] | ||
| InvalidInput { reason: String }, | ||
| #[error("ironhub link service is unavailable")] | ||
| Unavailable, | ||
| } | ||
|
|
||
| #[async_trait] | ||
| pub trait IronhubLinkService: Send + Sync { | ||
| async fn register(&self, request: IronhubRegisterRequest) -> Result<(), IronhubLinkError>; | ||
|
|
||
| async fn deliver_install( | ||
| &self, | ||
| user_id: UserId, | ||
| request: IronhubInstallDeliveryRequest, | ||
| ) -> Result<IronhubInstallDeliveryResult, IronhubLinkError>; | ||
| } | ||
|
|
||
| pub(super) fn ironhub_link_unavailable() -> RebornServicesError { | ||
| RebornServicesError::service_unavailable(false) | ||
| } | ||
|
|
||
| pub(super) fn map_ironhub_link_error(error: IronhubLinkError) -> RebornServicesError { | ||
| match error { | ||
| IronhubLinkError::InvalidSignature | ||
| | IronhubLinkError::StaleTimestamp | ||
| | IronhubLinkError::Replay => { | ||
| RebornServicesError::from_status(RebornServicesErrorCode::Forbidden, 403, false) | ||
| } | ||
| IronhubLinkError::Install { .. } => RebornServicesError::internal_invariant(), | ||
| IronhubLinkError::InvalidInput { .. } => { | ||
| RebornServicesError::from_status(RebornServicesErrorCode::InvalidRequest, 400, false) | ||
| } | ||
| IronhubLinkError::Unavailable => RebornServicesError::service_unavailable(false), | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
Validate the signed install target against the authenticated caller.
This only forwards
caller.user_id, so the service never sees the authenticated identity that the signeduid/aidpayload is meant to bind. A captured install payload can therefore be consumed by a different authenticated caller before the nonce is spent, which is especially risky for private-manifest installs. Pass the full caller context (or explicit expectedUserId/AgentId) intoIronhubLinkService::deliver_installand reject mismatches before install. As per coding guidelines, "Fail closed for auth..." and "Preserve tenant/user/agent/project/mission/thread scope..."🤖 Prompt for AI Agents
Source: Coding guidelines