Add end-to-end regression test harness for GitHub-style authorization and PR lifecycle (SZ-116)
rk@tigase.net opened 3 days ago

Description

The introduction of GitHub-style authorization significantly increased the behavioral surface area of Sztab. Authorization decisions now depend on several interacting dimensions:

  • project visibility (PRIVATE, INTERNAL, PUBLIC)
  • project membership and roles
  • project type (LOCAL / EXTERNAL)
  • personal access tokens (global vs project-scoped)
  • user type (internal vs external)
  • Git access through the Caddy forward_auth gateway

Manual verification of all combinations is no longer scalable or reliable.

These authZ changes ntroduced a multi-dimensional access model that is difficult to test manually.

Without automated regression coverage:

  • subtle authorization regressions could go unnoticed
  • Git access paths through Caddy could break silently
  • PR workflows could regress for external repositories

We need a automated regression test mechanism that provides a repeatable system-level validation tool for the new authorization architecture.

  • rk@tigase.net changed state to 'In Progress' 3 days ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 3 days ago

    This issue introduces a Bash-based end-to-end regression test harness that exercises the system using real API calls and Git operations.

    The test path validates the full stack:

    git client
      =>Caddy reverse proxy
        => forward_auth
          => GitAuthController
            => authorization service
              => database
                => Sztabina Git service
    

    The script executes two complementary test suites.


    Suite A — Pull Request lifecycle regression

    Validates that PR creation and merge workflows continue to work correctly after the authorization changes.

    Coverage

    Project types:

    • LOCAL (Sztabina-hosted repositories)
    • EXTERNAL repositories

    Merge strategies:

    • merge commit
    • fast-forward
    • squash
    • rebase

    For LOCAL repositories the script:

    1. clones the repository via Git
    2. creates a feature branch
    3. pushes a commit
    4. registers the branch in Sztab
    5. creates a pull request
    6. auto-approves the PR
    7. merges using each strategy

    For EXTERNAL repositories the script:

    • discovers existing branches
    • creates and merges PRs without pushing new commits

    This ensures that the PR pipeline works for both internal and external repository types.


    Suite B — Authorization regression

    Validates Git access control across the full authorization matrix.

    Git access is tested by hitting the actual Git endpoint through Caddy:

    /git/{project}.git/info/refs?service=git-upload-pack
    

    This ensures that authorization is validated through the real request path instead of bypassing the reverse proxy.

    Tested dimensions

    User types:

    • anonymous
    • internal authenticated user
    • external user

    Project visibility:

    • PRIVATE
    • INTERNAL
    • PUBLIC

    Token scope:

    • global PAT
    • project-scoped PAT

    Expected access model

    ScenarioExpected
    Anonymous => PRIVATE401
    Anonymous => INTERNAL401
    Anonymous => PUBLIC200
    Internal user (global PAT) => any project200
    Internal user (scoped PAT) => own project200
    Internal user (scoped PAT) => other project403
    External user => PRIVATE403
    External user => INTERNAL403
    External user => PUBLIC200

    This suite verifies that the GitHub-style authorization rules are correctly enforced.


    Additional capabilities

    The regression harness also includes:

    • automatic environment setup checks (curl, git, jq)
    • session-cookie authentication
    • automatic project cleanup
    • optional external user tests
    • direct Git command integration
    • database cleanup fallback for failed test runs

  • rk@tigase.net commented 3 days ago

    Time Log

    ActivityTime
    Design regression test strategy and test matrix1h
    Implement Bash test harness structure and utilities45m
    Implement PR lifecycle tests for LOCAL repositories1h30m
    Implement EXTERNAL repository PR tests30m
    Implement Git access authorization tests via Caddy45m
    Implement PAT scope validation and user-type scenarios1h
    Debugging and cleanup handling1h

    Total: ~5 hours

  • rk@tigase.net changed state to 'Closed' 3 days ago
    Previous Value Current Value
    In Progress
    Closed
issue 1 of 1
Type
Task
Priority
Major
Assignee
Version
1.10.0
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-116
Please wait...
Page is in error, reload to recover