최소 권한 원칙

Principle of least privilege

작업에 필요한 권한만 부여해 계정이나 서비스가 침해됐을 때 피해 범위를 줄입니다.

···
html
<div class="demo"><div class="head"><b>LEAST PRIVILEGE</b><span>role: READER</span></div><div class="scene"><div class="role">READER<br><small>read only</small></div><div class="arrow">→</div><div class="actions"><div id="read">READ <b>ALLOW</b></div><div id="write">WRITE <b>DENY</b></div><div id="delete">DELETE <b>DENY</b></div></div></div><div class="foot"><span id="caption">checking READ</span><span>tap to check</span></div></div>
css
.demo{width:min(94vw,690px);height:min(86vh,310px);padding:clamp(10px,2.4vmin,20px);border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:clamp(7px,2vmin,14px);font:600 clamp(9px,2.5vmin,15px)/1.3 ui-monospace,monospace}.head,.foot{display:flex;justify-content:space-between;gap:8px}.head b{color:var(--accent)}.head span,.foot,small{color:var(--muted)}.foot{font-size:.82em}.scene{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;gap:clamp(7px,2vmin,18px)}.role{border:1px solid var(--accent);border-radius:8px;background:color-mix(in srgb,var(--accent) 12%,var(--surface));padding:.8em;min-width:30%;text-align:center}.role small{display:block;font-size:.78em;margin-top:.4em}.arrow{color:var(--accent);font-size:1.7em}.actions{width:45%;display:grid;gap:clamp(5px,1.4vmin,9px)}.actions div{border:1px solid var(--line);border-radius:6px;background:var(--bg);padding:.48em;display:flex;justify-content:space-between;gap:4px;opacity:.45;transition:opacity .2s,border-color .2s}.actions div.on{opacity:1;border-color:var(--accent)}.actions div.denied{border-color:var(--accent-3)}.actions b{color:var(--muted)}.actions div.on b{color:var(--accent)}.actions div.denied b{color:var(--accent-3)}
js
const actions=['read','write','delete'];let step=0;function check(){actions.forEach((action,i)=>{const el=document.getElementById(action);el.classList.toggle('on',i===step);el.classList.toggle('denied',i===step&&i>0)});document.getElementById('caption').textContent='checking '+actions[step].toUpperCase()+' · '+(step===0?'allowed':'denied');step=(step+1)%3}check();const timer=setInterval(check,700);document.querySelector('.demo').addEventListener('pointerdown',()=>{clearInterval(timer);check()})

최소 권한 원칙은 주체가 지금 수행해야 하는 작업에 필요한 권한만 가지게 하는 설계입니다. 읽기만 하는 서비스에 삭제 권한까지 주면 자격 증명이 유출됐을 때 피해가 커집니다.

데모는 읽기 전용 역할이 READ 요청은 통과시키고 WRITE·DELETE 요청은 막는 모습을 보여줍니다. 권한은 역할뿐 아니라 대상 리소스와 상황에도 맞춰 검사하고, 필요 없어진 권한은 회수해야 합니다.

언제 쓰나

사용자 역할, API 토큰, 서비스 계정, 데이터베이스 계정의 권한을 정할 때 적용합니다.

페이지로 열기 ↗