Rimossi i provider integrati OpenAI, Bedrock e GCP e ogni fallback a OpenAI (B)

Parte "sicurezza" della fase 3 di aKode (e39aae00), senza le funzioni di imeAI:

- via i provider integrati openai, amazon-bedrock, amazon-bedrock-runtime e gcp
  (crate model-provider: moduli amazon_bedrock, gcp, chatgpt_base_url; login Bedrock;
  onboarding Bedrock/GCP; richieste app-server di setup cloud);
- nessun URL predefinito verso api.openai.com / chatgpt.com: un provider senza
  base_url non viene mai contattato; senza model_provider configurato exec e TUI
  mostrano come scriverne uno in config.toml (NO_MODEL_PROVIDER_CONFIGURED_ERROR);
- via la skill openai-docs, la sample skill-installer (scaricava da github.com/openai/skills),
  request_plugin_install, AppsInstructions, URL predefiniti di realtime e updater;
- test di sicurezza adattati (provider "mock" al posto di quello integrato), non cancellati.

Restano fuori da questo commit (categoria F/D/E, non portate): chiave per provider nel
portachiavi, modelli da /models, unione dei messaggi di sistema, crate web-tools e
SearXNG, header @@ in apply_patch, modello ausiliario, tool function per apply_patch.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-17 12:31:29 +01:00
parent 22a79feba1
commit 2f8b6a3e16
481 changed files with 4319 additions and 25142 deletions

View File

@@ -71,10 +71,10 @@ const RESTART_RETRY_INTERVAL: Duration = Duration::from_millis(50);
// envelope, and the worst-case six-byte JSON escape for every captured byte.
const INSTALLER_STDERR_TAIL_BYTES: usize = 2 * 1024;
const INSTALLER_STDERR_DRAIN_TIMEOUT: Duration = Duration::from_secs(1);
#[cfg(unix)]
const INSTALL_URL: &str = "https://chatgpt.com/codex/install.sh";
#[cfg(windows)]
const INSTALL_URL: &str = "https://chatgpt.com/codex/install.ps1";
/// aKode has no hosted update source: the upstream installer lived on chatgpt.com and is
/// never contacted. Updates are installed by re-running aKode's own installer.
const NO_UPDATE_SOURCE_ERROR: &str =
"aKode has no automatic update source; reinstall from the aKode release to update";
pub(crate) async fn run(
http_client_factory: HttpClientFactory,
@@ -747,7 +747,10 @@ async fn cancel_installer(child: &mut tokio::process::Child, package_root: &Path
}
async fn fetch_installer_script(http: &impl InstallerHttp) -> Result<Vec<u8>> {
match http.get(INSTALL_URL).await? {
let Some(url) = http.installer_url() else {
anyhow::bail!(NO_UPDATE_SOURCE_ERROR);
};
match http.get(url).await? {
InstallerResponse::Success(body) => Ok(body),
InstallerResponse::Unsuccessful { status } => {
anyhow::bail!("standalone Codex updater request failed with status {status}")
@@ -766,6 +769,11 @@ enum InstallerResponse {
/// Implementations must issue a GET for the supplied URL, return exact response bytes for a
/// successful status, and report a non-success status without buffering its response body.
trait InstallerHttp: Send + Sync {
/// Installer script URL. Production has none, so nothing is ever downloaded.
fn installer_url(&self) -> Option<&str> {
None
}
fn get<'a>(
&'a self,
url: &'a str,

View File

@@ -6,9 +6,9 @@ use pretty_assertions::assert_eq;
#[cfg(unix)]
use tempfile::TempDir;
use super::INSTALL_URL;
use super::InstallerHttp;
use super::InstallerResponse;
use super::NO_UPDATE_SOURCE_ERROR;
use super::fetch_installer_script;
#[cfg(unix)]
use super::manual_update::run as manual_update_once;
@@ -25,6 +25,28 @@ use crate::managed_install::executable_identity;
#[cfg(unix)]
use crate::managed_install::executable_identity_from_reader;
const INSTALL_URL: &str = "https://updates.invalid/install.sh";
#[tokio::test]
async fn production_installer_source_is_absent_and_nothing_is_requested() {
struct NoSource(Mutex<Vec<String>>);
impl InstallerHttp for NoSource {
async fn get(&self, url: &str) -> anyhow::Result<InstallerResponse> {
self.0
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
.push(url.to_string());
Ok(InstallerResponse::Success(Vec::new()))
}
}
let http = NoSource(Mutex::new(Vec::new()));
let error = fetch_installer_script(&http)
.await
.expect_err("no update source is configured");
assert_eq!(error.to_string(), NO_UPDATE_SOURCE_ERROR);
assert!(http.0.lock().unwrap().is_empty());
}
#[tokio::test]
async fn installer_fetch_uses_exact_url_and_preserves_bytes() {
let script = b"#!/bin/sh\nprintf 'update bytes'\n".to_vec();
@@ -363,6 +385,10 @@ impl FakeInstallerHttp {
}
impl InstallerHttp for FakeInstallerHttp {
fn installer_url(&self) -> Option<&str> {
Some(INSTALL_URL)
}
async fn get(&self, url: &str) -> anyhow::Result<InstallerResponse> {
self.requested_urls
.lock()
@@ -1262,6 +1288,10 @@ async fn installer_failure_preserves_stderr_before_drain_timeout() {
async fn update_rejects_a_package_root_change_during_download() {
struct ChangingRoot<'a>(&'a std::path::Path);
impl InstallerHttp for ChangingRoot<'_> {
fn installer_url(&self) -> Option<&str> {
Some(INSTALL_URL)
}
async fn get(&self, _url: &str) -> anyhow::Result<InstallerResponse> {
std::os::unix::fs::symlink(
self.0.join("packages/standalone"),