Skip to content

Instantly share code, notes, and snippets.

View kekyo's full-sized avatar
📡
I'm looking for a job

Kouji Matsui kekyo

📡
I'm looking for a job
View GitHub Profile
@kekyo
kekyo / chibicc-cil-todo.md
Last active April 15, 2024 14:19
chibicc-cil残件
@kekyo
kekyo / csrf.md
Last active December 15, 2023 09:26
CSRF攻撃のまとめ

CSRF(Cross-Site Request Forgery)攻撃について: https://zenn.dev/yktakaha4/articles/study_csrf_attack

要するに、(セッション)トークンをCookieに格納して、これで認証する運用の場合、

  • フォームのPOST先のエンドポイントやWebAPIに対してのHTTPリクエストに、勝手にセッショントークンが送られてしまう(Cookieに入っていて、なおかつ同一のURLだから)。正規のアクセスではこの挙動を想定しているので、受信したトークンで認証が成立して問題ないが...
  • 攻撃者はとにかくブラウザ経由で、フォームのPOST先のエンドポイントやWebAPIに対して要求を投げさせれば、アクセスが受け付けられてしまう(Cookieに格納されているので、勝手にセッショントークンが送られてしまうから)。

だから、Cookieによるトークンの送信に頼らずに、別の方法でリクエストにトークンを含ませる必要がある。

  • HTMLのform hidden valueにトークンを入れておくと、form postでその値が一緒に送信される。これはハイジャック犯がこのトークン値を知ることが出来ないので、トークンなしまたは不正トークンで弾ける。
@kekyo
kekyo / README.md
Last active September 7, 2023 03:18
libvirtでIPv6を有効化する(NAT6)
@kekyo
kekyo / Option.cs
Last active July 21, 2023 08:28
Hacked Option<T> enabling pattern matching on C#
// Copyright (c) Kouji Matsui (@kekyo@mastodon.cloud)
// License under MIT.
using System.ComponentModel;
namespace TestApp;
public static class Option
{
public static readonly NoneOption None =
@kekyo
kekyo / ecma335-iii.1.7.md
Created January 21, 2023 02:21
ecma335-iii.1.7

III.1.7 Restrictions on CIL code sequences

As well as detailed restrictions on CIL code sequences to ensure:

  • Correct CIL
  • Verifiable CIL

There are a few further restrictions, imposed to make it easier to construct a simple CIL-tonative-code compiler. This subclause specifies the general restrictions that apply in addition to this listed for individual instructions.

@kekyo
kekyo / ubuntu-enable-libvirt-bridge.md
Last active June 19, 2022 10:12
Minimal configuration for libvirt environment with bridge interface on ubuntu 22.04 when using nmcli (without netplan)

Example network diagram

Before Configuring

                                    192.168.56.0/24
                                          |
                      192.168.56.1        |        192.168.56.17 (Wired connection 1)
                                |         v         |
The internet --- gateway router *-------------------* (enp1s0) *---- (... app sockets)
@kekyo
kekyo / Creator_CI20.md
Last active April 20, 2022 03:02
How to update latest packages on Imagination Creator CI20 Debian 8 (jessie)

How to update latest packages on Imagination Creator CI20 Debian 8 (jessie)

Imagination Creator CI20 board: A MIPS32 architecture evaluation board.

Imagination Creator CI20 board


@kekyo
kekyo / build.yaml
Created December 22, 2021 03:57
Uses MSBuild on GitHub Actions
name: .NET Framework
on:
push:
# branches:
# - main
# - develop
# pull_request:
# branches:
# - main
# - develop
@kekyo
kekyo / remove-ignore-files.sh
Last active November 19, 2021 06:39
Remove unused dirty nonsense files from Git repository with already committed.
#!/bin/sh
# 1. Put your adjusted genuine .gitignore file.
# 2.
git add .gitignore
git commit -m "Placed genuine .gitignore file."
# 3.
git clean -xfd
netsh http add urlacl url=http://+:12345/ user=everyone
netsh advfirewall firewall add rule name="SendKeySv HTTP" dir=in action=allow
netsh advfirewall firewall set rule name="SendKeySv HTTP" new program=system profile=private protocol=tcp localport=12345