Repository navigation
fix(security)!: require JWT authentication for admin APIs - #144
alexlovelltroy wants to merge 6 commits into
Conversation
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
synackd
left a comment
There was a problem hiding this comment.
Reviewed the authentication boundary, failure behavior, documentation, and dependency changes. The middleware placement and WireGuard private-key log removal look correct. The comments below cover the remaining security policy question and client/documentation gaps.
Upstream CI passes, including race tests and vulnerability checks. Local tests passed for the packages that ran, including pkg/wgtunnel, but the full suite could not complete because the FlatBuffers dependency download failed, including after retrying with network access.
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
| } | ||
| }, | ||
| "smdclient.OpenCHAMINodeWithGroups": { | ||
| "type": "object" |
There was a problem hiding this comment.
This generated definition describes the simulator node request body as an empty object. The simulator node response type is also generated as only:
{"type": "object"}The actual request model includes groups and embeds OpenCHAMIComponent, which includes node identity and network fields such as ID, mac, ip, and wgip. These definitions are used by the newly documented simulator POST/PUT requests and GET response, so consumers of /openapi.json cannot discover those fields, and generated clients may expose only untyped objects.
Could we fix schema generation so both definitions include their actual fields, regenerate the checked-in Swagger artifacts, and extend the contract test to assert representative properties such as ID, ip, and groups?
|
I think after the item above, this should be good to go. |
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
Description
This pull request introduces strict JWT-based authentication for all
/admin/API routes, ensuring that administrative operations are protected and unavailable if JWT verification cannot be configured or fails. Node bootstrap and non-admin endpoints remain accessible without tokens. The PR also updates documentation and adds comprehensive tests to validate the new authentication boundary and failure modes.Admin authentication and API protection:
/admin/APIs now require a bearer JWT, enforced via a middleware (adminJWTMiddleware). If the JWT verifier is unavailable or misconfigured (e.g., missing or empty JWKS), admin endpoints return HTTP 503, but non-admin endpoints (e.g., node bootstrap) remain accessible. [1] [2] [3] [4]sub,iss,aud) and only accepts tokens from theAuthorizationheader (not cookies or query parameters), preventing ambient credential use. [1] [2]Testing and validation:
Documentation and usage guidance:
README.mdto document the new requirement for bearer JWTs on all/admin/endpoints, including examplecurlcommands with theAuthorizationheader and a pointer to detailed admin authentication and upgrade guidance. [1] [2] [3] [4] [5]Other improvements:
These changes collectively harden the security boundary for administrative operations, provide clear operator guidance, and ensure robust, test-driven enforcement of the new authentication requirements.
Checklist
make test(or equivalent) locally and all tests passgit commit -s) with my real name and email<filename>.licensesidecarLICENSES/directoryType of Change