port label validation doesn't filter invalid characters
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
`Nomad v1.2.6 (a6c6b475db5073e33885377b4a5c733e1161020c)`
### Issue
Any character is accepted in the name parameter of the stanza network. The job is applied without syntax errors and Nomad's GUI even displays the name with special characters.
However, this should not be possible if we refer to the control [here](https://github.com/hashicorp/nomad/blob/main/jobspec/parse.go#L19).
On the other hand, Levant applies the check correctly and raises the syntax error.

#### Expected Result
Port label does not conform to naming requirements ^[a-zA-Z0-9_]+$
#### Actual Result
No issue is raised. Job is applied without errors.
### Job file (if appropriate)
```
network {
port "myport,#!)'8" {
to = 8080
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in jobspec/parse.go, then trace how the network stanza's port label is parsed for the supplied job file. Verify the behavior with the example label containing special characters and ensure labels accept only the stated pattern, with invalid input producing a syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100