Skip to content

zero-yx/static_flow / skills/github-password-rotator

github-password-rotator

Verified

Use when a GitHub account password needs to be changed or rotated, or when Codex should log in to GitHub security settings so the user can manually change 2FA/passkeys. Applies when Codex should prefill username/password fields while the user handles 2FA, device checks, CAPTCHA, or suspended-account pages.

tests/drive_github_password_change.test.mjs

View on GitHub
import test from "node:test";
import assert from "node:assert/strict";

import {
  extractTotpCodeFrom2faFunValues,
  isGithubTwoFactorPrompt,
  learningRepoContentForAccount,
  learningRepoReadmeCommitted,
  learningRepoNameForAccount,
  loginOnlyComplete,
  passwordChangeSettledAfterSubmit,
  randomPostPasswordChangeDelayMs,
  requiresManualGithubStep,
} from "../scripts/drive_github_password_change.mjs";

test("does not treat the account security settings page as manual verification", () => {
  const settingsText = [
    "Account security",
    "Password",
    "Two-factor authentication",
    "Passkeys",
    "Security keys",
  ].join("\n").toLowerCase();

  assert.equal(
    requiresManualGithubStep("https://github.com/settings/security", settingsText),
    false,
  );
});

test("login-only mode completes only on the account security settings page", () => {
  assert.equal(
    loginOnlyComplete({
      url: "https://github.com/settings/security",
      text: "Account security\nTwo-factor authentication\nPasskeys",
    }),
    true,
  );
  assert.equal(
    loginOnlyComplete({
      url: "https://github.com/settings/profile",
      text: "Public profile",
    }),
    false,
  );
});

test("still detects GitHub two-factor challenge pages", () => {
  assert.equal(
    requiresManualGithubStep(
      "https://github.com/sessions/two-factor",
      "two-factor authentication code",
    ),
    true,
  );
});

test("detects GitHub two-factor checkup pages", () => {
  assert.equal(
    isGithubTwoFactorPrompt(
      "https://github.com/settings/two_factor_checkup?",
      "verify your recently configured two-factor authentication method",
    ),
    true,
  );
});

test("treats collapsed password form after submit as settled without a success flash", () => {
  assert.equal(
    passwordChangeSettledAfterSubmit({
      url: "https://github.com/settings/security",
      passwordInputs: [],
      buttons: ["Change password"],
    }),
    true,
  );
});

test("does not treat a visible password form as settled after submit", () => {
  assert.equal(
    passwordChangeSettledAfterSubmit({
      url: "https://github.com/settings/security",
      passwordInputs: [
        { visible: true },
        { visible: true },
        { visible: true },
      ],
      buttons: ["Update password"],
    }),
    false,
  );
});

test("builds a deterministic learning repository name from the account name", () => {
  assert.equal(learningRepoNameForAccount("Thompsonx"), "hello-world-from-thompsonx");
  assert.equal(learningRepoNameForAccount("Jane_Doe.42"), "hello-world-from-jane-doe-42");
});

test("waits 3 to 10 seconds after password change before repository creation", () => {
  assert.equal(randomPostPasswordChangeDelayMs(() => 0), 3000);
  assert.equal(randomPostPasswordChangeDelayMs((max) => max - 1), 10000);
});

test("builds varied beginner README content for the same account", () => {
  const first = learningRepoContentForAccount("alice", () => 0);
  const second = learningRepoContentForAccount("alice", (length) => Math.min(1, length - 1));

  assert.match(first, /^# Hello World from alice/m);
  assert.match(first, /beginner|practice|learning/i);
  assert.notEqual(first, second);
});

test("does not treat the new-file editor as a committed learning README", () => {
  assert.equal(
    learningRepoReadmeCommitted(
      {
        url: "https://github.com/alice/hello-world-from-alice/new/main?filename=README.md",
        text: "# Hello World from alice",
      },
      "alice",
      "hello-world-from-alice",
    ),
    false,
  );
});

test("treats repository file view as a committed learning README", () => {
  assert.equal(
    learningRepoReadmeCommitted(
      {
        url: "https://github.com/alice/hello-world-from-alice/tree/main",
        text: "README Hello World from alice",
      },
      "alice",
      "hello-world-from-alice",
    ),
    true,
  );
});

test("extracts 2fa.fun code from OTP input values", () => {
  assert.equal(
    extractTotpCodeFrom2faFunValues(["", "123456"]),
    "123456",
  );
});
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 192kUpdated Claude CodeCodexVerifiedInstall