Skip to content

Comments

Add coverage for PushMetadataAssembler#1912

Merged
kayjoosten merged 2 commits intomainfrom
feature/add-coverage-for-pushmetaassembler
Feb 19, 2026
Merged

Add coverage for PushMetadataAssembler#1912
kayjoosten merged 2 commits intomainfrom
feature/add-coverage-for-pushmetaassembler

Conversation

@kayjoosten
Copy link
Contributor

No description provided.

…tures

  Adds 8 integration tests covering three critical untested areas in
  PushMetadataAssembler, a security-critical component responsible for
  converting service registry JSON into SAML metadata entities.

  Coverage areas:

  1. Connection Whitelisting (4 tests)
     - SP allowed_connections array filtering
     - SP allow_all_entities flag behavior
     - Empty whitelist enforcement
     - Default configuration handling

  2. Attribute Release Policy - ARP (3 tests)
     - Simple string rules with wildcard patterns
     - Complex object rules with source, motivation, and release_as metadata
     - Missing ARP configuration scenarios

  3. Multiple X.509 Certificates (1 test)
     - Certificate rollover support (certData, certData2, certData3)

  All tests follow the existing AAA (Arrange-Act-Assert) pattern with clear
  explanatory comments. Consistently uses the readFixture() helper method with
  9 new fixture files, following established project conventions.

  Impact:
  - Method coverage improved from 45.83% to ~70%
  - Line coverage improved from 81.33% to ~90%
  - Previously untested critical code paths now validated:
    * Lines 87-175 (connection whitelisting logic)
    * Lines 599-621 (ARP assembly)
    * Lines 362-389 (multiple certificate handling)

  Note: Two additional tests for bidirectional IdP-SP filtering were added
  but disabled (_disabled_ prefix) pending investigation of unexpected
  filtering behavior. Documented with TODO comments for future work.

  Test results: 36/36 passing (28 original + 8 new), 176 assertions
@kayjoosten kayjoosten force-pushed the feature/add-coverage-for-pushmetaassembler branch 2 times, most recently from 32f3349 to e375616 Compare February 13, 2026 12:23
@kayjoosten kayjoosten requested a review from johanib February 13, 2026 12:29
@johanib
Copy link
Contributor

johanib commented Feb 17, 2026

LGTM. I'm not that familiar with the actual scenario's being tested. But they seems sensible scenario's based on the assembler code.
My biggest concern is we're testing non-relevant scenario's. But that does not seem to be the case.

Can be merged after the cleanup.

…sembler

  Enables two previously disabled tests for connection whitelisting bidirectional
  filtering logic and corrects their assertions to match actual behavior.

  Changes:

  1. Test 4: test_idp_allowed_connections_filters_out_sps_bidirectionally
     - Converted from inline JSON to fixture file (metadata_idp_bidirectional.json)
     - Fixed misleading comments (claimed "both whitelist IdP1" but had empty whitelist)
     - Clarified scenario: SP with empty allowed_connections gets no IdPs, even
       when IdPs have allow_all_entities

  2. Test 5: test_complex_bidirectional_filtering_with_multiple_entities
     - Fixed incorrect test assertions that expected impossible results
     - Test expected SP3 to have [IdP1, IdP2], but SP3 never whitelisted IdP1
     - Corrected to match actual behavior:
       * SP1 (whitelists IdP1, IdP2) → [IdP1, IdP2] ✓
       * SP2 (allow_all) → [IdP1, IdP3] (IdP2 blocks SP2) ✓
       * SP3 (whitelists IdP2, IdP3) → [IdP2] (IdP3 blocks SP3) ✓
     - Added detailed comments explaining bidirectional filtering behavior

  Root cause: The bidirectional filtering logic in PushMetadataAssembler was
  working correctly. The test assertions had incorrect expectations about how
  SP and IdP whitelists interact.
@kayjoosten kayjoosten force-pushed the feature/add-coverage-for-pushmetaassembler branch from e039892 to 9442ee1 Compare February 19, 2026 09:56
@kayjoosten kayjoosten requested a review from johanib February 19, 2026 09:57
Copy link
Contributor

@johanib johanib left a comment

Choose a reason for hiding this comment

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

👍 Please squash and merge or rebase & fixup first

@kayjoosten kayjoosten merged commit f533dbb into main Feb 19, 2026
2 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.

2 participants