Enforce managed authentication backend settings (#39043)

## What changed

- Add `cli_auth_credentials_store` and `chatgpt_base_url` as exact managed requirements loaded from local requirements configuration.
- Apply these requirements to runtime and bootstrap authentication configuration, overriding user-configured values.
- Expose the managed values through `configRequirements/read` and reject attempts to change them through config write APIs.
- Ignore these local-only authentication requirements in cloud-managed requirement layers.

## Testing

- Cover requirement loading and composition, runtime and bootstrap overrides, app-server responses, and read-only config writes.

GitOrigin-RevId: 8ea9c096386072036ca5441f3d48af8707988a65
This commit is contained in:
Abhinav authored and copyberry committed 2026-08-17 18:35:54 +00:00
1 parent d0fd4e830a
commit 0f21cb3413
24 files changed
+458 -22

No files matched your search

+48
View File
@@ -192,6 +192,54 @@ model_provider = "system-provider"
);
}
#[tokio::test]
async fn ignoring_login_requirements_preserves_local_auth_backend_requirements() {
let tmp = tempdir().expect("tempdir");
let requirements_path = tmp.path().join("requirements.toml");
std::fs::write(
&requirements_path,
r#"allowed_login_methods = ["chatgpt"]
allowed_chatgpt_workspaces = ["managed-workspace"]
cli_auth_credentials_store = "keyring"
chatgpt_base_url = "https://managed.example/backend-api/"
"#,
)
.expect("write local authentication requirements");
let mut overrides = LoaderOverrides::without_managed_config_for_tests();
overrides.system_requirements_path = Some(requirements_path);
overrides.ignore_login_requirements = true;
let stack = load_config_layers_state(
&TestFileSystem,
tmp.path(),
/*cwd*/ None,
&[],
overrides,
&crate::NoopThreadConfigLoader,
)
.await
.expect("load configuration with remote login exemptions");
let requirements = stack.requirements();
assert_eq!(requirements.allowed_login_methods, None);
assert_eq!(requirements.allowed_chatgpt_workspaces, None);
assert_eq!(
requirements
.cli_auth_credentials_store
.as_ref()
.map(|required| required.value),
Some(crate::types::AuthCredentialsStoreMode::Keyring)
);
assert_eq!(
requirements
.chatgpt_base_url
.as_ref()
.map(|required| required.value.as_str()),
Some("https://managed.example/backend-api/")
);
}
#[tokio::test]
async fn missing_packaged_defaults_file_returns_an_error() {
let tmp = tempdir().expect("tempdir");