Skip to content

Instantly share code, notes, and snippets.

@azu
azu / README.md
Last active November 2, 2022 08:00
サブドメインをユーザーホスティングサイトに使うときのパターン(Same Origin/Cookie/Public Suffix List)

サブドメインをユーザーホスティングサイトに使うときのパターン

hoge.example.com でユーザが作成したサイトをホスティングして、任意のJavaScriptを実行できる状態にしたいケース。 サブドメインを分けることで、Fetch APIなどはSame Origin Policyを基本にするため、別のサブドメインや example.com に対するリクエストなどはできなくなる。

一方で、CookieはSame Origin Policyではない。 デフォルトでは、hoge.example.com から example.com に対するCookieが設定できる。 これを利用したDoS(Cookie Bomb)やこの挙動を組み合わせた別の脆弱性に利用できる場合がある。

@Jaid
Jaid / migratingRules.md
Last active September 30, 2024 16:14
ESLint rules for migrating projects from CommonJS to ESM

ESLint rules

The ESM standard is considered stable in NodeJS and well supported by a lot of modern JavaScript tools.

ESLint does a good job validating and fixing ESM code (as long as you don't use top-level await, coming in ESLint v8). Make sure to enable the latest ECMA features in the ESLint config.

  • .eslint.json
{
@azu
azu / get-domain.js
Last active June 24, 2021 03:09
Get domain(site) from url using document.cookie hacking. without public suffix
const isSite = (domain) => {
console.log(domain)
const key = "WILL_BE_FIRED." + 'xxxx-xxxx-xxx-xxxx'.replace(/[x]/g, (c) => {
const r = Math.floor(Math.random() * 16);
return r.toString(16);
});
document.cookie = `${key}=1; domain=${domain}; samesite`;
// Test wrinting
console.log("document.cookie", document.cookie)
const canWrite = document.cookie.includes(`${key}=1`);
@azu
azu / 英語 文書 翻訳 読む ツール まとめ.md
Last active October 30, 2024 10:32
英語の文書を翻訳して読むときのツールのまとめ
@azu
azu / README.md
Created June 6, 2021 07:13
Decrypt and restore iOS backup(`Manifest.db` is encrypted) for restoring my iOS photos.

Setup

Use https://github.com/jfarley248/iTunes_Backup_Reader

git clone https://github.com/jfarley248/iTunes_Backup_Reader
cd iTunes_Backup_Reader
# apply https://github.com/jfarley248/iTunes_Backup_Reader/pull/12
gh pr checkout https://github.com/jfarley248/iTunes_Backup_Reader/pull/12
@azu
azu / ua-client-hints.md
Last active July 13, 2021 07:33
User Agent client hintsのJavaScript APIとHTTP Header
@azu
azu / Google: remove hidden text.user.js
Last active July 29, 2020 10:29
検索結果でテキストをコピーすると入る"ウェブ検索結果" and "検索結果"を削除する
// ==UserScript==
// @name Google: remove hidden text
// @description 検索結果でテキストをコピーすると入る"ウェブ検索結果"と"検索結果"を削除する
// @namespace info.efcl.google
// @match https://www.google.*/search*
// @grant none
// @version 1.0
// @author azu
// ==/UserScript==
@azu
azu / git-2.26.1-README.md
Last active January 22, 2022 21:54
Gitの認証情報を奪い取れるGit 2.26.0以下にある脆弱性について

Git 2.26.0以下にある脆弱性

Git 2.26.0以下*1には、細工したリポジトリをgit cloneしたときに、 そのユーザーのCredential(たとえばGitHub.comをcloneするときに使う認証情報)を奪い取れる脆弱性があります。

📝 取得できる認証情報は credential.helper の設定に依存する

既にPoC(検証するためのコード)もあり、結構簡単なので是非Gitを2.26.1以上にアップデートしましょう。 git submoduleを使うと見た目ではわかりにくい攻撃もできるので、「気をつける」では回避は難しいです。

@ybiquitous
ybiquitous / secretlint.yml
Last active May 13, 2021 08:46
Secretlint out of the box via GitHub Actions
# https://github.com/secretlint/secretlint
name: secretlint
on:
push:
branches: ['main']
pull_request:
branches: ['**']
jobs:
@azu
azu / browser-resources.md
Last active June 25, 2020 01:57
ブラウザ/セキュリティ/プライバシー周りの一次情報に近い二次情報の情報源をまとめたもの

一次情報に近い二次情報の情報源をまとめたもの。

ここでの一次情報はコミットとかコードのこと。

Browser