This is code in Golang that will read a csv file and generate updated markdown files to be displayed on https://github.com/infosecstreams/infosecstreams.github.io/
Check the Makefile for all options but you've got make {docs,test,cover,clean,build,docker-build,docker-run} available to you.
When running docker-run, we assume you're providing streamers.csv from the infosecstreams repo. You can check the invocation of the docker run ... command in the Makefile for further details.
When developing, you'll likely not want to actually hit the API and use the internet. Instead you can reference static json files.
If the SECINFO_TEST environment variable is set (to literally any non-empty string), we'll use the test files instead of hitting the API.
// Check environ SECINFO_TEST exists
if os.Getenv("SECINFO_TEST") == "" { ... }
else {
// Read active.json into active struct
f, _ := ioutil.ReadFile("active.json")
_ = json.Unmarshal([]byte(f), &active)
// Read inactive.json into inactive struct
f, _ = ioutil.ReadFile("inactive.json")
_ = json.Unmarshal([]byte(f), &inactive)
}Ensure there's a streamers.csv in the CWD of the secinfo binary.
You can optionally provide an existing index.md file to be updated
The tool should do its best to main the online/offline status during the update.
This is ideally ran in the infosecstreams repo as part of a time-based GitHub Actions workflow. That workflow should run that docker container generated by this repo.
Pushing a v* tag runs .github/workflows/main.yml: GoReleaser builds and pushes
ghcr.io/infosecstreams/secinfo:<tag> and :latest, then the workflow signs the pushed digest
with keyless cosign (GitHub OIDC) and attaches a GitHub build provenance attestation. The run
summary prints the digest to pin in the site workflow.
The site workflow (infosecstreams.github.io/.github/workflows/main.yaml) pins secinfo by digest.
To have it refuse a digest that wasn't built by this repo's release workflow, add before the
regen step (gh is preinstalled on runners and uses the job's token):
- name: Verify the pinned secinfo image
env:
GH_TOKEN: ${{ github.token }}
run: |
gh attestation verify "oci://$SECINFO_IMAGE" \
--repo infosecstreams/secinfo \
--cert-identity-regex '^https://github\.com/infosecstreams/secinfo/\.github/workflows/main\.yml@refs/tags/v' \
--deny-self-hosted-runners(The site job sets permissions: contents: write; if gh gets a 403 reading attestations, add
attestations: read there.)
Or with cosign (sigstore/cosign-installer first):
cosign verify "$SECINFO_IMAGE" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp '^https://github\.com/infosecstreams/secinfo/\.github/workflows/main\.yml@refs/tags/v'Images released before signing was added (v0.1.8 and earlier) have no signature or attestation, so turn verification on together with the first pin bump after this change.