mirror of
https://github.com/j93es/oauth-backend.git
synced 2026-06-04 06:31:51 +09:00
94 lines
2.5 KiB
Markdown
94 lines
2.5 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시 자동적으로 넘어가지 않을 수도 있습니다.
|
|
|
|
---
|
|
|
|
> [oauth-backend](https://github.com/j93es/oauth-backend) 프록시를 사용한다면 이 가이드에 따라 인증서 또한 설정되어야만 합니다.
|
|
>
|
|
> 그렇지 않으면 실행되지 않습니다.
|
|
>
|
|
> 윈도우 환경에서는 `sudo certutil -addstore root mitmproxy-ca-cert.cer`로 인증합니다.
|
|
>
|
|
> Sudo가 활성화되어있지 않은 환경에서는 관리자로 상향된 쉘에서 실행합니다.
|
|
>
|
|
> MacOS 환경에서는 `sudo security add-trusted-cert -d -p ssl -p basic -k /Library/Keychains/System.keychain ~/.mitmproxy/mitmproxy-ca-cert.pem`으로 인증합니다.
|
|
>
|
|
> 다른 플렛폼은 수동으로 설정되어야만 합니다.
|
|
> https://docs.mitmproxy.org/stable/concepts/certificates/
|
|
|
|
---
|
|
|
|
# 실행 방법
|
|
|
|
```
|
|
uv run main.py
|
|
```
|
|
|
|
이러면 http(s)://localhost:11080로 서버가 열리게 됩니다.
|
|
http://localhost:11081로 백엔드 서버가 열리게 됩니다.
|
|
|
|
# 기여 방법
|
|
|
|
`./addon/init.py`
|
|
|
|
```py
|
|
...
|
|
async def request(self, flow: http.HTTPFlow):
|
|
if false_true_varifing_task.is_verifing_false_true():
|
|
return
|
|
|
|
tasks = [
|
|
try_catch(self.google_login_hint.request(flow)) if self.google_login_hint else None,
|
|
try_catch(PKCEDowngradeChecker().test(flow)),
|
|
try_catch(Example().test(flow))
|
|
]
|
|
await asyncio.gather(*tasks)
|
|
...
|
|
```
|
|
|
|
`./addon/example.py`
|
|
|
|
```py
|
|
from lib.report_vuln import report_vuln
|
|
|
|
class Example:
|
|
async def test(self, flow):
|
|
url = req.pretty_url
|
|
|
|
# data/report.csv에 저장
|
|
report_vuln(
|
|
title="PKCE Plain Method",
|
|
desc="PKCE method is set to 'plain'. Possible downgrade.",
|
|
status="CRITICAL",
|
|
uri=url,
|
|
)
|
|
```
|
|
|
|
이러한 예제를 참고하여 작성하여주세요.
|
|
|
|
# 백엔드 API DOCS
|
|
|
|
`uv run main.py`으로 백엔드를 실행한 후에, 다음의 url에 접속합니다.
|
|
|
|
```
|
|
http://localhost:11081/redoc
|
|
```
|