Skip to content

Fixed an issue where security labels spanning several lines broke the Properties dialog. #10817 - #10821

Merged
dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix/issue-10817-multiline-seclabels
Nov 25, 2026
Merged

dpage merged 1 commit into
pgadmin-org:masterfrom
dpage:fix/issue-10817-multiline-seclabels

Conversation

@dpage

@dpage dpage commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • parse_sec_labels_from_db() (databases, domains, functions, foreign tables) parsed labels with a regex that stopped at the first newline, so a multi-line label errored on load, split at the wrong =, or lost a trailing newline.
  • It now delegates to parse_seclabels_from_db() from fix: split security labels on the first = only #10808, which splits on the first = only, so every node parses security labels the same way.

Test plan

  • Extended test_parse_seclabels_from_db with multi-line cases and the wrapper; the wrapper case fails without the fix.
  • --pkg browser.server_groups.servers.databases.schemas.domains passes.
  • pycodestyle clean.

Closes #10817

Summary by CodeRabbit

  • Bug Fixes
    • Improved database security label parsing for multiline values, labels containing additional equals signs, and values with trailing newlines.
    • Improved handling of missing label data.

… Properties dialog. pgadmin-org#10817

parse_sec_labels_from_db(), used for databases, domains, functions and
foreign tables, matched each 'provider=label' string with a regular
expression that stopped at the first newline, so a multi-line label
raised an error, was split at the wrong '=', or lost a trailing newline.
It now uses parse_seclabels_from_db(), which splits on the first '='
only, so every node parses security labels the same way.

Closes pgadmin-org#10817
@dpage dpage self-assigned this Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The database security-label utility now uses the shared parser. Tests cover multiline labels, embedded equals signs, trailing newlines, and None input.

Changes

Database security-label parsing

Layer / File(s) Summary
Shared parser delegation and validation
web/pgadmin/browser/server_groups/servers/databases/utils.py, web/pgadmin/browser/server_groups/servers/tests/test_parse_seclabels_from_db.py
The database utility delegates parsing to the shared helper and passes an empty list for falsy input. Tests cover multiline labels, embedded equals signs, trailing newlines, and None input.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Merge Risk: Minimal · up to 7d409

This change fixes security labels containing newlines so they load correctly in the Properties dialog and SQL tab for databases, domains, functions, and foreign tables. The change is small and covered by tests, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: multiline security labels no longer break the Properties dialog. The raw summary shows the change in utils.py delegates parse_sec_labels_from_db to the shared parse_s…
Linked Issues check Passed Issue #10817 requires that security labels containing newlines parse correctly for databases, domains, functions, and foreign tables. The reviewed head's web/pgadmin/browser/server_groups/servers/data…
Out of Scope Changes check Passed The change set consists of two files: databases/utils.py (parse_sec_labels_from_db now delegates to the shared parser, and the local loop and regex are removed) and the test file test_parse_seclabels_…
Full details: Title check

Explanation

The title states the main change: multiline security labels no longer break the Properties dialog. The raw summary shows the change in utils.py delegates parse_sec_labels_from_db to the shared parse_seclabels_from_db parser, and the added tests cover multiline labels, which matches the title's subject. The title also references issue #10817, which the linked issue confirms. The title is 95 characters, slightly long but within a readable single sentence.

Full details: Linked Issues check

Explanation

Issue #10817 requires that security labels containing newlines parse correctly for databases, domains, functions, and foreign tables. The reviewed head's web/pgadmin/browser/server_groups/servers/databases/utils.py makes parse_sec_labels_from_db() delegate to parse_seclabels_from_db(), which calls seclbls.split('=', 1). For 'demo_provider=line one\nline two' this yields provider 'demo_provider' and label 'line one\nline two'. For 'demo_provider=a\nb=c' it yields label 'a\nb=c', which fixes the wrong-split case. A trailing newline is kept because split does not strip it, which fixes the silent-strip case. The None input is handled by 'db_sec_labels or []', which removes the None-group error path. test_parse_seclabels_from_db.py covers these cases at head: multi-line labels, a later '=' on a later line, a trailing newline, and the parse_sec_labels_from_db wrapper with None. The issue's coding requirements are met. Caveat: the inspection tool could not return the whole-PR text diff, so the removed base-side regex is established from the PR summary and not from a base-to-head diff.

Full details: Out of Scope Changes check

Explanation

The change set consists of two files: databases/utils.py (parse_sec_labels_from_db now delegates to the shared parser, and the local loop and regex are removed) and the test file test_parse_seclabels_from_db.py (new multi-line, trailing-newline, wrapper, and column-formatter test cases). Both directly implement or verify issue #10817. The shared parse_seclabels_from_db in servers/utils.py is only used, not modified, according to the change summary. No unrelated behaviour changes were identified. Caveat: the whole-PR text diff was unavailable, so the file list relies on the raw change summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3711453 and 7d40984.

Files selected for processing: 2

  • web/pgadmin/browser/server_groups/servers/databases/utils.py
  • web/pgadmin/browser/server_groups/servers/tests/test_parse_seclabels_from_db.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@Anurag1428

Copy link
Copy Markdown

Thanks for the fix. I read the change: replacing the regex with the shared split('=', 1) parser from #10808 looks right to me, and the new tests cover multi-line labels, a later '=' and a trailing newline.

@dpage
dpage merged commit c104b3f into pgadmin-org:master Nov 25, 2026
32 checks passed
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.

Security labels that span several lines break the Properties dialog for databases, domains, functions and foreign tables

2 participants