[codex] Add Aliyun API permission audit#133
Merged
Merged
Conversation
4439a05 to
e22b3ad
Compare
e22b3ad to
4fe6a5d
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds explicit permission management for the generic
aliyun_apitool and records permission decisions to a local audit log. The core behavior now separates read-only Alibaba Cloud API calls from calls that may modify cloud resources, and protected write APIs require deliberate authorization instead of being covered by a bare tool allow rule.It also updates the public website documentation and all current website locales (
de,es,fr,ja,pt,zh-Hans) so users can see the new permission and audit behavior in published docs.Feature Details
Aliyun API read/write permission model
aliyun_apinow classifies API calls as read-only or non-read-only before execution.aliyun_api(ros:CreateStack).aliyun_apiallow rule no longer blanket-approves Alibaba Cloud write APIs.bypass_permissionsnow matches the broader tool bypass behavior foraliyun_api: it auto-approves protected Alibaba Cloud write APIs, while still requiring each protected write approval to be persisted to the permission audit log before execution.product:actionpair.GETand there is no request body.Permission audit log
<log-dir>/permission-audit.jsonl.<log-dir>resolves to~/.iac-code/logs/, unless overridden withIAC_CODE_LOG_DIR.permissions.audit:include_tool_input: include redacted tool input in audit records.max_file_bytes: rotate the audit log at the configured size.max_files: keep a bounded number of rotated audit files.IAC_CODE_PERMISSION_AUDIT_INCLUDE_TOOL_INPUTas an environment override for including redacted tool input.Runtime coverage
The new permission and audit behavior is wired through:
AgentToolpermission execution pathsA2A and ACP behavior
aliyun_apiand preserve redacted decision-critical input for other tools.aliyun_apiinput summaries.auto-approve-permissionsrecords permission decisions to the audit log.auto-approve-permissionsis enabled; use exactaliyun_api(product:action)allow rules or a resolver decision for trusted automation.persistence_failureaudit decisions.Documentation and i18n
permissions.audit, audit log location, rotation settings, and thealiyun_api(product:action)rule syntax.bypass_permissionsauto-approves protected Alibaba Cloud write APIs only when the approval audit record is successfully persisted, while a barealiyun_apiallow rule still does not blanket-approve writes.User Impact
Users get a safer default for direct Alibaba Cloud API calls: read-only inspection remains smooth, while resource-changing API calls require deliberate authorization or an explicit trusted bypass mode. Teams also get a durable local audit trail for permission decisions, which helps explain who approved what and why when automation or interactive sessions perform sensitive cloud operations.
Validation
uv run pytest tests/services/permissions/test_pipeline.py::TestPipeline::test_aliyun_api_bypass_mode_allows_write_with_audit tests/services/permissions/test_pipeline.py::TestPipeline::test_aliyun_api_bypass_mode_preserves_explicit_write_rule_audit tests/agent/test_permission_audit_integration.py::test_agent_loop_aliyun_bypass_mode_allows_write_with_audit tests/agent/test_permission_audit_integration.py::test_agent_loop_aliyun_bypass_mode_denies_write_when_audit_fails -q— 4 passeduv run pytest tests/services/permissions/test_pipeline.py tests/agent/test_permission_audit_integration.py tests/cli/test_headless_permission_audit.py tests/a2a/test_permission_audit.py tests/a2a/test_pipeline_stream.py::test_publish_direct_auto_approve_denies_untrusted_aliyun_write -q— 69 passeduv run pytest tests/acp/test_permission_audit.py tests/acp/test_permission_rules.py -q— 26 passedmake test— 7183 passed, 268 warningsmake lint— ruff and ty checks passedcd website && npm test— 6 passedcd website && npm run typecheck— TypeScript check passedcd website && npm run build— Docusaurus build passed foren,zh-Hans,ja,fr,de,es, andptgit diff --check— passed