Scan your whole stack
From OX Research Newsroom
Are you using pxa-auth?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.133.0
pxa-auth was last scanned on 29 Nov 2026 at version 0.133.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.133.0 LATEST | 29 Nov 2026 | No rules fired |
Findings for v0.133.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.133.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
PXA 인증 처리 패키지. Opaque Token(무작위 문자열) + Redis + HttpOnly 쿠키 방식입니다.
단독 사용 가능 — 다른 pxa 패키지에 의존하지 않습니다. 의존성은
fastapi,redis뿐입니다. 설정 관리와 응답 포맷은 개발자의 몫이고, pxa-auth 는 그 두 가지만 주입받아 동작합니다.
pip install pxa-auth
pip install "pxa-auth[common]" # pxa-common 과 함께 쓸 때(어댑터)
개발자가 할 일은 ① 설정 채우기 ② 로그인 검증 콜백 구현 둘 뿐입니다. 사용자 테이블이 표준 형태라면 ②도 필요 없습니다 — 7장 참고.
from fastapi import Depends, FastAPI
from pxa_auth import (AuthSettings, init_auth, build_auth_router,
current_user, register_auth_error_handler)
# ① 설정 — 값의 출처(YAML/환경변수/DB)는 개발자가 알아서 정한다
init_auth(AuthSettings(
cookie_secure=False, # 로컬 개발(HTTP)
session_ttl_seconds=1800,
redis_host="localhost",
))
# ② 로그인 검증 콜백 — 도메인 로직
def authenticate(username: str, password: str):
user = find_user(username) # 개발자의 DB 조회
if user and verify_password(password, user.password_hash):
return {"username": user.username, "roles": ["user"]}
return None # 실패 -> pxa-20003
app = FastAPI()
register_auth_error_handler(app) # 인증 예외 -> 응답 변환
app.include_router(build_auth_router(authenticate))
@app.get("/orders")
def orders(user: dict = Depends(current_user)): # 인증 강제
...
기본 제공 엔드포인트: POST /auth/login, POST /auth/logout, GET /auth/me
AuthSettings)pxa-auth 는 설정 파일을 읽지 않습니다. 개발자가 자신의 설정 체계에서 값을 꺼내 넣어 주면 됩니다.
| 항목 | 기본값 | 설명 |
|---|---|---|
cookie_name |
PXA_SESSION |
세션 쿠키 이름 |
cookie_secure |
True |
운영(HTTPS)은 True |
cookie_samesite / cookie_domain / cookie_path |
lax / None / / |
쿠키 속성 |
session_ttl_seconds |
3600 |
세션 TTL(초) |
token_bytes |
32 |
opaque token 길이 |
key_prefix |
pxa:session: |
Redis key 접두어 |
redis_url / redis_host / redis_port / redis_db / redis_password |
– | Redis 접속 |
messages |
{} |
기본 메시지 재정의 |
cfg = my_yaml_loader("config.yaml") # 개발자의 config 구현
init_auth(AuthSettings(redis_host=cfg["redis"]["host"]))
init_auth(settings, redis_client=my_redis) # Redis 클라이언트 직접 주입도 가능
Responder 주입)응답 규격을 강제하지 않습니다. 기본은 최소 dict 이고, 원하는 포맷의 Responder 를 주입하면 됩니다.
# 기본(DictResponder)
{"success": true, "code": "pxa-10000", "message": "로그인 되었습니다.", "result": {...}}
class MyResponder:
def ok(self, result=None, message=None):
return {"status": "OK", "data": result, "msg": message}
def fail(self, code, message, result=None):
return {"status": "ERROR", "reason": code, "msg": message}
init_auth(settings, responder=MyResponder())
어댑터를 명시적으로 한 줄 호출하면 표준 envelope(ApiResponse)와 AppCode 로 응답합니다. 자동 감지 같은 암묵적 동작은 없습니다.
from pxa_auth.integrations.pxa_common import use_pxa_common
init_auth(settings)
use_pxa_common(app) # 응답 포맷 전환 + AuthError -> 표준 에러응답 핸들러 등록
pxa-20003 등 코드 문자열은 AppCode 로 매핑되고, 프론트가 받는 응답 형태는 다른 pxa 서비스와 동일해집니다.
Set-Cookie 헤더에 실어 전달 (JS 접근 차단)토큰은 의미 없는 무작위 문자열이라 본문에 노출되지 않고, 사용자 정보도 담기지 않습니다.
from pxa_auth import hash_password, verify_password
user.password_hash = hash_password("평문")
verify_password("평문", user.password_hash) # True
표준 라이브러리 PBKDF2-HMAC-SHA256(200k iterations, salt 포함)을 사용합니다.
사용자 정보는 DB 에 저장하며 기본 DB 는 PostgreSQL 입니다. UserDbSettings.dialect 만 바꾸면 MariaDB 등으로 교체되고, 사용자 코드는 그대로입니다. 이 설정은 공통기능이 제공하는 값이므로 주니어 개발자가 바꾸지 않습니다.
from pxa_auth import AuthSettings, UserDbSettings, build_auth_router, init_auth
init_auth(
AuthSettings(redis_host="localhost"),
user_db=UserDbSettings( # 기본 postgresql
host="db", user="app", password=..., database="appdb",
),
)
app.include_router(build_auth_router()) # authenticator 를 넘기지 않으면 DB 인증
pip install "pxa-auth[userdb,postgresql]" # 기본
pip install "pxa-auth[userdb,mariadb]" # dialect="mariadb"
pip install "pxa-auth[userdb,odbc]" # connector="odbc"
| 설정 | 기본값 | 설명 |
|---|---|---|
dialect |
postgresql |
postgresql / mariadb / mysql / mssql |
connector |
native |
native / odbc |
table |
pxa_user |
사용자 테이블 |
username_column / password_column |
username / password_hash |
컬럼 매핑 |
active_column |
is_active |
비활성 계정 차단 (None 이면 검사 안 함) |
session_columns |
("id","username","roles") |
세션에 담을 컬럼 |
기대하는 테이블 형태:
CREATE TABLE pxa_user (
id INT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
roles VARCHAR(100),
password_hash VARCHAR(255) NOT NULL, -- hash_password() 결과
is_active BOOLEAN NOT NULL DEFAULT TRUE
);
보장되는 동작:
is_active=false)은 로그인할 수 없습니다.DB 가 아닌 LDAP/SSO 를 쓰려면 find_by_username(username) -> dict | None 하나만 구현해 init_auth(user_store=...) 로 주입하면 됩니다. authenticator 콜백을 직접 넘기는 기존 방식도 그대로 동작합니다.
pytest 는 외부 서버 없이 fakeredis 와 인메모리 사용자 저장소로, 다른 pxa 패키지 없이 통과합니다.
pip install -e ".[dev]"
pytest
실 서버 연동은 pytest 와 분리된 검증 스크립트로 확인합니다.
python scripts/verify_redis_session.py # 실 Redis: 로그인→쿠키→보호API→로그아웃
python scripts/verify_user_db.py # 실 MariaDB: dialect/connector 교체 검증
python -m build && twine check dist/*
twine upload dist/*
Apache License 2.0 — 자세한 내용은 LICENSE 를 참고하세요.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.