Skip to content

Feature "Protected file patterns" in Branch protections doesn't work #25423

Closed
@andy-a2c

Description

@andy-a2c

Description

I'm trying to deny changes into files that match globs .gitea/**/*;.github/**/* using "Protected file patterns" features in Branch protections. But after configuring everything i'm still can modify files

Steps to reproduce:

  1. Create repository
  2. Add file .gitea/workflow/test.yaml with dummy content
  3. Create branch "test/branch"
  4. Go to repository settings -> Branches and add new Branch protection rule
  5. Define following Branch protection configuration:
  • Protected Branch Name Pattern: test/branch
  • Enable push: (checked)
  • Protected file patterns (separated using semicolon ';'): .gitea/**/*;.github/**/*
  • Other settings should be with default configuration
  1. Save Branch protection rule
  2. Go to branches list page to verify that Branch protection rule applied to branch "test/branch". It should have shield icon before name
  3. Go to Code. Select "test/branch" and navigate to .gitea/workflow/test.yaml file
  4. Press Edit file
  5. Do any modifications in file content
  6. Commit changes directly to "test/branch"

Expected behaviour:
Changes shouldn't be saved, since file protected by Branch protection rule. Edit page have warning message that this file couldn't be edited since Branch pretection rule deny this

Actual behaviour:
Changes saved

Gitea Version

1.19.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Ubuntu 22.04

How are you running Gitea?

Binary release was installed and managed by systemd service

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/not-a-bugThe reported issue is the intended behavior or the problem is not inside Gitea

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions