Data Models

This section is a collection of concepts or notations for describing the structure of the FederatedCode Data Model and providing details about all fields included in the output files.

Actor

class fedcode.models.Actor

Represent a local or remote actor

Parameters:
public_key

Type: TextField

Public key

summary

Type: CharField

Summary. profile summary

RemoteActor

class fedcode.models.RemoteActor

Represent a remote actor with its username

Parameters:
  • url (URLField) – Primary key: Url

  • username (CharField) – Username

  • created_at (DateTimeField) – Created at. A field to track when remote actor are created

  • updated_at (DateTimeField) – Updated at. A field to track when remote actor are updated

Reverse relationships:

Parameters:
get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)

Finds next instance based on created_at. See get_next_by_FOO() for more information.

get_next_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=True, **kwargs)

Finds next instance based on updated_at. See get_next_by_FOO() for more information.

get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)

Finds previous instance based on created_at. See get_previous_by_FOO() for more information.

get_previous_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=False, **kwargs)

Finds previous instance based on updated_at. See get_previous_by_FOO() for more information.

created_at

Type: DateTimeField

Created at. A field to track when remote actor are created

package

Type: Reverse OneToOneField from Package

The package of this remote actor (related name of remote_actor)

person

Type: Reverse OneToOneField from Person

The person of this remote actor (related name of remote_actor)

property safe_url
service

Type: Reverse OneToOneField from Service

The service of this remote actor (related name of remote_actor)

updated_at

Type: DateTimeField

Updated at. A field to track when remote actor are updated

url

Type: URLField

Primary key: Url

username

Type: CharField

Username

Reputation

class fedcode.models.Reputation

Reputation of a package or vulnerability.

https://www.w3.org/TR/activitystreams-vocabulary/#dfn-like https://www.w3.org/ns/activitystreams#Dislike

Parameters:

Relationship fields:

Parameters:

content_type (ForeignKey to ContentType) – Content type (related name: reputation)

content_object

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

content_type

Type: ForeignKey to ContentType

Content type (related name: reputation)

content_type_id

Internal field, use content_type instead.

id

Type: BigAutoField

Primary key: ID

limit = <Q: (OR: (AND: ('app_label', 'fedcode'), ('model', 'review')), (AND: ('app_label', 'fedcode'), ('model', 'note')))>
object_id

Type: UUIDField

Object id

positive

Type: BooleanField

Positive

property to_ap
voter

Type: CharField

Voter. security@vcio

Service

class fedcode.models.Service

A Service is a special user that can manage git repositories ( sync , create )

Parameters:

id (BigAutoField) – Primary key: ID

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
property absolute_url_ap
id

Type: BigAutoField

Primary key: ID

package_set

Type: Reverse ForeignKey from Package

All packages of this service (related name of service)

remote_actor

Type: OneToOneField to RemoteActor

Remote actor (related name: service)

remote_actor_id

Internal field, use remote_actor instead.

repository_set

Type: Reverse ForeignKey from Repository

All repositorys of this service (related name of admin)

property to_ap
user

Type: OneToOneField to User

User (related name: service)

user_id

Internal field, use user instead.

Note

class fedcode.models.Note

A Note is a message send by a Person or Package. The content is either a plain text message or structured YAML. If the author is a Package actor then the content is always YAML If the author is a Person actor then the content is always plain text https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note

Parameters:
  • id (UUIDField) – Primary key: Id. The object’s unique global identifier

  • acct (CharField) – Acct. Account that created this note

  • content (TextField) – Content. Text content for this note

  • mediaType (CharField) – MediaType

  • created_at (DateTimeField) – Created at. A field to track when notes are created

  • updated_at (DateTimeField) – Updated at. A field to track when notes are updated

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)

Finds next instance based on created_at. See get_next_by_FOO() for more information.

get_next_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=True, **kwargs)

Finds next instance based on updated_at. See get_next_by_FOO() for more information.

get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)

Finds previous instance based on created_at. See get_previous_by_FOO() for more information.

get_previous_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=False, **kwargs)

Finds previous instance based on updated_at. See get_previous_by_FOO() for more information.

property absolute_url
acct

Type: CharField

Acct. Account that created this note

property acct_avatar
content

Type: TextField

Content. Text content for this note

created_at

Type: DateTimeField

Created at. A field to track when notes are created

id

Type: UUIDField

Primary key: Id. The object’s unique global identifier

mediaType

Type: CharField

MediaType

package_set

Type: Reverse ManyToManyField from Package

All packages of this note (related name of notes)

person_set

Type: Reverse ManyToManyField from Person

All persons of this note (related name of notes)

replies

Type: Reverse ForeignKey from Note

All replies of this note (related name of reply_to)

reply_to

Type: ForeignKey to Note

Reply to (related name: replies)

reply_to_id

Internal field, use reply_to instead.

reputation

Type: Reverse GenericRelation from Note

All + of this reputation (related name of reputation)

property reputation_value
review_set

Type: Reverse ManyToManyField from Review

All reviews of this note (related name of notes)

property to_ap
updated_at

Type: DateTimeField

Updated at. A field to track when notes are updated

property username

Package

class fedcode.models.Package

A software package is an Actor identified by its package url ( PURL ) ignoring versions

Parameters:
  • summary (CharField) – Summary. profile summary

  • public_key (TextField) – Public key

  • id (UUIDField) – Primary key: Id. The object’s unique global identifier

  • purl (CharField) – Purl. PURL (no version) ex: @pkg:maven/org.apache.logging

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

follow (Reverse ForeignKey from Follow) – All follows of this package (related name of package)

property absolute_url_ap
property acct
follow_set

Type: Reverse ForeignKey from Follow

All follows of this package (related name of package)

property followers
property followers_count
property followers_inboxes

Return a followers inbox list

property followers_url
id

Type: UUIDField

Primary key: Id. The object’s unique global identifier

property inbox_url
property key_id
notes

Type: ManyToManyField to Note

Notes. the notes created by this package (related name: package)

property notes_count
property outbox_url
public_key

Type: TextField

Public key

purl

Type: CharField

Purl. PURL (no version) ex: @pkg:maven/org.apache.logging

remote_actor

Type: OneToOneField to RemoteActor

Remote actor (related name: package)

remote_actor_id

Internal field, use remote_actor instead.

service

Type: ForeignKey to Service

Service (related name: package)

service_id

Internal field, use service instead.

summary

Type: CharField

Summary. profile summary

property to_ap

Person

class fedcode.models.Person

A person is a user can follow package or just vote or create a notes

Parameters:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
property absolute_url_ap
property acct
property avatar
property avatar_absolute_url
follow_set

Type: Reverse ForeignKey from Follow

All follows of this person (related name of person)

property following_url
id

Type: BigAutoField

Primary key: ID

property inbox_url
property key_id
property local
notes

Type: ManyToManyField to Note

Notes. Notes created by this user (related name: person)

property outbox_url
public_key

Type: TextField

Public key

remote_actor

Type: OneToOneField to RemoteActor

Remote actor (related name: person)

remote_actor_id

Internal field, use remote_actor instead.

property reputation_value

if someone like your ( review or note ) you will get +1, dislike: -1

review_set

Type: Reverse ForeignKey from Review

All reviews of this person (related name of author)

summary

Type: CharField

Summary. profile summary

property to_ap
property url
user

Type: OneToOneField to User

User (related name: person)

user_id

Internal field, use user instead.

Follow

class fedcode.models.Follow

A Follow relates a person to a package that “follows” a package.

Parameters:

Relationship fields:

Parameters:
  • person (ForeignKey to Person) – Person. Person that follows (related name: follow)

  • package (ForeignKey to Package) – Package. Followed package (related name: follow)

get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)

Finds next instance based on created_at. See get_next_by_FOO() for more information.

get_next_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=True, **kwargs)

Finds next instance based on updated_at. See get_next_by_FOO() for more information.

get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)

Finds previous instance based on created_at. See get_previous_by_FOO() for more information.

get_previous_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=False, **kwargs)

Finds previous instance based on updated_at. See get_previous_by_FOO() for more information.

created_at

Type: DateTimeField

Created at. Date created

id

Type: BigAutoField

Primary key: ID

package

Type: ForeignKey to Package

Package. Followed package (related name: follow)

package_id

Internal field, use package instead.

person

Type: ForeignKey to Person

Person. Person that follows (related name: follow)

person_id

Internal field, use person instead.

updated_at

Type: DateTimeField

Updated at. Date updated

Repository

class fedcode.models.Repository

A git repository used as a backing storage for Package and vulnerability data

Parameters:

Relationship fields:

Parameters:

admin (ForeignKey to Service) – Admin. admin user ex: VCIO user (related name: repository)

Reverse relationships:

Parameters:
get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)

Finds next instance based on created_at. See get_next_by_FOO() for more information.

get_next_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=True, **kwargs)

Finds next instance based on updated_at. See get_next_by_FOO() for more information.

get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)

Finds previous instance based on created_at. See get_previous_by_FOO() for more information.

get_previous_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=False, **kwargs)

Finds previous instance based on updated_at. See get_previous_by_FOO() for more information.

property absolute_url
admin

Type: ForeignKey to Service

Admin. admin user ex: VCIO user (related name: repository)

admin_id

Internal field, use admin instead.

created_at

Type: DateTimeField

Created at. A field to track when repository are created

property git_repo_obj
id

Type: UUIDField

Primary key: Id. The object’s unique global identifier

last_imported_commit

Type: CharField

Last imported commit

path

Type: CharField

Path. path of the repository

remote_url

Type: CharField

Remote url. the url of the repository if this repository is remote

property review_count
review_set

Type: Reverse ForeignKey from Review

All reviews of this repository (related name of repository)

syncrequest_set

Type: Reverse ForeignKey from SyncRequest

All sync requests of this repository (related name of repo)

property to_ap
updated_at

Type: DateTimeField

Updated at. A field to track when repository are updated

url

Type: URLField

Url. Git Repository url ex: https://github.com/nexB/vulnerablecode-data

vulnerability_set

Type: Reverse ForeignKey from Vulnerability

All vulnerabilitys of this repository (related name of repo)

Vulnerability

class fedcode.models.Vulnerability

A vulnerability tracked by its VulnerableCode VCID

Parameters:
  • id (CharField) – Primary key: Id. Unique vulnerability identifier ‘VCID’

  • remote_url (CharField) – Remote url

Relationship fields:

Parameters:

repo (ForeignKey to Repository) – Repo (related name: vulnerability)

property absolute_url
id

Type: CharField

Primary key: Id. Unique vulnerability identifier ‘VCID’

remote_url

Type: CharField

Remote url

repo

Type: ForeignKey to Repository

Repo (related name: vulnerability)

repo_id

Internal field, use repo instead.

property to_ap

Review

class fedcode.models.Review

A review tracks the review comments on a Package or Vulnerability.

Parameters:
  • id (UUIDField) – Primary key: Id. The object’s unique global identifier

  • headline (CharField) – Headline. the review title

  • filepath (CharField) – Filepath. the review path ex: /apache/httpd/VCID-1a68-fd5t-aaam.yml

  • commit (CharField) – Commit. ex: 104ccd6a7a41329b2953c96e52792a3d6a9ad8e5

  • data (TextField) – Data. review data ex: vulnerability file

  • created_at (DateTimeField) – Created at. A field to track when review are created

  • updated_at (DateTimeField) – Updated at. A field to track when review are updated

  • remote_url (CharField) – Remote url. the review remote url if Remote Review exists

  • status (SmallIntegerField) – Status. status of review

Relationship fields:

Parameters:
class ReviewStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
CLOSED = 2
DRAFT = 1
MERGED = 3
OPEN = 0
get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)

Finds next instance based on created_at. See get_next_by_FOO() for more information.

get_next_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=True, **kwargs)

Finds next instance based on updated_at. See get_next_by_FOO() for more information.

get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)

Finds previous instance based on created_at. See get_previous_by_FOO() for more information.

get_previous_by_updated_at(*, field=<django.db.models.DateTimeField: updated_at>, is_next=False, **kwargs)

Finds previous instance based on updated_at. See get_previous_by_FOO() for more information.

get_status_display(*, field=<django.db.models.SmallIntegerField: status>)

Shows the label of the status. See get_FOO_display() for more information.

property absolute_url
author

Type: ForeignKey to Person

Author (related name: review)

author_id

Internal field, use author instead.

commit

Type: CharField

Commit. ex: 104ccd6a7a41329b2953c96e52792a3d6a9ad8e5

created_at

Type: DateTimeField

Created at. A field to track when review are created

data

Type: TextField

Data. review data ex: vulnerability file

filepath

Type: CharField

Filepath. the review path ex: /apache/httpd/VCID-1a68-fd5t-aaam.yml

headline

Type: CharField

Headline. the review title

id

Type: UUIDField

Primary key: Id. The object’s unique global identifier

notes

Type: ManyToManyField to Note

Notes (related name: review)

remote_url

Type: CharField

Remote url. the review remote url if Remote Review exists

repository

Type: ForeignKey to Repository

Repository (related name: review)

repository_id

Internal field, use repository instead.

reputation

Type: Reverse GenericRelation from Review

All + of this reputation (related name of reputation)

property reputation_value
status

Type: SmallIntegerField

Status. status of review

Choices:

  • 0

  • 1

  • 2

  • 3

property to_ap
updated_at

Type: DateTimeField

Updated at. A field to track when review are updated

FederateRequest

class fedcode.models.FederateRequest

FederateRequest(id, target, body, key_id, error_message, created_at, done)

Parameters:
get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)

Finds next instance based on created_at. See get_next_by_FOO() for more information.

get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)

Finds previous instance based on created_at. See get_previous_by_FOO() for more information.

body

Type: TextField

Body. The request body

created_at

Type: DateTimeField

Created at. A field to track when review are created

done

Type: BooleanField

Done. Flag set to true when the request completed

error_message

Type: TextField

Error message. Error message if a request failed to federate

id

Type: BigAutoField

Primary key: ID

key_id

Type: URLField

Key id. The key url of the actor ex: https://my-example.com/actor#main-key

target

Type: URLField

Target. The request target ex: (inbox of the targeted actor

SyncRequest

class fedcode.models.SyncRequest

SyncRequest(id, repo, error_message, created_at, done)

Parameters:
  • id (BigAutoField) – Primary key: ID

  • error_message (TextField) – Error message. Error message if a request failed to sync

  • created_at (DateTimeField) – Created at. A field to track when review are created

  • done (BooleanField) – Done. Flag set to true when the request completed

Relationship fields:

Parameters:

repo (ForeignKey to Repository) – Repo. The Git repository where the importer will run (related name: syncrequest)

get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)

Finds next instance based on created_at. See get_next_by_FOO() for more information.

get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)

Finds previous instance based on created_at. See get_previous_by_FOO() for more information.

created_at

Type: DateTimeField

Created at. A field to track when review are created

done

Type: BooleanField

Done. Flag set to true when the request completed

error_message

Type: TextField

Error message. Error message if a request failed to sync

id

Type: BigAutoField

Primary key: ID

repo

Type: ForeignKey to Repository

Repo. The Git repository where the importer will run (related name: syncrequest)

repo_id

Internal field, use repo instead.