Azure / Azure/azure-dev

Improve permissions service: caching, nil checks, glob matching

Open
#7,118 0 comments 0 reactions 1 assignee Claimed by @vhvb1989 View on GitHub
area/auth area/security enhancement
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

## Context
Follow-up from [PR #7053](https://github.com/Azure/azure-dev/pull/7053) review. Parent tracking issue: #7112

## PR Conversations
- [Cache permission results](https://github.com/Azure/azure-dev/pull/7053#discussion_r2927943744) (@tg-msft)
- [Remove unnecessary nil checks before range](https://github.com/Azure/azure-dev/pull/7053#discussion_r2927966830) (@tg-msft)
- [Use glob matching library](https://github.com/Azure/azure-dev/pull/7053#discussion_r2927991043) (@tg-msft)

## What needs to change
1. **Caching**: Add caching to the permissions service — permissions are unlikely to change during an azd session.
2. **Nil checks**: Remove unnecessary `nil` checks before `range` statements — `range` over a nil slice is a no-op in Go.
3. **Glob matching**: Consider using a glob matching library instead of the custom `wildcardMatch` implementation to avoid maintaining custom logic if assumptions change.

## Files to update
- `cli/azd/pkg/azapi/permissions.go`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.