Skip to content

Commit

Permalink
chore: add and require spdx headers
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Zak <richard.j.zak@gmail.com>
  • Loading branch information
rjzak committed Feb 8, 2025
1 parent 94c588a commit 59a0e72
Show file tree
Hide file tree
Showing 74 changed files with 153 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ jobs:
- name: cargo clippy
run: cargo clippy --workspace --all-features --tests -- -D warnings

check-spdx-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: enarx/spdx@b5bfdd4410071bf058c8333d0e70020001524b6b # master
with:
licenses: Apache-2.0

udeps:
name: Unused dependencies
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions client/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions client/src/cli/cart.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::fs::File;
use std::io::Cursor;
use std::path::PathBuf;
Expand Down
2 changes: 2 additions & 0 deletions client/src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::MdbClient;
use std::path::PathBuf;
pub mod cart;
Expand Down
2 changes: 2 additions & 0 deletions client/src/cli/report.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::MdbClient;

use std::path::PathBuf;
Expand Down
2 changes: 2 additions & 0 deletions client/src/cli/retrieval.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::MdbClient;

use std::process::ExitCode;
Expand Down
2 changes: 2 additions & 0 deletions client/src/cli/similar.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::MdbClient;

use std::path::PathBuf;
Expand Down
2 changes: 2 additions & 0 deletions client/src/cli/submit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::MdbClient;
use malwaredb_types::doc::{is_zip_file_doc, PK_HEADER};

Expand Down
2 changes: 2 additions & 0 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#![doc = include_str!("../README.md")]
#![deny(missing_docs)]

Expand Down
2 changes: 2 additions & 0 deletions client/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

mod cli;

use malwaredb_client::MdbClient;
Expand Down
2 changes: 2 additions & 0 deletions client/src/option_cert_path_serialization.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::path::PathBuf;

use reqwest::Certificate;
Expand Down
2 changes: 2 additions & 0 deletions crates/api/src/digest.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::borrow::Borrow;
use std::error::Error;
use std::fmt::{Display, Formatter};
Expand Down
2 changes: 2 additions & 0 deletions crates/api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#![doc = include_str!("../README.md")]
#![deny(missing_docs)]

Expand Down
2 changes: 2 additions & 0 deletions crates/server/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

fn main() {
#[cfg(target_os = "windows")]
vcpkg::find_package("libmagic").unwrap();
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::fmt::{Display, Formatter};
use std::io::{Cursor, Write};

Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/db/admin.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::fmt::{Display, Formatter};

#[derive(Clone, Debug)]
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/db/malwaredb_pg.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- SPDX-License-Identifier: Apache-2.0

CREATE TYPE encryptionkey_algorithm AS ENUM('rc4', 'xor', 'aes128');

CREATE TABLE encryptionkey (
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/db/malwaredb_sqlite.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- SPDX-License-Identifier: Apache-2.0

PRAGMA foreign_keys = ON;

CREATE TABLE encryptionkey (
Expand Down
3 changes: 2 additions & 1 deletion crates/server/src/db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//!
// SPDX-License-Identifier: Apache-2.0

//! Postgres is the database used by MalwareDB.
//! However, SQLite will be used for unit testing. This option can be allowed by using the `sqlite`
//! feature flag. When using SQLite, any similarity functions must be calculated by MalwareDB.
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/db/pg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#[cfg(any(test, feature = "admin"))]
use super::{admin, hash_password};
use super::{random_bytes_api_key, DatabaseInformation, MDBConfig};
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/db/sqlite.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#[cfg(any(test, feature = "admin"))]
use super::admin;
#[cfg(any(test, feature = "admin"))]
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/db/types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_api::{SupportedFileType, SupportedFileTypes};
use malwaredb_types::utils::EntropyCalc;

Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/http/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use super::State;
use crate::db::types::FileTypes;
use malwaredb_api::digest::HashType;
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/http/receive.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::db::types::FileMetadata;
use crate::State;
use malwaredb_types::KnownType;
Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#![doc = include_str!("../README.md")]
#![deny(missing_docs)]

Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::fmt::LowerHex;
use std::path::PathBuf;

Expand Down
2 changes: 2 additions & 0 deletions crates/server/src/vt/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::State;
use std::fmt::{Display, Formatter};

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/doc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use chrono::{DateTime, Utc};
#[cfg(feature = "officexml")]
use std::fs::File;
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/doc/office95.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::doc::DocumentFile;
use crate::utils::u64_from_offset;
use crate::{Ordering, SpecimenFile};
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/doc/pdf.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::SpecimenFile;

use std::fmt::{Display, Formatter};
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/doc/rtf.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::utils::find_subsequence;
use crate::SpecimenFile;

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/elf/fields.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use flagset::flags;

flags! {
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/elf/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

/// Flags for some fields within an ELF header
pub mod fields;

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/macho/fat.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::exec::{macho::Macho, Architecture, ExecutableFile, OperatingSystem, Sections};
use crate::utils::{bytes_offset_match, u32_from_offset, EntropyCalc};
use crate::{Ordering, SpecimenFile};
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/macho/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

/// Fat Mach-O parsing (multiple Mach-O programs in one binary)
pub mod fat;

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::collections::{HashMap, HashSet};
use std::fmt::{Display, Formatter};

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/pe32/fields.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use super::utils::u32_or_none_from_offset;
use crate::exec::pe32::utils::{u16_or_none_from_offset, u64_or_none_from_offset};
use crate::exec::{Architecture, Import, Imports, Section};
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/pe32/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

/// PE-32 fields
mod fields;

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/pe32/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::utils::{u16_from_offset, u32_from_offset, u64_from_offset};
use crate::Ordering;

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/exec/pef/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::exec::{Architecture, ExecutableFile, OperatingSystem, Section, Sections};
use crate::utils::{
bytes_offset_match, i32_from_offset, string_from_offset, u16_from_offset, u32_from_offset,
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#![doc = include_str!("../README.md")]
#![deny(missing_docs)]

Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#[cfg(any(feature = "office95", feature = "pdf", feature = "rtf"))]
use malwaredb_types::doc;
#[cfg(any(feature = "elf", feature = "macho", feature = "pe32", feature = "pef"))]
Expand Down
2 changes: 2 additions & 0 deletions crates/types/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

// Convenience functions for reading data types from binary blobs

use crate::Ordering;
Expand Down
2 changes: 2 additions & 0 deletions crates/types/testdata/Hello.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

package none;

public class Hello {
Expand Down
2 changes: 2 additions & 0 deletions crates/types/testdata/source.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#include<stdio.h>

int main() {
Expand Down
2 changes: 2 additions & 0 deletions crates/types/testdata/source.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

using System;

public class HelloWorld {
Expand Down
2 changes: 2 additions & 0 deletions crates/types/testdata/source_lib.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#include<stdio.h>

void hello() {
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/compression.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::State;

use std::process::ExitCode;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use crate::cli::config::{Config, CONFIG_PATHS};

use std::fs;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/groups.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::State;

use std::process::ExitCode;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/keys.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::{
crypto::{EncryptionOption, FileEncryption},
State,
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/labels.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_api::{Label, Labels};
use malwaredb_server::State;

Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/load.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::db::types::{FileMetadata, FileType};
use malwaredb_server::{State, GZIP_MAGIC};
use malwaredb_types::doc::{is_zip_file_doc, PK_HEADER};
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

mod compression;
mod config;
mod groups;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/sources.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::State;

use std::process::ExitCode;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/users.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::State;

use std::process::ExitCode;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/admin/vt.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::State;

use std::process::ExitCode;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/cart_io.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use malwaredb_server::db::types::FileMetadata;

use std::fs::File;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

#[cfg(any(feature = "admin", feature = "admin-gui", feature = "vt"))]
use malwaredb_server::State;

Expand Down
2 changes: 2 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

//! How to generate shell completions.
//! Instructions based on [Clap](https://github.com/clap-rs/clap/blob/master/clap_complete/examples/completion-derive.rs).
//!
Expand Down
2 changes: 2 additions & 0 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use super::config::Config;
use malwaredb_server::State;

Expand Down
2 changes: 2 additions & 0 deletions src/cli/service/freebsd.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use super::Installer;

use std::path::PathBuf;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/service/launchctl.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use super::Installer;

use std::path::PathBuf;
Expand Down
2 changes: 2 additions & 0 deletions src/cli/service/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0

use std::process::ExitCode;

#[cfg(target_os = "freebsd")]
Expand Down
Loading

0 comments on commit 59a0e72

Please sign in to comment.