repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
SheetReferences.astroAstro121 lines4.2 KiBraw download
---
/**
 * "Sources & further reading" plate for a sheet with secondary provenance.
 *
 * SheetCredit carries the one upstream a sheet *is* derived from, and sits
 * above the article as a header banner. This carries the sources a sheet
 * merely draws on — one row each — and sits at the foot, where a reader who
 * has finished the page is looking for where to go next.
 *
 * Licence wording is deliberately the same mapping SheetCredit uses. Two
 * panels describing the same upstream in different words is how a site ends
 * up implying a grant that does not exist, so `none` reads "no licence
 * published" in both places or in neither.
 */
import Icon from './Icon.astro';
import { url } from '../lib/url';

interface Reference {
  name: string;
  url: string;
  author?: string;
  license?: string;
  relation?: string;
  note?: string;
}
interface Props {
  references?: Reference[];
}
const { references = [] } = Astro.props;

const BADGE: Record<string, string> = {
  verbatim: 'mirror',
  derived: 'derived',
  inspired: 'inspired',
  'link-only': 'link',
};

function licenceLabel(license?: string): string | null {
  if (!license) return null;
  if (license === 'none') return 'no licence published';
  if (license === 'proprietary') return 'proprietary — all rights reserved';
  return license;
}
---
{references.length > 0 && (
  <aside class="refs plate corners" aria-labelledby="refs-heading">
    <p class="micro refs__label" id="refs-heading">// sources &amp; further reading</p>
    <ul class="refs__list">
      {references.map((ref) => (
        <li class="refs__item">
          <span class="patt-badge refs__badge">{BADGE[ref.relation ?? ''] ?? 'credit'}</span>
          <span class="refs__body">
            <a class="refs__name" href={ref.url} target="_blank" rel="noopener">{ref.name}</a>
            {ref.author && <span class="refs__author"> by <strong>{ref.author}</strong></span>}
            {ref.note && <span class="refs__note">{ref.note}</span>}
            {licenceLabel(ref.license) && (
              <span class="refs__lic">{licenceLabel(ref.license)}</span>
            )}
          </span>
        </li>
      ))}
    </ul>
    <p class="refs__foot">
      <Icon name="github" style="width:13px;height:13px;" />
      Upstream repositories remain canonical — corrections belong there.
      <a href={url('credits')}>Full credits &amp; licences</a>
    </p>
  </aside>
)}

<style>
  /* Same object as the credit banner above the article (SheetCredit) and the
     provenance slabs on /credits: square plate, corner brackets, left accent
     bar, provenance metadata set in the terminal font at micro-label size.
     Unlike SheetCredit this one does NOT pin its palette — it reads as part
     of the page it closes, not as a foreign notice pasted on top. */
  .refs {
    margin: 2.5rem 0 0;
    padding: 1rem 1.2rem 1.1rem;
    border-left: 2px solid var(--iris);
    --bracket: var(--iris);
  }
  .refs__label { color: var(--fg-faint); margin: 0 0 0.75rem; }
  .refs__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
  .refs__item { display: flex; align-items: flex-start; gap: 0.7rem; margin: 0; }
  .refs__badge { flex: none; margin-top: 0.1rem; color: var(--iris); border-color: color-mix(in oklab, var(--iris) 50%, transparent); }
  .refs__body { display: block; min-width: 0; }
  .refs__name { font-weight: 600; }
  .refs__author { color: var(--fg-dim); }
  /* Note and licence each take their own line so a long `note` cannot shove
     the licence off the end of a phone-width row, where it is the one part
     that must not be missed. */
  .refs__note,
  .refs__lic {
    display: block;
    color: var(--fg-dim);
    font-size: var(--step--1, 0.9em);
  }
  .refs__lic {
    color: var(--fg-faint);
    font-family: var(--font-term);
    font-size: var(--step-micro);
    letter-spacing: var(--track-micro);
    text-transform: uppercase;
    margin-top: 0.2rem;
  }
  .refs__foot {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin: 0.95rem 0 0;
    padding-top: 0.7rem;
    border-top: 1px solid var(--rule);
    color: var(--fg-faint);
    font-family: var(--font-term);
    font-size: var(--step-micro);
    letter-spacing: var(--track-micro);
    text-transform: uppercase;
  }
</style>