Skip to content

IAM fixes & features - #84

Merged
MZC-CSC merged 19 commits into
m-cmp:mainfrom
MZC-CSC:develop
Jun 5, 2026
Merged

MZC-CSC merged 19 commits into
m-cmp:mainfrom
MZC-CSC:develop

Conversation

@dogfootman

@dogfootman dogfootman commented Jun 5, 2026 •

Copy link
Copy Markdown
Member

Summary

setup 스크립트 개선 및 버그 수정
api 호출에서 관리용 api 권한을 manager 에서 write 레벨로 완화

Changes

Bug Fixes

  • fix(setup): init_predefined_roles JSON payload role_types → roleTypes (camelCase) 수정 — viewer/billviewer platform role_sub 미생성 버그 (#111)
  • fix(IAM): admin role이 organizations/groups 관리 가능하도록 권한 완화 (platformAdmin-only 해제)
  • fix(IAM): admin role이 사용자 비밀번호 재설정 가능하도록 권한 완화
  • fix(IAM): user CRUD 라우트 권한을 Write 레벨로 완화
  • fix(IAM): GetUserByID에서 Keycloak 필드 unset 시 nil pointer dereference 수정 (#109, #110)
  • fix(conf): preset/setup 스크립트 개선사항 backport from mc-admin-cli (#108)

yh-noh and others added 19 commits May 28, 2026 16:40
… 처리 추가

- IAM-BUG-006: DeleteUser, UpdateUser @router 어노테이션 /api/users/{id} → /api/users/id/{userId} 수정
  실제 Echo 라우트(/api/users/id/:userId)와 일치시켜 프록시 404 해결
- IAM-BUG-006: service-actions.yaml deleteUser, updateUser resourcePath 동일 수정
- IAM-BUG-007: CreateUser handler에서 "already exists" 에러 감지 시 500 대신 409 반환
- DeleteUser/UpdateUser 경로 수정 반영 (/api/users/{id} → /api/users/id/{userId})
- mzc-csc/develop에 누락된 API 경로 51개 복원 (company, csp-accounts, invitations 등)
- May 21 이후 코드 변경분 docs 동기화
- CspRoleService에 CspIdpConfigRepository 의존성 추가
- findActiveAwsOidcConfig 헬퍼 추가: GetActiveConfigs + IsOIDC + CspType=aws 필터
- createNewAwsCredential: OS env(MC_IAM_MANAGER_AWS_IDENTITY_*) 제거 →
  IDP Config DB의 role_arn 조회 (getIAMClient와 동일 패턴)
- dead variable identityProviderArn 제거
  (AssumeRoleWithWebIdentityInput에 provider ARN 파라미터 없음)
- oidc_provider_arn은 로깅 확인용으로만 사용

ref: IAM-TECH-002
설정 누락 감지를 앞당겨 Keycloak 호출 전에 즉시 에러 반환.
…ml (IAM-BUG-006)

src/docs/swagger.yaml was not updated in commit 758b702 when DeleteUser/UpdateUser
swagger annotations were fixed. This commit:
- Regenerates src/docs/{docs.go,swagger.json,swagger.yaml} via swag init
- Regenerates asset/mcmpapi/service-actions.yaml and conf/mc-iam-manager/service-actions.yaml
  via swagger-to-actions, now using correct /api/users/id/{userId} paths for deleteUser/updateUser
…ml (IAM-BUG-006)

fix(M2-USER): sync src/docs swagger and regenerate service-actions.yaml (IAM-BUG-006)
fix(csp-role): createNewAwsCredential env var → IDP Config DB 조회로 전환
0_preset_dev.sh:
- Replace source with safe line-by-line env parser (handles multi-word values)
- Add IP vs hostname detection (IS_IP flag) to skip /etc/hosts for IP domains
- Add SAN (subjectAltName) to self-signed cert via openssl -extfile
- Update error messages to reference cleanAll.sh

0_preset_prod.sh:
- Add set -euo pipefail for script safety
- Add mkdir/cp failure error messages
- Add 5 missing port substitutions: MC_COST_OPTIMIZER_BE_PORT,
  MC_COST_OPTIMIZER_ALARM_PORT, MC_WORKFLOW_MANAGER_PROXY_PORT,
  MC_DATA_MANAGER_PROXY_PORT, MC_APPLICATION_MANAGER_PROXY_PORT
- Remove outdated MC_COST_OPTIMIZER_FE_PORT substitution

0_preset_local.sh + nginx.template.local.conf:
- Replace heredoc nginx.conf generation with nginx.template.local.conf approach
- Add dual .env support (project root + script dir)
- Add safe line-by-line env parser
- Add required var validation, nginx dir permission check

1_setup_auto.sh:
- Rename MCADMINCLI_APIYAML → MC_ADMIN_CLI_APIYAML (prefix standardization)
- Add Step 5-2: update_public_service_urls() call
- Add update_public_service_urls() function for iframe FE public URL registration

1_setup_manual.sh:
- Rename MCADMINCLI_APIYAML → MC_ADMIN_CLI_APIYAML
fix(conf): backport preset/setup script improvements
… are unset

Keycloak optional fields (Email, FirstName, LastName, Enabled, Username) are
*string/*bool pointers and may be nil for users who didn't fill in all profile
fields. Direct dereference caused panic in AssignPlatformRole flow.

Replace raw dereference with existing ptrStr/ptrBool helpers, consistent with
how GetUsers() in the same file already handles these fields.
… are unset (#109)

Keycloak optional fields (Email, FirstName, LastName, Enabled, Username) are
*string/*bool pointers and may be nil for users who didn't fill in all profile
fields. Direct dereference caused panic in AssignPlatformRole flow.

Replace raw dereference with existing ptrStr/ptrBool helpers, consistent with
how GetUsers() in the same file already handles these fields.
…d without roleName

When AssignPlatformRole receives only userId+roleId (without roleName), Keycloak
operations fail because the role name is required. Look up the role name from DB
using roleId so callers don't need to supply it explicitly.
…404 on role removal

- CreateUser: delete KC user when DB insert fails (was TODO comment)
- RemovePlatformRole: skip KC rollback when KC user is already gone (404)
  so DB cleanup can proceed even if KC state is stale
CreateUser/UpdateUser/DeleteUser/UpdateUserStatus/ResetUserPassword required
platformAdmin-only (Manage). Changed to Write so admin-role users can also
perform user management operations, consistent with checkRoleFromContext logic.
CreateRoleRequest 모델이 json:"roleTypes" (camelCase)를 기대하는데
1_setup_auto.sh의 init_predefined_roles 함수에서 role_types (snake_case)로
전송해 바인딩이 되지 않아 viewer/billviewer가 platform role_sub 없이
workspace only로 생성되는 버그 수정.

결과: viewer, billviewer도 platform/workspace 양쪽 role_sub이 정상 생성되어
assignPlatformRole, listRoles platform 필터가 정상 동작함.
fix(setup): camelCase roleTypes in init_predefined_roles JSON payload
@MZC-CSC MZC-CSC changed the title feat: sync MZC-CSC/develop to m-cmp/main (IAM fixes & features) IAM fixes & features Jun 5, 2026
@MZC-CSC
MZC-CSC merged commit 87149e7 into m-cmp:main Jun 5, 2026
3 checks 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.

3 participants