oauth-backend/README.md
2025-06-18 21:09:02 +09:00

73 lines
1.8 KiB
Markdown

# 환경 설정
## Python Virtual Environment
이 프로젝트는 [uv](https://docs.astral.sh/uv/getting-started/installation/)라는 Python 패키지 관리자를 사용하여 설정해야합니다.
uv 설치 후 다음과 같은 명령어를 입력합니다.
```
uv sync
```
## Environment
venv와 패키지가 설치가 됩니다.
.env.example을 복사하여 .env를 붙여넣습니다.
`GOOGLE_ID=`에 봇에서 쓸 구글 계정의 전체 GMail을 기입합니다.
입력하지 않는다면 Google OAuth시 자동적으로 넘어가지 않을 수도 있습니다.
# 실행 방법
```
uv run main.py
```
이러면 http(s)://localhost:11080로 서버가 열리게 됩니다.
http://localhost:11081로 백엔드 서버가 열리게 됩니다.
# 기여 방법
`./addon/init.py`
```py
from example_check import Example
class LoggerAddon:
def __init__(self):
self.checker = Example()
def request(self, flow: http.HTTPFlow): # 비동기가 필요할 경우 async def로 할 것
self.checker.test(flow)
def response(self, flow: http.HTTPFlow): # 비동기가 필요할 경우 async def로 할 것
self.checker.test(flow)
```
`./addon/example.py`
```py
import lib.target as target
from lib.report import save_report
class Example:
async def test(self, flow):
req = flow.request
method = req.method
url = req.pretty_url
# data/report.csv에 저장
report_data = [{
'target': target.load(),
'status': "CRITICAL",
'title': "PKCE Downgrade Vulnerability",
'description': "PKCE downgrade vulnerability detected! Both URLs returned authorization code.",
'uri': f"Original: {url}\nDowngraded: {downgraded_url}"
}]
save_report(report_data)
```
이러한 예제를 참고하여 작성하여주세요.