aws-samples / aws-samples/sample-agent-assisted-sdlc

feat: label-governance hook should enforce an allowlist of agent-settable labels

Open
#76 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
42
Forks
9
PR merge metrics
No merged PRs in 30d

Description

## Description

The `label-governance.sh` hook currently only blocks `agent:start` (prevents infinite re-invocation). But the agent can add any other label — including ones that don't exist or aren't meaningful (e.g. `agent:pr`, `agent:foo`).

## Observed

The agent added `agent:pr` which is not a recognized pipeline label. It should only be allowed to set labels from a defined allowlist.

## Proposed

Add an allowlist to `label-governance.sh`. Only labels matching the allowed set pass; anything else with the `{LABEL_PREFIX}:` prefix is blocked.

**Suggested allowlist:**
- `agent:explore`
- `agent:implement`
- `agent:critique`
- `agent:done`
- `agent:blocked`
- `agent:clarification`

Any label not in this list that starts with `agent:` should be blocked with exit 2.

## Files

- `coding-assistants/claude-code/plugin/hooks/label-governance.sh` — add allowlist logic
- `test/hooks/test_hooks.sh` — add test cases for allowed/blocked labels
- `sdlc-config.template.yaml` — optionally make the allowlist configurable

## Constraints

- Keep `agent:start` as the hard-block (current behavior)
- The allowlist should be configurable via env var or config (so different projects can customize)
- Labels without the `agent:` prefix are always allowed (team labels, GitHub defaults, etc.)

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.