Skip to content

Title: feat: Issue CSP temporary credentials from the user menu, require tokens on API proxy routes - #113

Merged
MZC-CSC merged 16 commits into
m-cmp:developfrom
MZC-CSC:develop
Oct 25, 2026
Merged

MZC-CSC merged 16 commits into
m-cmp:developfrom
MZC-CSC:develop

Conversation

@MZC-CSC

@MZC-CSC MZC-CSC commented Oct 23, 2026

Copy link
Copy Markdown
Member

What's Changed

CSP Credentials — issue temporary credentials from the user menu

Temporary credentials are issued for the CSP role mapped to the user's role in the current workspace (direct assignment first, then group). Because this does not depend on a node, the entry point is the navbar user menu: CSP Credentials.

  • Request step: shows the current workspace and the user's console role. The CSP list contains only CSPs mapped for that role (GET /api/users/me/workspace-roles → GET /api/roles/csp-roles/id/{roleId}, status=created with IdP/IAM identifiers set). Region is required (AWS AssumeRole fails without it); the choices come from the connection configs of the selected CSP, and ap-northeast-2 is the default when available
  • Result step in the same modal: expiration, time left, and one block of standard CLI/SDK environment variables for the CSP (AWS: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_DEFAULT_REGION; Alibaba, Tencent and GCP equivalents). Values are hidden by default; Show/Hide, Copy (copies the actual values) and Back are available. Values live only in memory and are cleared when the modal closes
  • The mapped CSP role name is not shown in the console; it is managed in role management
  • New mc-iam-manager service actions in conf/api.yaml: GetTemporaryCredentials (POST /api/workspaces/temporary-credentials) and GetMyWorkspaceRoles (GET /api/users/me/workspace-roles)
  • commonAPIPost options: sensitive (request/response bodies are not logged) and silentErrors (the caller shows every HTTP error itself)

Node detail — Keypair badge

The Keypair badge on the Node / NodeGroup detail called a function that does not exist (infra_api.getsshkey), so nothing happened. It now uses sshkey_api.get and a secret modal: the private key is hidden (PEM header and length only), with Show/Hide and Copy.

API proxy and BFF routes — token verification

  • Add ProxyAuthMiddleware. With MC_WEB_CONSOLE_USE_IAM=true, it verifies the RS256 signature and expiry with mc-iam-manager JWKS (/api/auth/certs; public keys cached by kid, an unknown kid is re-fetched at most every 30 seconds). With false, it keeps the existing HS256 + DB session check
  • Accepts both Authorization: Bearer <token> and the raw token (the format the front ApiCaller sends). role is not set in the context, so how the proxy chooses x-credential-holder does not change
  • README: the API (port 3000) is a public API that other frameworks also call with a token from /api/auth/login, and every route requires a token

Requires mc-iam-manager 0.7.1 or later (/api/users/me/workspace-roles, /api/workspaces/temporary-credentials). mc-admin-cli mounts its own copy of the web API conf/; the new service actions are in MZC-CSC/mc-admin-cli#106 (restart mc-web-console-api after applying).

yh-noh and others added 16 commits October 14, 2026 14:09
- ProxyAuthMiddleware 추가: IAM 모드는 mc-iam-manager /api/auth/certs(JWKS)로 RS256 서명·만료 검증, 로컬 모드는 HS256+세션 검증
- 프록시(/api/:subsystem/:operationId), /api/admin, disklookup, getapihosts, async-requests, /api/test/* 에 적용
- Authorization 헤더는 Bearer와 토큰 원문(front ApiCaller 형식) 모두 허용
- README에 API(3000)가 공개 API이며 모든 라우트에 access_token이 필요함을 명시
mc-web-console v0.7.0 릴리스가 mc-iam-manager v0.7.0과 함께 배포되도록 conf/api.yaml에 기록된 mc-iam-manager version을 0.6.4에서 0.7.0으로 맞춘다.
chore: conf/api.yaml의 mc-iam-manager 버전을 0.7.0으로 갱신
- 화면 진입 시 전체 메뉴(Getmenuresources)와 사용자 메뉴(GetAllAvailableMenus)를 대조해, 메뉴 화면인데 사용자 메뉴에 없으면 /auth/unauthorized#menuNotAllowed 로 이동
- 메뉴 URL 은 사이드바와 같은 규칙(iframe: /_view/{id}, local: path 또는 메뉴 id 경로)으로 계산, 메뉴가 아닌 화면은 대상 아님
- 로그인 직후 기본 화면(Infra Workloads)이 사용자 메뉴에 없으면 사이드바 순서상 첫 메뉴 화면으로 이동
- 메뉴 목록은 60초 캐시, 조회 실패 시 화면을 막지 않고 로그만 남김
- 사용자 메뉴에 화면 메뉴가 하나도 없으면(가입 승인 직후 그룹·역할 미배정) 기본 화면·메뉴 화면 진입 시 /auth/pending 으로 이동
- /auth/pending: 안내 문구와 Change Password(기존 모달·changepassword.js 재사용), Logout 제공
- 메뉴 0개 사용자 단위 테스트 추가
fix: 사용자 메뉴에 없는 화면 URL 직접 접근 차단 및 역할 배정 대기 화면 추가
…ct form ids

- nodeGroupSize/evaluationPeriod parseInt, operand parseFloat
- omit rootDiskSize when empty (tumblebug default 0 = CSP default)
- validate Operand / Root Disk Size before request
- read #policy_placementAlgo, #policy_command, #policy_username and send policy description
fix: Infra Scale Policy 생성 시 숫자 필드 타입 변환 및 폼 id 불일치 수정
Create Data Disk 요청에 zone 이 없어, connection 에 기본 zone 이 없는 Azure 는
zone 없는(regional) disk 로 생성되고 zone 이 정해진 node 에 attach 되지 않았다
("Disk ... cannot be attached to the VM because it is not in zone '1'").

- Create Data Disk 모달에 Zone select 추가: 선택한 connection 의
  regionDetail.zones 로 목록을 채우고 regionZoneInfo.assignedZone 을 기본 선택
- zone 은 있는데 connection 기본 zone 이 없으면(Azure) Zone 필수, 비우면 요청하지 않음
- 그 외에는 비워 두면 zone 필드 없이 기존과 동일하게 요청
- Disk 목록·상세에 Zone 표시
- Attach 팝업에서 node zone 표시, disk zone 과 다르거나 disk 에 zone 이 없으면 안내
feat: Disks 화면 Create Data Disk 에 Zone 선택 추가
fix: API 서브시스템 프록시·BFF 라우트 보완
- Add "Get CSP Credential" to the Node / NodeGroup node detail. It issues
  temporary credentials for the node's CSP (provider, region) through
  mc-iam-manager POST /api/workspaces/temporary-credentials with the logged-in
  user's token (new api.yaml action GetTemporaryCredentials).
- Show the result in a shared secret modal: values masked by default,
  Show/Hide, per-field Copy, "Copy as environment variables" (AWS, GCP,
  Alibaba, Tencent), expiration and time left, scope notice (CSP role mapped
  to the workspace role, not the node) and a possible-account-mismatch notice.
  403 "no CSP role mapping" is shown as an actionable message.
- Fix the Keypair badge: it called a non-existent infra_api.getsshkey; use
  sshkey_api.get and the shared modal (masked, Copy, "Not available").
- commonAPIPost: add `sensitive` (do not log request/response bodies) and
  `silentErrors` (caller shows every HTTP error itself) options.
- Secrets live only in modal memory, are cleared on close, and late responses
  after close are ignored.
- Mask by kind: identifiers show the first/last 4 characters
  (e.g. ASIA••••••••WXYZ, fully masked when 8 characters or fewer), secrets
  show only their length ("••••••  (N chars)"), PEM private keys show the
  header line plus length.
- Per-field Show/Hide next to Copy, plus a consistent Show all / Hide all.
- Keep rows for expected fields without a value as "Not provided" with Copy
  and Show disabled. Expected fields are defined per CSP (AWS, Alibaba,
  Tencent, GCP); fields of other CSPs are not shown. Keypair shows Private
  Key, Public Key and Username.
…ce role

- Determine issuable CSPs from my workspace role (GET /api/users/me/workspace-roles,
  new api.yaml action GetMyWorkspaceRoles) and its CSP role mappings
  (Getrolescsproles): status "created" with IdP and IAM identifiers set.
- Show the CSP Credential row on Node / NodeGroup detail only when the node's
  provider is in that set; hide it while loading, on lookup failure or when no
  role is found.
- Cache the result per workspace (re-queried when the workspace changes);
  failures are not cached. Lookups use sensitive / silentErrors / no loader.
- This is a "configured" check, not a guarantee; errors after clicking are
  still shown in the modal. To be replaced when the IAM readiness API lands.
…odal

Temporary credentials are issued for the CSP role mapped to the user's role
in the current workspace, not for a node, so the entry point moves from the
node detail to the navbar user menu ("CSP Credentials").

- Request step: shows the current workspace and the user's console role
  (the mapped CSP role is not shown; it is managed in role management),
  lists only CSPs mapped for that role, and a region picker built from
  connection configs (region is required; AWS AssumeRole fails without it).
- Result step in the same modal: expiration, time left and one block of
  CLI/SDK environment variables per CSP, hidden by default, with Show/Hide,
  Copy (actual values) and Back. Values are cleared when the modal closes.
- Separate from the keypair modal (#secretModal), which stays on the
  Infra Workloads page for SSH keys.
- Remove the node detail "Get CSP Credential" row and its visibility logic.
- csp_credential_api: getCspCredentialAccess returns the user's workspace
  role names and issuable CSP types.
feat: 사용자 메뉴에서 CSP 임시 자격 증명(STS) 발급 + Node 상세 Keypair 모달 수정
@MZC-CSC
MZC-CSC merged commit 7dfb0db into m-cmp:develop Oct 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants