Skip to main content

Package Structure Map

The project is organized into a clean package hierarchy. Understanding the layout makes navigating the codebase straightforward.

Full Package Tree

Package-by-Package Breakdown

com.dfs.common — Data Transfer Objects

Files that travel over RMI. Every class in this package is Serializable.

ClassPurposeCritical Fields
FileOperationRepresents a client file-system requestoperationType, filename, fileData, username, timestamp, nonce
OperationResultThe server's response to a clientsuccess, message, fileData, fileList
UserCredentialsUsername + password (on the wire — hashed server-side)username, password
ClockMessageA write operation with Lamport timestamp for TO-MulticastmessageId, senderId, timestamp, operation

com.dfs.rmi — Remote Interfaces

Interfaces that define the contract between distributed components.

InterfaceExtendsPurpose
ReplicaNodeInterfaceRemoteAll node operations — client ops + TO-Multicast protocol + Raft
AuthServiceInterfaceRemoteRegistration, login, token validation

com.dfs.node — Replica Server Implementation

The largest package. Contains the core distributed systems logic.

ClassLinesPurpose
ReplicaNode~745Main server — implements ReplicaNodeInterface, TO-Multicast, Raft, file I/O, security
NodeMain~80Entry point — parses args, loads config, creates ReplicaNode
NodeRegistry~60Stores RMI addresses of all nodes, loaded from nodes.properties
LogicalClock~30Lamport clock — tick(), update(), getTime()
MessageQueue~130Priority queue + ACK tracking — the TO-Multicast algorithm core

com.dfs.auth — Authentication Service

ClassPurpose
AuthServiceImplements AuthServiceInterface — handles registration, login, token management
AuthMainEntry point — creates registry, binds AuthService
PasswordUtilsPBKDF2 hashing, salt generation, constant-time comparison

com.dfs.client — Interactive CLI

ClassPurpose
DFSClientRMI connection management, method calls to server
ClientShellInteractive menu rendering, user input handling, orchestration
ClientMainEntry point — creates DFSClient, starts ClientShell

com.dfs.util — Security Infrastructure

ClassPurpose
TLSConfigLoads keystores/truststore, creates SSL socket factories
SerializationValidatorObjectInputStream subclass with class whitelist (FIX 1)
NonceStoreTracks seen nonces + timestamps for replay rejection (BONUS)

com.vulnerable.* — Vulnerable Mirror

Each vulnerable class mirrors its secure counterpart but with the security mechanisms intentionally removed or disabled. Every vulnerability marker is a // VULNERABILITY: <name> comment.

Vulnerable ClassMirrorsWhat's Broken
VulnerableAuthServiceAuthServiceNo TLS, plaintext passwords
VulnerableReplicaNodeReplicaNodeAll 5 vulnerabilities exposed
VulnerableNodeMainNodeMainuseCodebaseOnly=false, no SSL factories
VulnerableDFSClientDFSClientPlain TCP, no cert presentation
VulnerableClientShellClientShellNo nonce/timestamp generation
VulnerableClientMainClientMainNo TLS setup
VulnerableAuthMainAuthMainNo TLS, plaintext passwords

Dependency Direction

client → rmi → common
node → rmi → common
node → util
auth → rmi → common
util → common

(Nothing depends on client, node, or auth — they're top-level)
(Nothing depends on util except node)
(common depends on nothing within the project — it's the base)

This clean dependency graph means:

  • common classes can be modified without touching anything else
  • util is self-contained security infrastructure
  • No circular dependencies anywhere

Next: → Common Layer Deep-Dive