33 lines · 1.3 KB
import { useDemoTimeline } from "~/hooks/use-demo-timeline";
import { DemoWindow } from "../DemoWindow";
import { Terminal, type TerminalLine } from "./Terminal";

const INTERVAL_MS = 650;

const LINES: ReadonlyArray<TerminalLine> = [
  { text: "$ git push origin main" },
  { text: "Enumerating objects: 7, done.", tone: "muted" },
  { text: "Writing objects: 100% (4/4), 412 bytes, done.", tone: "muted" },
  { text: "" },
  { text: "remote: gitfor: PUSH REJECTED — push protection found secrets in this push.", tone: "danger" },
  { text: "remote:   - AWS access key (AKIA…7Q2M) in blob 9c41e0a, line 12", tone: "danger" },
  { text: "remote:     review or bypass: …/security/secret-scanning/unblock/…", tone: "muted" },
  { text: "" },
  { text: " ! [remote rejected] main -> main (pre-receive hook declined)", tone: "danger" },
  { text: "$ git commit --amend && git push origin main" },
  { text: "   3f9a21c..b72d0e4  main -> main", tone: "success" },
];

export function SecurityDemo({ className }: { className?: string }) {
  const step = useDemoTimeline(LINES.length, INTERVAL_MS);
  return (
    <DemoWindow
      title="~/acme/api"
      label="A push containing an access key is rejected, then succeeds after the secret is removed"
      className={className}
    >
      <Terminal lines={LINES} visible={step} />
    </DemoWindow>
  );
}