github / github/codeql

False positive: "Missing function level access control" where public endpoint name contains "Edit"

Aperta
#21,042 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
C# false-positive
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

**Description of the false positive**

We have a .NET 8 Api.

We have a controller method that has the characters 'Edit' in it, but the whole word is not Edit. This causes the method to be marked with the rule cs/web/missing-function-level-access-control. The method even has the 'AllowAnonymous' attribute on it.

**Code samples or links to source code**

```
[AllowAnonymous]
public async Task TestEditionAsync(){

}
```

Is there a way to get this alert resolved?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the CodeQL rule cs/web/missing-function-level-access-control and reproduce the report using the provided .NET 8 controller example. The issue is resolved when a public method named TestEditionAsync with AllowAnonymous is no longer flagged solely because its name contains Edit.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
security
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.