Files
cleveragents-core/robot/security_audit.robot
HAL9000 e6878c2c30
CI / coverage (push) Blocked by required conditions
CI / docker (push) Blocked by required conditions
CI / push-validation (push) Waiting to run
CI / status-check (push) Blocked by required conditions
CI / benchmark-publish (push) Waiting to run
CI / lint (push) Successful in 45s
CI / typecheck (push) Successful in 1m11s
CI / unit_tests (push) Has started running
CI / integration_tests (push) Has started running
CI / quality (push) Successful in 1m5s
CI / security (push) Successful in 1m12s
CI / e2e_tests (push) Has started running
CI / build (push) Has started running
CI / helm (push) Has started running
fix(audit): protect AuditService._ensure_session() with threading.Lock
2026-05-02 21:54:17 +00:00

96 lines
3.9 KiB
Plaintext

*** Settings ***
Documentation SEC7 - Audit logging integration smoke tests
Library OperatingSystem
Library Process
*** Variables ***
${AUDIT_SERVICE} ${CURDIR}/../src/cleveragents/application/services/audit_service.py
${AUDIT_CLI} ${CURDIR}/../src/cleveragents/cli/commands/audit.py
${AUDIT_MODEL} ${CURDIR}/../src/cleveragents/infrastructure/database/models.py
${AUDIT_DOC} ${CURDIR}/../docs/reference/audit_logging.md
*** Test Cases ***
Audit Service Module Exists
[Documentation] Verify the audit service module is present
File Should Exist ${AUDIT_SERVICE}
Audit CLI Module Exists
[Documentation] Verify the audit CLI module is present
File Should Exist ${AUDIT_CLI}
Audit Log Model Defined
[Documentation] Verify AuditLogModel is defined in models.py
${content}= Get File ${AUDIT_MODEL}
Should Contain ${content} class AuditLogModel
Should Contain ${content} audit_log
Should Contain ${content} event_type
Should Contain ${content} plan_id
Should Contain ${content} details
Should Contain ${content} created_at
Audit Service Has Record Method
[Documentation] Verify the audit service has a record method
${content}= Get File ${AUDIT_SERVICE}
Should Contain ${content} def record(
Should Contain ${content} event_type
Should Contain ${content} VALID_EVENT_TYPES
Audit Service Has List Method
[Documentation] Verify the audit service has a list_entries method
${content}= Get File ${AUDIT_SERVICE}
Should Contain ${content} def list_entries(
Should Contain ${content} plan_id
Should Contain ${content} project_name
Should Contain ${content} since
Audit Service Has Prune Method
[Documentation] Verify the audit service has a prune method
${content}= Get File ${AUDIT_SERVICE}
Should Contain ${content} def prune(
Should Contain ${content} retention_days
Audit Service Has Thread Safe Session Init
[Documentation] Verify _ensure_session() uses threading.Lock (bug #991 fix)
${content}= Get File ${AUDIT_SERVICE}
Should Contain ${content} import threading
Should Contain ${content} _session_lock
Should Contain ${content} threading.Lock()
Audit Service Has Close And Context Manager
[Documentation] Verify the audit service supports close() and context manager
${content}= Get File ${AUDIT_SERVICE}
Should Contain ${content} def close(
Should Contain ${content} def __enter__(
Should Contain ${content} def __exit__(
Audit CLI Has List Command
[Documentation] Verify the audit CLI has a list command
${content}= Get File ${AUDIT_CLI}
Should Contain ${content} name="list"
Should Contain ${content} --plan
Should Contain ${content} --project
Should Contain ${content} --since
Audit CLI Has Show Command
[Documentation] Verify the audit CLI has a show command
${content}= Get File ${AUDIT_CLI}
Should Contain ${content} name="show"
Should Contain ${content} audit_id
Audit CLI Has Prune Command
[Documentation] Verify the audit CLI has a prune command
${content}= Get File ${AUDIT_CLI}
Should Contain ${content} name="prune"
Should Contain ${content} --days
Should Contain ${content} --yes
Audit Documentation Exists
[Documentation] Verify the audit logging reference doc exists
File Should Exist ${AUDIT_DOC}
${content}= Get File ${AUDIT_DOC}
Should Contain ${content} Audit Logging
Should Contain ${content} agents audit list
Should Contain ${content} agents audit show
Should Contain ${content} agents audit prune
Should Contain ${content} audit_retention_days