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

Closed
opened 2025-11-02 09:26:49 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @andy-a2c on GitHub (Jun 21, 2023).

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

Originally created by @andy-a2c on GitHub (Jun 21, 2023). ### 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 6) Save Branch protection rule 7) Go to branches list page to verify that Branch protection rule applied to branch "test/branch". It should have shield icon before name 8) Go to Code. Select "test/branch" and navigate to .gitea/workflow/test.yaml file 9) Press Edit file 10) Do any modifications in file content 11) 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
GiteaMirror added the issue/not-a-bug label 2025-11-02 09:26:49 -06:00
Author
Owner

@lunny commented on GitHub (Jun 25, 2023):

Because . and / were considered glob separators, so you can change your pattern to .gitea/**/*.*;.github/**/*.*. Of course, these separators are different from branch names which only use / as separator.

@lunny commented on GitHub (Jun 25, 2023): Because `.` and `/` were considered glob separators, so you can change your pattern to `.gitea/**/*.*;.github/**/*.*`. Of course, these separators are different from branch names which only use `/` as separator.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11073