Skip to content

Instantly share code, notes, and snippets.

View ryu22e's full-sized avatar

Ryuji Tsutsui ryu22e

View GitHub Profile
@ryu22e
ryu22e / PoC.md
Last active June 3, 2020 13:57
【memo】PoC for CVE-2020-13254(Potential data leakage via malformed memcached keys)
@ryu22e
ryu22e / Bookmarklet.js
Created May 17, 2020 07:42
[Bookmarklet]Copy as Markdown link
javascript:!function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)}(`[${document.title}](${location.href})`);
@ryu22e
ryu22e / memo.sh
Created April 22, 2020 08:28
GItHub API memop
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
https://api.github.com/repos/ryu22e/django_demo/deployments/${DEPLOYMENT_ID}/statuses \
--data '{"state": "success"}'
@ryu22e
ryu22e / bad-models.py
Last active September 6, 2019 01:15
SQLアンチパターン for Django 2章 ナイーブツリー(素朴な木)
"""悪い例"""
from django.conf import settings
from django.db import models
class Bug(models.Model):
pass
class Comment(models.Model):
@ryu22e
ryu22e / bad-models.py
Last active September 6, 2019 01:14
SQLアンチパターン for Django 1章 ジェイウォーク(信号無視)
"""悪い例"""
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=1000)
account_id = models.CharField(max_length=100) # カンマ区切りでIDを入れる(例: '1,2,3')
@ryu22e
ryu22e / models.py
Last active August 23, 2019 04:03
Djangoの脆弱性CVE-2019-14232・CVE-2019-14233・CVE-2019-14234・CVE-2019-14235について解説(1)
# example/models.py
from django.db import models
from django.contrib.postgres.fields import JSONField
class Example(models.Model):
value = JSONField(verbose_name="値")
enabled = models.BooleanField(verbose_name="有効")
@ryu22e
ryu22e / models.py
Created July 24, 2019 14:33
[WIP]Django path関数を使ったURL定義のやり方(1)
from django.db import models
class Book(models.Model):
title = models.CharField(max_length=50, verbose_name="タイトル")
@ryu22e
ryu22e / nginx-example.conf
Last active July 3, 2019 06:42
Djangoの脆弱性CVE-2019–12781について解説(2)
# 以下gunicornのexampleをベースに作成
# https://github.com/benoitc/gunicorn/blob/master/examples/nginx.conf
# /etc/nginx/sites-available/default を上書きする想定
# 今回の脆弱性の確認に必要な最低限の設定だけ書いているので、本番でこの設定を丸ごとコピーして使わないように!
upstream app_server {
server 127.0.0.1:8000 fail_timeout=0;
}
server {
listen 80;
@ryu22e
ryu22e / settings.py
Last active July 3, 2019 04:32
Djangoの脆弱性CVE-2019–12781について解説(1)
# django_example/settings.py
# 以下を追記
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# http→httpsへのリダイレクトをさせたいなら以下コメントアウトを外す
# SECURE_SSL_REDIRECT = True
@ryu22e
ryu22e / admin.py
Last active June 5, 2019 02:53
Djangoの脆弱性CVE-2019–12308・CVE-2019–11358について解説(1)
from django.contrib import admin
from .forms import PostAdminForm
from .models import Post
class PostAdmin(admin.ModelAdmin):
form = PostAdminForm