arXiv:2610.21031cs.CROct 2026

Manuscript Offprint

arXiv:2610.21031

Blind Watermarking of Software Repositories via Module Placement

Khadija Mohamed, Khaled Fathy, Mamdouh Farouk, Mohamed M. Darwish

Khadija Mohamed Khaled Fathy Mamdouh Farouk Mohamed M. Darwish

Department of Computer Science, Faculty of Computers and Information

Assiut University, Assiut, Egypt

khadija.mohamed@aun.edu.eg khussain@aun.edu.eg

mamdouh@fci.au.edu.eg mohamed_darwish@aun.edu.eg

Abstract—Source-code watermarking supports provenance tracking by embedding a recoverable identifier in a software artifact. Many existing approaches encode this identifier in tokens or program syntax, exposing the watermark to transformations that modify the source text. We present PLACEMARK, a blind watermarking system that encodes a payload in the placement of modules within a repository. Each eligible module is identified by its filename and top-level definition names. A secret key determines its ordered candidate destinations and its position in the reading order; the module's location within its candidate list determines the encoded symbol. Embedding relocates selected modules and updates their import references. Extraction uses the distributed repository, the key, and agreed decoding parameters, without an original copy or placement ledger. Capacity measurements on ten Python repositories yield nominal capacities of 249 to 2,166 bits in nine repositories, while one provides no placement channel. In 216 trials of the evaluated text transformations, the payload is recovered exactly. Relocation degrades recovery gradually on DJANGO, AIRFLOW and SALT, while on PYLINT a path-based exclusion in our implementation lets relocation change carrier membership, and we measure it for an untargeted adversary and for one that concentrates its budget on the public carrier set. Changes to filenames or definition names alter the identity input and are measured separately. Exact recovery also depends on placement feasibility. The results characterize module placement as a carrier that can complement watermarks embedded in source text.

Index Terms—software watermarking, information hiding, code provenance, steganography, software architecture

I. INTRODUCTION

Source code can be copied, modified, and redistributed with little effort, making its provenance difficult to establish once it leaves the original repository. A project may be republished under another name or incorporated into a different product after changes that obscure its origin. This motivates a practical question: can a distributed repository retain a recoverable identifier without relying on the cooperation of the party redistributing it?

Watermarking addresses this need by embedding a recoverable mark within the artifact itself. For source code, the carriers reported in the literature lie within the code representation: a recent systematic review classifies existing schemes entirely at the level of tokens, syntax, and the abstract syntax tree [1]. Identifiers are renamed according to a secret rule [2], statements are replaced with semantically equivalent variants [3]–[5], or, for model-generated code, the token distribution is biased during generation [6], [7]. These schemes can be effective under the transformations considered in their evaluations, but they operate on source representations that maintenance and redistribution routinely modify, so their robustness depends on which elements an attack changes. The Transformer variant of SRCMARKER, for example, reports 97.26% bit accuracy without attack and 62.68% after full variable substitution [2]. This motivates a complementary carrier without implying that all source-text watermarks respond identically to the same transformation.

We observe that a repository offers a second degree of freedom, one that, to the best of our knowledge, existing source-code watermarking schemes do not use: the arrangement of its modules and files. Module placement in a software project is often flexible. A module implementing a caching helper, for example, may reasonably be placed in a utilities package, beside its principal consumer, or in a core package, with the choice reflecting maintainer judgement rather than a functional constraint. That choice can therefore carry information. If a module can be placed in any of eight packages without affecting program behaviour, its placement encodes three bits, and a repository containing hundreds of such modules provides a channel of hundreds to thousands of bits. Writing to this channel inserts no code and deletes none. Its edits are confined to the references that name a module it moves, which are the edits a maintainer would make by hand for the same move. The message is encoded in the arrangement of the files themselves.

Blind extraction creates a synchronisation problem. Without the original repository or a placement ledger, the decoder must identify the same carriers and read them in the same order as the encoder. A path-dependent eligibility rule may violate this condition after relocation: a moved file can enter or leave the carrier set, shifting every subsequent symbol. The decoder must also reconstruct the same destination universe, since a change there can alter the candidate lists and the radix. We formalise this requirement, show how it constrains the identity function and the reading order, and measure the consequences of violating it.

We instantiate these principles in PLACEMARK, a watermarking system for repository structure. Each carrier file is identified by its own content, its filename together with the names it defines, so that it remains recognisable wherever it is placed. A keyed pseudorandom function assigns each carrier an ordered list of packages it may legally occupy, and the index of its actual package within that list encodes the symbol it carries. A second keyed permutation determines the order in which carriers are read, preventing the payload-bearing subset from being identified without the key. Files whose relocation could alter program behaviour, such as those discovered by frameworks through directory enumeration, are excluded using a test based on the file's own syntax tree, which remains unchanged by relocation.

We census ten production repositories and run the experiments on a subset of them. The channel provides a nominal capacity of up to 2,166 bits, and recovers the payload exactly when the selected positions are writable. Across 216 measured trials covering renaming of up to 100% of local variable names, dead-code insertion, exception wrapping, print insertion, and their combination, no payload bit was lost. Under relocation, the transformation to which a placement watermark is inherently exposed, degradation is gradual rather than abrupt. The placement carrier and the content carriers used by prior work are therefore complementary.

References (32)