GithubHelp home page GithubHelp logo

rits-dajare / daas Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 3.0 60.44 MB

Dajare as a Service(ダジャレ判定 / 評価エンジン)

Home Page: https://rits-dajare.github.io/judge

License: MIT License

Python 99.45% Dockerfile 0.55%
dajare

daas's Introduction

DaaS

CI Twitter

This project's objective is to spread puns posted on RDC official slack's #ダジャレ channel through an official Twitter account.
Automatically determines whether a posted sentence is pun, and if true, gives a star with the rating engine.

Requirements

  • Python ~> 3.9
  • pipenv

Usage

Install dependencies

pip install -U pip
pip install pipenv
pipenv install

Running the application in dev mode

$ pipenv run start

If you want to know the details of how to use this, run the following command.

$ pipenv run help

Running the application in production mode

If you want to specify version, you can see versions here.

docker run -p 8000:8000 ghcr.io/rits-dajare/daas:latest

daas's People

Contributors

averak avatar ran350 avatar ygkn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

daas's Issues

string indices must be integers

問題

町を焦土にしたい衝動ダジャレを入力すると,500エラーが発生する。

レスポンス

{"status": "error", "message": "string indices must be integers"}

ReDoS警察だ!!!!

該当箇所

https://github.com/rits-dajare/DaaS/blob/947e9b9a738beb994c5e8f0369f2f0d6c3fe8354/config/judge_reject_dict.txt#L1

.+「.+」 は脆弱性だ!! 多項式的にステップ数が増加する!!

攻撃例

ジャッジエンジンが数千文字のマッチングを許容しているなら,連続したを入力することで攻撃可能だ!!
マッチング文字数に上限を設定しているなら問題ない!!! このissueはcloseしてくれ!!

import re
import sys
re.search(pattern=r'.+「.+」', string='「'*int(sys.argv[1]))
╰─ time python test.py 3000
python src/c.py 3000  5.71s user 0.03s system 100% cpu 5.729 total

╰─ time python test.py 4000
python src/c.py 4000  16.14s user 0.01s system 100% cpu 16.154 total

解決案

脆弱性の原因は,2つの.の両方がにもマッチし得ることだ!!
だから,代えて [^「]+「.+」 なら大丈夫だ!!

╰─ time python src/c.py 4000
python src/c.py 4000  0.05s user 0.02s system 105% cpu 0.070 total

以上だ!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.