Skip to content

refactor(core): move path security helper out of lib - #662

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/core-security-clean
May 1, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/core-security-clean

Conversation

@Sinity

@Sinity Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

Move sanitize_path from polylogue.lib.security to polylogue.core.security.

Problem

The path sanitizer is a low-level safety primitive used by parser and storage models. Keeping it under the catch-all lib root made security policy look like miscellaneous library code rather than core boundary logic.

Solution

Rename polylogue/lib/security.py to polylogue/core/security.py, update parser/storage/test references and security coverage docs, refresh topology, and keep no old-path shim.

Verification

  • devtools build-topology-projection && devtools verify-topology — realized=697 declared=697 blocking=False
  • ruff check polylogue/ tests/ devtools/ — all checks passed
  • mypy polylogue/ — no issues found in 697 source files
  • pytest -q tests/unit/security/test_path_sanitization.py tests/unit/sources/test_parsers_base.py — 108 passed
  • devtools render-all --check — sync OK
  • pre-push devtools verify --quick — all checks passed

Note: an earlier broader test batch including tests/unit/storage/test_backend.py was terminated after hanging in test_async_read_connection_closes_cleanly_after_pool_teardown; that test is unrelated to this import relocation and the directly affected security/parser suite passed.

Ref #635

Copilot AI review requested due to automatic review settings May 1, 2026 19:09
@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 27 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 21effecc-1b6c-471b-bf4d-1ef76645e59d

📥 Commits

Reviewing files that changed from the base of the PR and between 7400310 and ebc0dc1.

📒 Files selected for processing (8)
  • devtools/build_topology_projection.py
  • docs/plans/security-privacy-coverage.yaml
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/core/security.py
  • polylogue/sources/parsers/base_models.py
  • polylogue/storage/runtime/archive/records.py
  • tests/unit/security/test_path_sanitization.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/core-security-clean

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 14 minutes and 27 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity merged commit 25b9aa2 into master May 1, 2026
15 checks passed
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

Refs: origin/master..HEAD
Changed paths: 8

Affected Domains

  • architecture_discipline — 2 claim(s), maturity growing
  • docs_media — 0 claim(s), maturity seed
  • security_privacy — 0 claim(s), maturity nascent
  • spec_completeness — 3 claim(s), maturity seed
  • unclassified — 2 claim(s), maturity seed

Required Gates

  • devtools verify-manifests — structural manifest changed
  • devtools affected-obligations --path devtools/build_topology_projection.py — refresh structural obligation routing
  • devtools verify-topology — topology projection changed
  • devtools render-verification-catalog --check — coverage manifests feed proof subjects
  • devtools proof-pack --path docs/plans/security-privacy-coverage.yaml --markdown — coverage changes feed proof-pack gaps
  • devtools affected-obligations --path docs/plans/topology-target.yaml — refresh structural obligation routing
  • devtools affected-obligations --path docs/topology-status.md — refresh structural obligation routing
  • pytest tests/unit/sources — parser semantics changed
  • devtools pipeline-probe --provider unknown — parser pipeline probe
  • devtools affected-obligations --path polylogue/sources/parsers/base_models.py — refresh focused obligation routing
  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit
  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • docs_media: docs_media: No scenario for documentation freshness verification [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], docs_media: README examples and media are not yet generated from executable scenario projections. [owner: docs-media; next: Add executable scenario projection or media integrity gate], docs_media: Screenshots and VHS media have no committed nonblank/readability verification. [owner: docs-media; next: Add executable scenario projection or media integrity gate]
  • security_privacy: dependency_audit: No dependency vulnerability scanning in CI [owner: security-privacy; next: Add dedicated security/privacy gate for this area], file_permissions: Crawl-source file permissions not verified [owner: security-privacy; next: Add dedicated security/privacy gate for this area], secrets_detection: No automated secrets scanning in CI [owner: security-privacy; next: Add dedicated security/privacy gate for this area], security_privacy: Security verification uses unit tests, not scenario specs [owner: scenario-coverage; next: Add scenario family or generated projection for this subject], xss_prevention: No dedicated XSS test file; relies on snapshot rendering [owner: security-privacy; next: Add dedicated security/privacy gate for this area]

Oracle / Cost

  • oracle mix: {"construction_sanity": 20, "drift_check": 2}
  • cost tier: {"static": 22}
  • stale evidence: 22
  • manual review cells: 0

@Sinity
Sinity deleted the feature/refactor/core-security-clean branch May 1, 2026 19:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the sanitize_path security primitive out of polylogue.lib and into polylogue.core, updating imports and topology/security documentation to reflect the new core boundary placement.

Changes:

  • Introduce polylogue/core/security.py containing sanitize_path and update parser/storage/test imports.
  • Update topology projection inputs/outputs to reflect the new module location and ownership.
  • Refresh security/privacy coverage docs to point at the new implementation path.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/security/test_path_sanitization.py Updates test import to polylogue.core.security.sanitize_path.
polylogue/storage/runtime/archive/records.py Updates attachment path validator helper import to core security module.
polylogue/sources/parsers/base_models.py Updates parser model path validator helper import to core security module.
polylogue/core/security.py New core location for sanitize_path.
docs/topology-status.md Updates rendered topology counts after moving security primitive.
docs/plans/topology-target.yaml Reassigns security.py from lib-root to core-primitive.
docs/plans/security-privacy-coverage.yaml Updates coverage reference from lib to core security module.
devtools/build_topology_projection.py Removes security.py from lib-root primitive keep-set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Move `sanitize_path` from `polylogue.lib.security` to
`polylogue.core.security`.

## Problem

The path sanitizer is a low-level safety primitive used by parser and
storage models. Keeping it under the catch-all `lib` root made security
policy look like miscellaneous library code rather than core boundary
logic.

## Solution

Rename `polylogue/lib/security.py` to `polylogue/core/security.py`,
update parser/storage/test references and security coverage docs,
refresh topology, and keep no old-path shim.

## Verification

- `devtools build-topology-projection && devtools verify-topology` —
realized=697 declared=697 blocking=False
- `ruff check polylogue/ tests/ devtools/` — all checks passed
- `mypy polylogue/` — no issues found in 697 source files
- `pytest -q tests/unit/security/test_path_sanitization.py
tests/unit/sources/test_parsers_base.py` — 108 passed
- `devtools render-all --check` — sync OK
- pre-push `devtools verify --quick` — all checks passed

Note: an earlier broader test batch including
`tests/unit/storage/test_backend.py` was terminated after hanging in
`test_async_read_connection_closes_cleanly_after_pool_teardown`; that
test is unrelated to this import relocation and the directly affected
security/parser suite passed.

Ref #635
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants