open-code-review-toolkit 0.14.2__tar.gz → 0.14.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/PKG-INFO +9 -1
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/README.md +5 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/pyproject.toml +5 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/_version.py +2 -2
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/cli.py +26 -3
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/common/redaction.py +542 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/common/value_boundaries.py +109 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/code_text.py +53 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/__init__.py +28 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/admission.py +453 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/credentials.py +113 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/decoding.py +85 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/email.py +50 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/markup.py +275 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/numeric.py +260 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/context/dlp/presentation.py +89 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/diagrams/admission.py +19 -11
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/diagrams/contracts.py +8 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/diagrams/lifecycle.py +7 -2
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/diagrams/mcp.py +14 -9
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/diagrams/sources.py +94 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/__init__.py +1 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/__main__.py +8 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/cli.py +295 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/corpus.py +500 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/limits.py +36 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/report.py +66 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/scanner.py +474 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/state.py +262 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/dlp_audit/worker_process.py +135 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/opaque_code.py +50 -6
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/project.py +9 -8
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/repository.py +140 -12
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/evidence/source_syntax.py +333 -0
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/evidence/text_metadata.py +77 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/formatting.py +2 -2
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/workflow.py +2 -10
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/local.py +2 -2
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/diagram.py +9 -1
- open_code_review_toolkit-0.14.4/src/ocr_toolkit/reporting/diagram_layout.py +83 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/dlp.py +5 -2
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/outcome.py +2 -4
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/result_contract.py +11 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/review_runner.py +25 -3
- open_code_review_toolkit-0.14.2/src/ocr_toolkit/common/redaction.py +0 -337
- open_code_review_toolkit-0.14.2/src/ocr_toolkit/context/dlp.py +0 -535
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/.gitignore +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/LICENSE +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/common/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/common/filesystem.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/common/git.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/common/language.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/common/markdown.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/config_writer.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/configure.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/broker.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/ci_outcomes.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/contracts.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/mcp.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/policy.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/recognizers.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/context/store.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/diagrams/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/diagrams/collector.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/diagrams/persistence.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/__main__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/actions.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/artifacts.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/categorize.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/collect.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/collectors/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/collectors/graphs.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/collectors/orchestration.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/collectors/projections.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/collectors/registry.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/collectors/sources.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/coverage.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/ansible/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/ansible/requirements.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/ansible/topology.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/contracts.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/go.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/javascript.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/php.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/ecosystems/python.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/contracts.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/detection.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/providers/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/providers/frontend.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/providers/go.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/providers/php.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/providers/python.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/registry.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/schema.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/frameworks/templates.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/gitlink_projection.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/gitlinks.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/infrastructure.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/invocation.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/mcp.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/model.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/policy/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/policy/contracts.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/policy/decisions.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/policy/guidance.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/policy/registry.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/policy/schema.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/policy/scopes.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/review_context.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/review_range.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/store/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/store/atomic.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/store/contracts.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/store/core.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/store/readback.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/evidence/store/values.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/admission.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/contracts.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/gateway.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/registry.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/relay.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/runtime.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/federation/transport.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/local_chatgpt.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/mcp_config.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/ocr_result.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/__main__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/approval.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/comments.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/freshness.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/gitlab.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/gitlab_approval.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/markers.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/payloads.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/reconciliation.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/result.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/settings.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/snapshot.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/suggestions.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/posting/transaction.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/pre_execution.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/preflight.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/provider_config.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/provider_failure.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/gitlab.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/gitlab_ci.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/gitlab_context.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/gitlab_discussions.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/gitlab_identity.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/gitlab_remediation.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/providers/local_config.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/py.typed +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/__init__.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/federation.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/metadata.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/model.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/result.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/sections.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/text.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/reporting/usage.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/repository_coverage.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/result_usage.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/review_debug.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/review_identity.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/review_progress.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/review_range.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/review_receipt.py +0 -0
- {open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/review_trace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: open-code-review-toolkit
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.4
|
|
4
4
|
Summary: Unofficial GitLab CI integration layer for Open Code Review
|
|
5
5
|
Project-URL: Homepage, https://github.com/xeonvs/open-code-review-toolkit
|
|
6
6
|
Project-URL: Repository, https://github.com/xeonvs/open-code-review-toolkit
|
|
@@ -226,11 +226,14 @@ Classifier: Typing :: Typed
|
|
|
226
226
|
Requires-Python: <3.16,>=3.12
|
|
227
227
|
Requires-Dist: anyio<5,>=4.10.0
|
|
228
228
|
Requires-Dist: certifi<2027,>=2026.10.19
|
|
229
|
+
Requires-Dist: emoji<3,>=2.16.0
|
|
229
230
|
Requires-Dist: httpx2<3,>=2.13.0
|
|
230
231
|
Requires-Dist: jsonschema<5,>=4.26.0
|
|
231
232
|
Requires-Dist: mcp<3,>=2.2.0
|
|
233
|
+
Requires-Dist: mistune<3.5,>=3.4.0
|
|
232
234
|
Requires-Dist: opentelemetry-api<2,>=1.45.1
|
|
233
235
|
Requires-Dist: pyjwt<3,>=2.15.0
|
|
236
|
+
Requires-Dist: regex<2027,>=2026.9.29
|
|
234
237
|
Description-Content-Type: text/markdown
|
|
235
238
|
|
|
236
239
|
# Open Code Review Toolkit
|
|
@@ -312,6 +315,11 @@ failure behavior and optional private `--debug-dir` bundles.
|
|
|
312
315
|
Local reviews keep custom API providers as the default and can optionally use
|
|
313
316
|
[OCR's native ChatGPT authentication](docs/local.md#llm-authentication).
|
|
314
317
|
|
|
318
|
+
For offline DLP diagnosis of this or another project, use the local
|
|
319
|
+
[`ocr-ci dlp-audit` commands](docs/dlp-audit.md). They provide private reports,
|
|
320
|
+
exact classifications and baseline comparisons using the production scanner.
|
|
321
|
+
OCR and LLM configuration are unnecessary for these commands.
|
|
322
|
+
|
|
315
323
|
Optional [reasoning and progress controls](docs/configuration.md#provider-endpoint-and-completion-cap-contract)
|
|
316
324
|
do not change review rounds or budgets. Reasoning is unset by default; explicit
|
|
317
325
|
`none` is a wire value whose support depends on the provider/model. Progress is
|
|
@@ -77,6 +77,11 @@ failure behavior and optional private `--debug-dir` bundles.
|
|
|
77
77
|
Local reviews keep custom API providers as the default and can optionally use
|
|
78
78
|
[OCR's native ChatGPT authentication](docs/local.md#llm-authentication).
|
|
79
79
|
|
|
80
|
+
For offline DLP diagnosis of this or another project, use the local
|
|
81
|
+
[`ocr-ci dlp-audit` commands](docs/dlp-audit.md). They provide private reports,
|
|
82
|
+
exact classifications and baseline comparisons using the production scanner.
|
|
83
|
+
OCR and LLM configuration are unnecessary for these commands.
|
|
84
|
+
|
|
80
85
|
Optional [reasoning and progress controls](docs/configuration.md#provider-endpoint-and-completion-cap-contract)
|
|
81
86
|
do not change review rounds or budgets. Reasoning is unset by default; explicit
|
|
82
87
|
`none` is a wire value whose support depends on the provider/model. Progress is
|
|
@@ -34,6 +34,10 @@ dependencies = [
|
|
|
34
34
|
"httpx2>=2.13.0,<3",
|
|
35
35
|
"anyio>=4.10.0,<5",
|
|
36
36
|
"certifi>=2026.10.19,<2027",
|
|
37
|
+
# Bounded DLP representation parsing; no model or network validation.
|
|
38
|
+
"mistune>=3.4.0,<3.5",
|
|
39
|
+
"regex>=2026.9.29,<2027",
|
|
40
|
+
"emoji>=2.16.0,<3",
|
|
37
41
|
]
|
|
38
42
|
|
|
39
43
|
[project.urls]
|
|
@@ -62,6 +66,7 @@ dev = [
|
|
|
62
66
|
"towncrier>=26.9.0",
|
|
63
67
|
"twine>=7.0.0",
|
|
64
68
|
"types-jsonschema>=4.26.0.20260518",
|
|
69
|
+
"types-regex>=2026.9.29.20261030",
|
|
65
70
|
]
|
|
66
71
|
|
|
67
72
|
[tool.hatch.version]
|
{open_code_review_toolkit-0.14.2 → open_code_review_toolkit-0.14.4}/src/ocr_toolkit/_version.py
RENAMED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.14.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 14,
|
|
21
|
+
__version__ = version = '0.14.4'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 14, 4)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Command-line interface for review integration and local diagnostics."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -9,6 +9,8 @@ from collections.abc import Sequence
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
|
|
11
11
|
from ocr_toolkit import __version__, configure, mcp_config, preflight, review_runner
|
|
12
|
+
from ocr_toolkit.dlp_audit import cli as dlp_cli
|
|
13
|
+
from ocr_toolkit.dlp_audit.state import AuditError
|
|
12
14
|
from ocr_toolkit.posting.workflow import main as posting_main
|
|
13
15
|
|
|
14
16
|
|
|
@@ -17,7 +19,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
17
19
|
|
|
18
20
|
parser = argparse.ArgumentParser(
|
|
19
21
|
prog="ocr-ci",
|
|
20
|
-
description="
|
|
22
|
+
description="Code review integration and local diagnostic tools.",
|
|
23
|
+
exit_on_error=False,
|
|
21
24
|
)
|
|
22
25
|
parser.add_argument(
|
|
23
26
|
"--version",
|
|
@@ -25,6 +28,13 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
25
28
|
version=f"%(prog)s {__version__}",
|
|
26
29
|
)
|
|
27
30
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
31
|
+
audit_parser = subparsers.add_parser(
|
|
32
|
+
"dlp-audit",
|
|
33
|
+
help="Run offline DLP audits of local text/code with private reports.",
|
|
34
|
+
description="Local DLP diagnostics with private reports and exact-run comparisons.",
|
|
35
|
+
exit_on_error=False,
|
|
36
|
+
)
|
|
37
|
+
dlp_cli.configure_parser(audit_parser)
|
|
28
38
|
preflight_parser = subparsers.add_parser(
|
|
29
39
|
"preflight", help="Validate review prerequisites and configured access."
|
|
30
40
|
)
|
|
@@ -75,7 +85,20 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
75
85
|
def main(argv: Sequence[str] | None = None) -> int:
|
|
76
86
|
"""Dispatch one public subcommand and return its process exit code."""
|
|
77
87
|
|
|
78
|
-
|
|
88
|
+
arguments = list(sys.argv[1:] if argv is None else argv)
|
|
89
|
+
parser = build_parser()
|
|
90
|
+
try:
|
|
91
|
+
args, remaining = parser.parse_known_args(arguments)
|
|
92
|
+
except (argparse.ArgumentError, AuditError) as exc:
|
|
93
|
+
if arguments[:1] == ["dlp-audit"]:
|
|
94
|
+
return dlp_cli.error_result()
|
|
95
|
+
parser.error(str(exc))
|
|
96
|
+
if remaining:
|
|
97
|
+
if args.command == "dlp-audit":
|
|
98
|
+
return dlp_cli.error_result()
|
|
99
|
+
parser.error("unrecognized arguments: " + " ".join(remaining))
|
|
100
|
+
if args.command == "dlp-audit":
|
|
101
|
+
return dlp_cli.run(args)
|
|
79
102
|
if args.command == "preflight":
|
|
80
103
|
return preflight.main(local=True) if args.local else preflight.main()
|
|
81
104
|
if args.command == "configure":
|
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
"""Redaction helpers for data sent to logs, GitLab, or LLM context."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
import unicodedata
|
|
8
|
+
import urllib.parse
|
|
9
|
+
from bisect import bisect_right
|
|
10
|
+
from collections.abc import Iterator
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from ocr_toolkit.common.value_boundaries import complete_carrier as _complete_credential_carrier
|
|
14
|
+
from ocr_toolkit.common.value_boundaries import complete_value
|
|
15
|
+
|
|
16
|
+
SENSITIVE_KEY_PATTERN = (
|
|
17
|
+
r"x-api-key|api[_-]?key|access[_-]?token|auth[_-]?token|"
|
|
18
|
+
r"secret[_-]?key|refresh[_-]?token|private[_-]?token|"
|
|
19
|
+
r"client[_-]?secret|aws[_-]?secret[_-]?access[_-]?key|password"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
SENSITIVE_NAMED_KEY_PATTERN = (
|
|
24
|
+
rf"(?:(?:[A-Za-z0-9]+[_.-])*(?:{SENSITIVE_KEY_PATTERN})|"
|
|
25
|
+
r"(?:[A-Za-z0-9]+[_.-])*token)"
|
|
26
|
+
)
|
|
27
|
+
_MATERIAL_KEY_HINT = re.compile(rf"(?i)(?:{SENSITIVE_KEY_PATTERN}|token|authorization)")
|
|
28
|
+
|
|
29
|
+
_SECRET_ASSIGNMENT_KEY_PATTERN = (
|
|
30
|
+
rf'(?:"{SENSITIVE_NAMED_KEY_PATTERN}"|'
|
|
31
|
+
rf"'{SENSITIVE_NAMED_KEY_PATTERN}'|\b{SENSITIVE_NAMED_KEY_PATTERN})"
|
|
32
|
+
)
|
|
33
|
+
_UNTERMINATED_SECRET_RE = re.compile(
|
|
34
|
+
rf"(?im)(?P<prefix>{_SECRET_ASSIGNMENT_KEY_PATTERN}[ \t]*[:=][ \t]*(?P<quote>[\"']))"
|
|
35
|
+
r"(?P<value>(?:\\[^\r\n]|(?!(?P=quote))[^\\\r\n])+(?:\\)?)(?=\r?$)"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# The value capture is shared by semantic admission and diagnostic replacement.
|
|
39
|
+
# Admission never infers a credential from normalization or formatting changes.
|
|
40
|
+
_AUTH_RULES = (
|
|
41
|
+
(
|
|
42
|
+
re.compile(
|
|
43
|
+
r'(?i)(?P<prefix>"(?:proxy-)?authorization"\s*:\s*")(?P<value>(?:[^"\\]|\\.)*)(?P<suffix>")'
|
|
44
|
+
),
|
|
45
|
+
r"\g<prefix>***\g<suffix>",
|
|
46
|
+
),
|
|
47
|
+
(
|
|
48
|
+
re.compile(
|
|
49
|
+
r"(?i)(?P<prefix>'(?:proxy-)?authorization'\s*:\s*')(?P<value>(?:[^'\\]|\\.)*)(?P<suffix>')"
|
|
50
|
+
),
|
|
51
|
+
r"\g<prefix>***\g<suffix>",
|
|
52
|
+
),
|
|
53
|
+
(
|
|
54
|
+
re.compile(r"(?im)(?P<prefix>\b(?:proxy-)?authorization\s*[:=]\s*)(?P<value>[^\r\n]+)"),
|
|
55
|
+
r"\g<prefix>***",
|
|
56
|
+
),
|
|
57
|
+
)
|
|
58
|
+
_BEARER_RE = re.compile(r"(?i)\bbearer\s+[A-Za-z0-9_.\-+/=~]{12,}")
|
|
59
|
+
_JWT_RE = re.compile(r"\beyJ[A-Za-z0-9_\-]{5,}\.[A-Za-z0-9_\-]{5,}\.[A-Za-z0-9_\-]{5,}\b")
|
|
60
|
+
_ASSIGNMENT_RULES = (
|
|
61
|
+
(
|
|
62
|
+
re.compile(
|
|
63
|
+
rf'(?i)(?P<prefix>"{SENSITIVE_NAMED_KEY_PATTERN}"\s*:\s*")(?P<value>(?:[^"\\]|\\.)*)(?P<suffix>")'
|
|
64
|
+
),
|
|
65
|
+
r"\g<prefix>***\g<suffix>",
|
|
66
|
+
),
|
|
67
|
+
(
|
|
68
|
+
re.compile(
|
|
69
|
+
rf'(?i)(?P<prefix>{_SECRET_ASSIGNMENT_KEY_PATTERN}\s*[:=]\s*")(?P<value>(?:[^"\\]|\\.)*)(?P<suffix>")'
|
|
70
|
+
),
|
|
71
|
+
r"\g<prefix>***\g<suffix>",
|
|
72
|
+
),
|
|
73
|
+
(
|
|
74
|
+
re.compile(
|
|
75
|
+
rf"(?i)(?P<prefix>{_SECRET_ASSIGNMENT_KEY_PATTERN}\s*[:=]\s*')(?P<value>(?:[^'\\]|\\.)*)(?P<suffix>')"
|
|
76
|
+
),
|
|
77
|
+
r"\g<prefix>***\g<suffix>",
|
|
78
|
+
),
|
|
79
|
+
(_UNTERMINATED_SECRET_RE, r"\g<prefix>***"),
|
|
80
|
+
(
|
|
81
|
+
re.compile(
|
|
82
|
+
rf"(?i)(?P<prefix>\b{SENSITIVE_NAMED_KEY_PATTERN}\s*[:=]\s*)(?P<value>[^\"'\s,;&]+)"
|
|
83
|
+
),
|
|
84
|
+
r"\g<prefix>***",
|
|
85
|
+
),
|
|
86
|
+
(
|
|
87
|
+
re.compile(r"(?i)(?P<prefix>(?:^|[?&;\s])token=)(?P<value>[A-Za-z0-9_.\-+/=~]{8,})"),
|
|
88
|
+
r"\g<prefix>***",
|
|
89
|
+
),
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
SENSITIVE_ENV_NAMES = (
|
|
94
|
+
"OCR_LLM_TOKEN",
|
|
95
|
+
"OCR_LLM_AUTH_TOKEN",
|
|
96
|
+
"OCR_LLM_EXTRA_HEADERS",
|
|
97
|
+
"GITLAB_API_TOKEN",
|
|
98
|
+
"ANTHROPIC_API_KEY",
|
|
99
|
+
"OPENAI_API_KEY",
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
SECRET_SHAPED_ENV_NAME_RE = re.compile(
|
|
103
|
+
r"(?:^|_)(?:API_?KEY|AUTH_?TOKEN|ACCESS_?TOKEN|BEARER|CREDENTIAL|"
|
|
104
|
+
r"PASSWORD|PRIVATE_?KEY|SECRET|TOKEN)(?:$|_)",
|
|
105
|
+
flags=re.IGNORECASE,
|
|
106
|
+
)
|
|
107
|
+
MIN_DISCOVERED_SECRET_LENGTH = 16
|
|
108
|
+
_ASCII_BYPASS_CONTROLS = {code: None for code in (*range(32), 127) if chr(code) not in "\n\r\t"}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
REDACTION_TOKEN_SEPARATOR = r"[-_\s\u200b-\u200f\u202a-\u202e\u2060-\u206f]*"
|
|
112
|
+
REDACTION_TOKEN_ALIASES = {
|
|
113
|
+
"authorization": "authorization",
|
|
114
|
+
"proxyauthorization": "proxy-authorization",
|
|
115
|
+
"bearer": "bearer",
|
|
116
|
+
"xapikey": "x-api-key",
|
|
117
|
+
"apikey": "api_key",
|
|
118
|
+
"accesstoken": "access_token",
|
|
119
|
+
"authtoken": "auth_token",
|
|
120
|
+
"secretkey": "secret_key",
|
|
121
|
+
"refreshtoken": "refresh_token",
|
|
122
|
+
"privatetoken": "private_token",
|
|
123
|
+
"clientsecret": "client_secret",
|
|
124
|
+
"password": "password",
|
|
125
|
+
}
|
|
126
|
+
REDACTION_TOKEN_PATTERNS = tuple(
|
|
127
|
+
(
|
|
128
|
+
re.compile(
|
|
129
|
+
r"(?i)(?<![A-Za-z0-9])"
|
|
130
|
+
+ REDACTION_TOKEN_SEPARATOR.join(re.escape(char) for char in compact)
|
|
131
|
+
+ r"(?![A-Za-z0-9])"
|
|
132
|
+
),
|
|
133
|
+
canonical,
|
|
134
|
+
)
|
|
135
|
+
for compact, canonical in REDACTION_TOKEN_ALIASES.items()
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def normalize_redaction_tokens(text: str) -> str:
|
|
140
|
+
"""Collapse invisible separators only inside sensitive token names.
|
|
141
|
+
|
|
142
|
+
Preserving normal line breaks keeps diagnostics readable and prevents an
|
|
143
|
+
``Authorization`` header sweep from consuming subsequent Markdown lines.
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
normalized = text
|
|
147
|
+
for pattern, canonical in REDACTION_TOKEN_PATTERNS:
|
|
148
|
+
normalized = pattern.sub(
|
|
149
|
+
lambda match: (
|
|
150
|
+
canonical
|
|
151
|
+
if any(
|
|
152
|
+
char.isspace() or unicodedata.category(char) in {"Cf", "Zl", "Zp"}
|
|
153
|
+
for char in match.group(0)
|
|
154
|
+
)
|
|
155
|
+
else match.group(0)
|
|
156
|
+
),
|
|
157
|
+
normalized,
|
|
158
|
+
)
|
|
159
|
+
return normalized
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def strip_redaction_bypass_controls(text: str) -> str:
|
|
163
|
+
"""Remove invisible controls that can split secret keys or values."""
|
|
164
|
+
|
|
165
|
+
if text.isascii():
|
|
166
|
+
return text.translate(_ASCII_BYPASS_CONTROLS)
|
|
167
|
+
return "".join(
|
|
168
|
+
char
|
|
169
|
+
for char in text
|
|
170
|
+
if unicodedata.category(char) not in {"Cc", "Cf", "Zl", "Zp"} or char in "\n\r\t"
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def strip_path_controls(text: str) -> str:
|
|
175
|
+
"""Remove every Unicode control/format separator from a display path."""
|
|
176
|
+
|
|
177
|
+
return "".join(
|
|
178
|
+
char for char in text if unicodedata.category(char) not in {"Cc", "Cf", "Cs", "Zl", "Zp"}
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def environment_secret_values() -> tuple[str, ...]:
|
|
183
|
+
"""Snapshot effective exact/encoded values for one admission, without a global cache."""
|
|
184
|
+
|
|
185
|
+
variants: set[str] = set()
|
|
186
|
+
candidate_names = set(SENSITIVE_ENV_NAMES)
|
|
187
|
+
candidate_names.update(
|
|
188
|
+
name
|
|
189
|
+
for name, value in os.environ.items()
|
|
190
|
+
if len(value.strip()) >= MIN_DISCOVERED_SECRET_LENGTH
|
|
191
|
+
and SECRET_SHAPED_ENV_NAME_RE.search(name)
|
|
192
|
+
)
|
|
193
|
+
for name in candidate_names:
|
|
194
|
+
value = os.environ.get(name)
|
|
195
|
+
if not value or len(value) < 4:
|
|
196
|
+
continue
|
|
197
|
+
normalized_value = strip_redaction_bypass_controls(value)
|
|
198
|
+
for variant in (
|
|
199
|
+
value,
|
|
200
|
+
normalized_value,
|
|
201
|
+
unicodedata.normalize("NFC", value),
|
|
202
|
+
unicodedata.normalize("NFC", normalized_value),
|
|
203
|
+
):
|
|
204
|
+
if not variant:
|
|
205
|
+
continue
|
|
206
|
+
variants.update(
|
|
207
|
+
{
|
|
208
|
+
variant,
|
|
209
|
+
urllib.parse.quote(variant, safe=""),
|
|
210
|
+
urllib.parse.quote_plus(variant),
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
return tuple(sorted(variants, key=len, reverse=True))
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def redact_env_secret_values(text: str, *, values: tuple[str, ...] | None = None) -> str:
|
|
218
|
+
"""Replace configured values; a caller may reuse one immutable admission snapshot."""
|
|
219
|
+
|
|
220
|
+
if not text:
|
|
221
|
+
return text
|
|
222
|
+
redacted = text
|
|
223
|
+
for variant in environment_secret_values() if values is None else values:
|
|
224
|
+
redacted = redacted.replace(variant, "***")
|
|
225
|
+
return redacted
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def _complete_credential_value(text: str, end: int, *, start: int | None = None) -> bool:
|
|
229
|
+
"""Require a terminal value, not a prefix of concatenation or a call.
|
|
230
|
+
|
|
231
|
+
One unambiguous matching outer quote may close its carrier. Arbitrary
|
|
232
|
+
quotes cannot prove an empty prefix is the whole value.
|
|
233
|
+
"""
|
|
234
|
+
|
|
235
|
+
cursor = end
|
|
236
|
+
while cursor < len(text) and text[cursor] in " \t":
|
|
237
|
+
cursor += 1
|
|
238
|
+
if start is not None and cursor < len(text) and text[cursor] in "\"'":
|
|
239
|
+
quote = text[cursor]
|
|
240
|
+
opening = text.rfind(quote, max(0, start - 1024), start)
|
|
241
|
+
carrier = opening >= 0 and (opening == 0 or text[opening - 1] not in "\\\"'")
|
|
242
|
+
# An unquoted mask can be inside a path or other quoted carrier. Its
|
|
243
|
+
# entire prefix must be unambiguous; quote runs never prove a carrier.
|
|
244
|
+
prefix = text[opening + 1 : cursor] if carrier else ""
|
|
245
|
+
single = opening == start - 1 or (
|
|
246
|
+
text[end - 1] not in "\"'" and not any(c in prefix for c in (quote, "\\", "\r", "\n"))
|
|
247
|
+
)
|
|
248
|
+
if carrier and single and text[end - 1] != quote:
|
|
249
|
+
return _complete_credential_carrier(text, cursor + 1)
|
|
250
|
+
return complete_value(text, end)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def masked_credential_spans(text: str) -> tuple[tuple[int, int], ...]:
|
|
254
|
+
"""Locate canonical masks so display interpretation cannot erase them."""
|
|
255
|
+
|
|
256
|
+
if "***" not in text:
|
|
257
|
+
return ()
|
|
258
|
+
spans = {
|
|
259
|
+
match.span("value")
|
|
260
|
+
for pattern, _replacement in (*_AUTH_RULES, *_ASSIGNMENT_RULES)
|
|
261
|
+
for match in pattern.finditer(text)
|
|
262
|
+
if match["value"] == "***"
|
|
263
|
+
and _complete_credential_value(text, match.end(), start=match.start())
|
|
264
|
+
}
|
|
265
|
+
# URI carriers have their own proven boundaries. A closing carrier quote
|
|
266
|
+
# must not require granting the same authority to arbitrary quote runs.
|
|
267
|
+
for query, end, empty, qualified in _material_queries(text):
|
|
268
|
+
if empty and qualified:
|
|
269
|
+
start = query.end()
|
|
270
|
+
while start < end and text[start].isspace():
|
|
271
|
+
start += 1
|
|
272
|
+
if text[start:end] == "***":
|
|
273
|
+
spans.add((start, end))
|
|
274
|
+
elif text[start:end] in {"'***'", '"***"'}:
|
|
275
|
+
spans.add((start + 1, end - 1))
|
|
276
|
+
return tuple(sorted(spans))
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def _credential_material(text: str) -> bool:
|
|
280
|
+
if (":" not in text and "=" not in text) or not _MATERIAL_KEY_HINT.search(text):
|
|
281
|
+
return False
|
|
282
|
+
# Resolve complete quoted values first. The broader fallback expressions
|
|
283
|
+
# must not reinterpret a closing quote as a new credential. Binary search
|
|
284
|
+
# avoids quadratic work for documents containing many empty/masked fields.
|
|
285
|
+
# A proven empty query qualifies only its key, never a broad regex match
|
|
286
|
+
# spanning a fragment, source wrapper or a subsequent credential field.
|
|
287
|
+
parts = []
|
|
288
|
+
previous = 0
|
|
289
|
+
for query, _end, empty, qualified in _material_queries(text):
|
|
290
|
+
if empty and qualified:
|
|
291
|
+
start, end = query.span(2)
|
|
292
|
+
parts.extend((text[previous:start], "x" * (end - start)))
|
|
293
|
+
previous = end
|
|
294
|
+
if parts:
|
|
295
|
+
parts.append(text[previous:])
|
|
296
|
+
text = "".join(parts)
|
|
297
|
+
safe_fields: set[tuple[int, int]] = set()
|
|
298
|
+
for pattern, _replacement in (*_AUTH_RULES, *_ASSIGNMENT_RULES):
|
|
299
|
+
if "suffix" not in pattern.groupindex:
|
|
300
|
+
continue
|
|
301
|
+
for match in pattern.finditer(text):
|
|
302
|
+
if match["value"] not in {"", "***"} or not _complete_credential_value(
|
|
303
|
+
text, match.end(), start=match.start()
|
|
304
|
+
):
|
|
305
|
+
return True
|
|
306
|
+
safe_fields.add(match.span())
|
|
307
|
+
ordered_fields = sorted(safe_fields)
|
|
308
|
+
for pattern, _replacement in (*_AUTH_RULES, *_ASSIGNMENT_RULES):
|
|
309
|
+
if "suffix" in pattern.groupindex:
|
|
310
|
+
continue
|
|
311
|
+
for match in pattern.finditer(text):
|
|
312
|
+
index = bisect_right(ordered_fields, (match.start(), len(text) + 1)) - 1
|
|
313
|
+
if index >= 0 and match.end() <= ordered_fields[index][1]:
|
|
314
|
+
continue
|
|
315
|
+
if match["value"] in {"", "***"} and _complete_credential_value(
|
|
316
|
+
text, match.end(), start=match.start()
|
|
317
|
+
):
|
|
318
|
+
continue
|
|
319
|
+
return True
|
|
320
|
+
return False
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
_QUERY_VALUE_RE = re.compile(r"(?i)(^|[?&;])([^=?#&;]+)=([^&#;\s]+)(#[^&;\s]*)?")
|
|
324
|
+
# Diagnostic replacement and material classification have distinct grammars.
|
|
325
|
+
# A key-only iterator cannot consume another credential inside a wrapper tail.
|
|
326
|
+
_QUERY_KEY_RE = re.compile(r"(?i)(^|[?&;])([^=?#&;\s]+)=")
|
|
327
|
+
_QUERY_END_RE = re.compile(r"[&#\s]")
|
|
328
|
+
_EMPTY_QUERY_VALUE_RE = re.compile(r"(?:(?P<quote>['\"])(?:\*\*\*|)(?P=quote)|\*\*\*)")
|
|
329
|
+
_URI_CARRIER = re.compile(r"(?P<quote>['\"])[A-Za-z][A-Za-z0-9+.-]{0,31}:[^\s\"'<>]*$")
|
|
330
|
+
_URI_SCHEME = re.compile(r"(?<![\w.+-])[A-Za-z][A-Za-z0-9+.-]{0,31}://")
|
|
331
|
+
_SOURCE_BREAK = re.compile(r"[\s\"'<>]")
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def _material_queries(text: str) -> Iterator[tuple[re.Match[str], int, bool, bool]]:
|
|
335
|
+
"""Walk complete sensitive values without granting authority to their tails."""
|
|
336
|
+
|
|
337
|
+
cursor = 0
|
|
338
|
+
while (query := _QUERY_KEY_RE.search(text, cursor)) is not None:
|
|
339
|
+
cursor = query.end()
|
|
340
|
+
if not _query_key_is_sensitive(query[2]):
|
|
341
|
+
continue
|
|
342
|
+
start = cursor
|
|
343
|
+
# Assignment detectors allow leading whitespace. A URI-shaped prefix
|
|
344
|
+
# must not turn that same whitespace into proof of an empty value.
|
|
345
|
+
while start < len(text) and text[start].isspace():
|
|
346
|
+
start += 1
|
|
347
|
+
qualified = not query[1] or query.start() == 0
|
|
348
|
+
safe = _EMPTY_QUERY_VALUE_RE.match(text, start)
|
|
349
|
+
if not query[1] and safe is not None and safe["quote"]:
|
|
350
|
+
end = safe.end()
|
|
351
|
+
empty = complete_value(text, end)
|
|
352
|
+
else:
|
|
353
|
+
left = max(0, query.start() - 1024)
|
|
354
|
+
window = text[left : query.start()]
|
|
355
|
+
carrier = _URI_CARRIER.search(window)
|
|
356
|
+
ambiguous_carrier = False
|
|
357
|
+
if carrier is not None:
|
|
358
|
+
opening = left + carrier.start("quote")
|
|
359
|
+
if opening and text[opening - 1] in "\\\"'":
|
|
360
|
+
carrier = None
|
|
361
|
+
ambiguous_carrier = True
|
|
362
|
+
token_start = max((part.end() for part in _SOURCE_BREAK.finditer(window)), default=0)
|
|
363
|
+
qualified = (
|
|
364
|
+
qualified
|
|
365
|
+
or carrier is not None
|
|
366
|
+
or _URI_SCHEME.search(window, token_start) is not None
|
|
367
|
+
)
|
|
368
|
+
closing = text.find(carrier["quote"], start) if carrier is not None else -1
|
|
369
|
+
if closing == start and not _complete_credential_carrier(text, closing + 1):
|
|
370
|
+
# An opening query-value quote cannot also prove the carrier's
|
|
371
|
+
# end. Ambiguous nested quoting retains ordinary checks.
|
|
372
|
+
closing = -1
|
|
373
|
+
if closing >= 0 and text[closing - 1 : closing] == "\\":
|
|
374
|
+
closing = -1
|
|
375
|
+
# Bound the delimiter search before a proven source-string end;
|
|
376
|
+
# otherwise adjacent quoted URLs could rescan the entire suffix.
|
|
377
|
+
maximum = closing if closing >= 0 else len(text)
|
|
378
|
+
boundary = _QUERY_END_RE.search(text, start, maximum)
|
|
379
|
+
end = boundary.start() if boundary else maximum
|
|
380
|
+
closed = closing >= 0 and end == closing
|
|
381
|
+
empty = start == end or _EMPTY_QUERY_VALUE_RE.fullmatch(text, start, end) is not None
|
|
382
|
+
empty = empty and not ambiguous_carrier
|
|
383
|
+
if closed and not _complete_credential_carrier(text, end + 1):
|
|
384
|
+
empty = False
|
|
385
|
+
if (
|
|
386
|
+
end < len(text)
|
|
387
|
+
and text[end].isspace()
|
|
388
|
+
and not _complete_credential_value(text, end)
|
|
389
|
+
):
|
|
390
|
+
empty = False
|
|
391
|
+
yield query, end, empty, qualified
|
|
392
|
+
cursor = max(cursor, end)
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def _query_has_material(text: str) -> bool:
|
|
396
|
+
"""Classify complete values; diagnostic replacement may consume wrappers."""
|
|
397
|
+
|
|
398
|
+
return any(not empty for _query, _end, empty, _qualified in _material_queries(text))
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def has_sensitive_material(
|
|
402
|
+
text: str,
|
|
403
|
+
*,
|
|
404
|
+
credential_view: str | None = None,
|
|
405
|
+
values: tuple[str, ...] | None = None,
|
|
406
|
+
) -> bool:
|
|
407
|
+
"""Classify publication material using shared rules, not diagnostic rewrites."""
|
|
408
|
+
|
|
409
|
+
values = environment_secret_values() if values is None else values
|
|
410
|
+
# A decoded passphrase may itself contain words rewritten by token-name
|
|
411
|
+
# canonicalization. Its incoming representation is independently sensitive.
|
|
412
|
+
if redact_env_secret_values(text, values=values) != text:
|
|
413
|
+
return True
|
|
414
|
+
prepared = normalize_redaction_tokens(strip_redaction_bypass_controls(text))
|
|
415
|
+
view = text if credential_view is None else credential_view
|
|
416
|
+
credential = (
|
|
417
|
+
prepared
|
|
418
|
+
if view == text
|
|
419
|
+
else normalize_redaction_tokens(strip_redaction_bypass_controls(view))
|
|
420
|
+
)
|
|
421
|
+
return bool(
|
|
422
|
+
redact_env_secret_values(prepared, values=values) != prepared
|
|
423
|
+
or redact_url_userinfo_only(prepared) != prepared
|
|
424
|
+
or _query_has_material(credential)
|
|
425
|
+
or _BEARER_RE.search(prepared)
|
|
426
|
+
or _JWT_RE.search(prepared)
|
|
427
|
+
or _credential_material(credential)
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
def redact_sensitive(text: str) -> str:
|
|
432
|
+
"""Replace known secret values from the process environment with `***`.
|
|
433
|
+
|
|
434
|
+
Used before publishing OCR-controlled text to the merge request and when
|
|
435
|
+
rendering bounded local diagnostics from structured OCR JSON fields.
|
|
436
|
+
Performs two passes:
|
|
437
|
+
|
|
438
|
+
1. Replace each known env value (length >= 4). This is exact-match
|
|
439
|
+
replacement over a small allowlist of secret-bearing environment
|
|
440
|
+
variables, so short bot/MCP secrets still get redacted without
|
|
441
|
+
broadening arbitrary text rewrites. URL-encoded forms are covered.
|
|
442
|
+
2. Sweep generic patterns: whole Authorization header values regardless
|
|
443
|
+
of auth scheme, `Bearer ...`, `x-api-key: ...`, JSON/key-value secrets,
|
|
444
|
+
JWT-shaped values, and `token=...`. This catches values OCR may have
|
|
445
|
+
logged or copied into structured JSON that did not come straight from
|
|
446
|
+
one of our env vars.
|
|
447
|
+
"""
|
|
448
|
+
|
|
449
|
+
if not text:
|
|
450
|
+
return text
|
|
451
|
+
redacted = normalize_redaction_tokens(strip_redaction_bypass_controls(text))
|
|
452
|
+
redacted = redact_url_userinfo(redacted)
|
|
453
|
+
redacted = redact_env_secret_values(redacted)
|
|
454
|
+
for pattern, replacement in _AUTH_RULES:
|
|
455
|
+
redacted = pattern.sub(replacement, redacted)
|
|
456
|
+
redacted = _BEARER_RE.sub("Bearer ***", redacted)
|
|
457
|
+
for pattern, replacement in _ASSIGNMENT_RULES:
|
|
458
|
+
redacted = pattern.sub(replacement, redacted)
|
|
459
|
+
return _JWT_RE.sub("***", redacted)
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def sanitize_ocr_value(value: Any) -> Any:
|
|
463
|
+
"""Recursively redact OCR-controlled strings before MR publication.
|
|
464
|
+
|
|
465
|
+
OCR JSON is model/provider-controlled output. Treat every string as
|
|
466
|
+
publishable until proven otherwise: comments, warnings, tool metadata,
|
|
467
|
+
and future fields all pass through this sanitizer before any formatting,
|
|
468
|
+
fingerprinting, or GitLab posting logic consumes them.
|
|
469
|
+
"""
|
|
470
|
+
|
|
471
|
+
if isinstance(value, str):
|
|
472
|
+
return redact_sensitive(value)
|
|
473
|
+
if isinstance(value, list):
|
|
474
|
+
return [sanitize_ocr_value(item) for item in value]
|
|
475
|
+
if isinstance(value, dict):
|
|
476
|
+
sanitized: dict[Any, Any] = {}
|
|
477
|
+
for key, item in value.items():
|
|
478
|
+
sanitized_key = sanitize_ocr_value(key) if isinstance(key, str) else key
|
|
479
|
+
sanitized[sanitized_key] = sanitize_ocr_value(item)
|
|
480
|
+
return sanitized
|
|
481
|
+
return value
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def redact_url_userinfo_only(value: str) -> str:
|
|
485
|
+
"""Redact only URL userinfo, leaving path/query text unchanged."""
|
|
486
|
+
|
|
487
|
+
def replace(match: re.Match[str]) -> str:
|
|
488
|
+
prefix, userinfo = match.group(1), match.group(2)
|
|
489
|
+
if not _is_url_userinfo_candidate(userinfo):
|
|
490
|
+
return match.group(0)
|
|
491
|
+
return f"{prefix}***@"
|
|
492
|
+
|
|
493
|
+
return re.sub(
|
|
494
|
+
r"(?i)([a-z][a-z0-9+.-]*://)([^/?#@]+)@"
|
|
495
|
+
r"(?=[^/?#\s@]+(?:[/?#]|[\s,;.!)]|$))",
|
|
496
|
+
replace,
|
|
497
|
+
value,
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
def _is_url_userinfo_candidate(userinfo: str) -> bool:
|
|
502
|
+
"""Return whether text before `@host` is plausibly URL userinfo."""
|
|
503
|
+
|
|
504
|
+
normalized = "".join(
|
|
505
|
+
char for char in userinfo if unicodedata.category(char) not in {"Cc", "Cf", "Zl", "Zp"}
|
|
506
|
+
)
|
|
507
|
+
decoded = urllib.parse.unquote(normalized)
|
|
508
|
+
if not decoded or any(char in decoded for char in "/?#@"):
|
|
509
|
+
return False
|
|
510
|
+
if any(char.isspace() for char in userinfo):
|
|
511
|
+
return ":" in decoded
|
|
512
|
+
return True
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
def _query_key_is_sensitive(raw_key: str) -> bool:
|
|
516
|
+
"""Return whether a URL query key names a credential."""
|
|
517
|
+
|
|
518
|
+
decoded = urllib.parse.unquote_plus(raw_key)
|
|
519
|
+
decoded = "".join(
|
|
520
|
+
char for char in decoded if unicodedata.category(char) not in {"Cc", "Cf", "Zl", "Zp"}
|
|
521
|
+
)
|
|
522
|
+
decoded = normalize_redaction_tokens(decoded)
|
|
523
|
+
return re.fullmatch(SENSITIVE_NAMED_KEY_PATTERN, decoded, re.IGNORECASE) is not None
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
def _redact_sensitive_query_values(value: str) -> str:
|
|
527
|
+
"""Redact sensitive query-like key values, including encoded key names."""
|
|
528
|
+
|
|
529
|
+
def replace(match: re.Match[str]) -> str:
|
|
530
|
+
prefix, key, suffix = match.group(1), match.group(2), match.group(4) or ""
|
|
531
|
+
if not _query_key_is_sensitive(key):
|
|
532
|
+
return match.group(0)
|
|
533
|
+
return f"{prefix}{key}=***{suffix}"
|
|
534
|
+
|
|
535
|
+
return _QUERY_VALUE_RE.sub(replace, value)
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
def redact_url_userinfo(value: str) -> str:
|
|
539
|
+
"""Redact credentials embedded in URL-like manifest values."""
|
|
540
|
+
|
|
541
|
+
value = redact_url_userinfo_only(value)
|
|
542
|
+
return _redact_sensitive_query_values(value)
|