Skip to content

[PULP-2214] Add relative_path domains - #7959

Open
mdellweg wants to merge 2 commits into
pulp:mainfrom
mdellweg:relative_path_domain
Open

[PULP-2214] Add relative_path domains#7959
mdellweg wants to merge 2 commits into
pulp:mainfrom
mdellweg:relative_path_domain

Conversation

@mdellweg

Copy link
Copy Markdown
Member

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.

📜 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
mdellweg force-pushed the relative_path_domain branch 4 times, most recently from f4e10a6 to 4482b3f Compare August 11, 2026 15:18
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.
@mdellweg
mdellweg force-pushed the relative_path_domain branch from 4482b3f to 9000e8b Compare August 12, 2026 07:00
@mdellweg
mdellweg marked this pull request as ready for review August 12, 2026 07:30


CREATE_REL_PATH_DOMAINS = """
CREATE OR REPLACE FUNCTION "is_relative_path" ("path" text) RETURNS bool AS $$

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.

Is it still useful to have this function now?
We can also just directly define the domain using the regex check:

CREATE DOMAIN "relative_path" AS text CHECK ('/' || VALUE || '/' !~ '[\n\r\s\t\?#]|(/\.{0,2}/)');

Which one would make postgres faster?

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