project Websites / Gitlab Issue Listing Script avatar

websites/Gitlab-Issue-Listing-Script#37: Issue page may break with "Commit Not Found" when project filtering active



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.4
Created: 23-Apr-22 09:37



Description

When project filtering and enhanced commits are active, for example

    public $enforce_explicit_limits = true;
    public $permitted_projects = array(
        "jira-projects/FKAMP",
        "jira-projects/MISC",
        "jira-projects/ADBLK",
        "jira-projects/HLS",
        "misc/docker-gitphp",
        "websites/Gitlab-Issue-Listing-Script",
        "websites/privacy-sensitive-analytics",
        "websites/videos.bentasker.co.uk"
    );

    public $enhanced_commit_notifications = true;

Issue pages may break if they contain a commit notification from a project not included in $permitted_projects.



Issue Links

Toggle State Changes

Activity


assigned to @btasker

In hindsight, this was an obvious outcome...

When enhanced commit notifications are active, for each commit notification we detect we call getCommit()

However, like most other methods, that applies project filters

    function getCommit($proj_path, $commit_h){
        global $config;

        if (!$this->enforceProjectFilters($proj_path)){
            http_response_code(404);
            echo "Commit Not found";
            die;
        }        

Which results in our page being killed

We can add a variable to the signature that allows us to disable that check, but we'll then fail at a later stage (as getCommit() calls getProject()) so we need to pass that on through

verified

mentioned in commit f10dd163620f519494ff17f674c77af154034f4b

Commit: f10dd163620f519494ff17f674c77af154034f4b 
Author: B Tasker                            
                            
Date: 2022-04-23T10:46:06.000+01:00 

Message

Add internal variable $enforce_filters for websites/Gitlab-Issue-Listing-Script#37

This allows us to conditionally turn off project filtering when necessary - for example, to ensure that we can still display enhanced commit notifications even if the referencing commit isn't in a project in the permitted list

+8 -7 (15 lines changed)

marked this issue as related to #30