Skip to content

Base path db constaint - #7952

Draft
mdellweg wants to merge 4 commits into
pulp:mainfrom
mdellweg:base_path_db_constaint
Draft

Base path db constaint#7952
mdellweg wants to merge 4 commits into
pulp:mainfrom
mdellweg:base_path_db_constaint

Conversation

@mdellweg

Copy link
Copy Markdown
Member

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

@mdellweg

Copy link
Copy Markdown
Member Author

I looked at building an exclusion constraint. But as '^@' is not a symmetric operator, PG won't let me.

@mdellweg

Copy link
Copy Markdown
Member Author

And defining a new operator class is a sysadmin only trait in postgres.

slashed_path text := '/' || path || '/';
BEGIN
-- Verify base path is normalized!
-- i.e. is relative, does not end with '/' and does not contain '//' or '.', '..' segments.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do we also need to restrict the character set?

This introduces a new shallow database type with a check constraint to
maintain that all relative paths are sanitized.
This also consolidates on the idea what can be allowed as a relative
path.
This allows to relieve the tasking system from taking care of base_path
sanity.
@mdellweg
mdellweg force-pushed the base_path_db_constaint branch 3 times, most recently from 063fa04 to bfe7789 Compare August 12, 2026 12:31
The base_path integrity is maintained by a database constraint now.
@mdellweg
mdellweg force-pushed the base_path_db_constaint branch from bfe7789 to f2400a6 Compare August 12, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant