Giter Club home page Giter Club logo

tuf-demo's Introduction

TUF repository automation demo

This is a demo of TUF repository automation using repository-editor-for-tuf and Github Actions:

  • snapshot and timestamp keys are stored in Github Secrets
  • Timestamp updates happen as cron action
  • Snapshot updates happen as an action after every push (if needed)

In practice developers can edit and sign targets with appropriate keys without having access to snapshot and timestamp keys, push their changes, and the automation will update the snapshot so the repository is valid.

TUF clients can access the repository deployed in https://jku.github.io/tuf-demo:

import os
import requests
from tuf.ngclient import Updater

url = "https://jku.github.io/tuf-demo/"
metadata_dir = "/tmp/tuf-demo/"

if not os.path.exists(f"{metadata_dir}/root.json"):
    # Trust-on-first-use: Download initial root metadata if it's not available
    os.makedirs(metadata_dir, exist_ok=True)
    with open(f"{metadata_dir}/root.json", "wb") as f:
        f.write(requests.get(f"{url}/metadata/1.root.json").content)

# Download file1.txt securely using python-tuf
updater = Updater(
    metadata_dir=metadata_dir,
    metadata_base_url=f"{url}/metadata/",
    target_dir="./",
    target_base_url=f"{url}/targets/"
)
info = updater.get_targetinfo("file1.txt")
if info is None:
    print("file1.txt not found")
elif not updater.find_cached_target(info):
    updater.download_target(info)

tuf-demo's People

Contributors

github-actions[bot] avatar joshuagl avatar jku avatar mvrachev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.