Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve LICENSE + copyright information & add CONTRIBUTING file #1093

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

Ana06
Copy link
Member

@Ana06 Ana06 commented Jan 15, 2025

  • Replace LICENSE text file with the official Apache one: https://www.apache.org/licenses/LICENSE-2.0.txt This changes Copyright (C) 2021 Mandiant, Inc. by the following template language that had been incorrectly replaced: Copyright [yyyy] [name of copyright owner]
  • Add CONTRIBUTING file with information about CLA and Google's code of conduct to follow Google conventions/policies. We should add other information to this file in the future to make contributing to the project easier.
  • Replace the header from source code files. The old header had the confusing sentence All rights reserved, which
    does not make sense for an open source license. Replace the header by the default Google header that corrects this issue and keep floss consistent with other Google projects. I replaced the header using the following script:
    import os
    import re
    
    OLD_HEADER = b"# Copyright \(C\) (?P<year>\d+).* Mandiant, Inc. All Rights Reserved."
    NEW_HEADER = b"""# Copyright %s Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    """
    
    for dir_path, dir_names, file_names in os.walk("flare-floss"):
        for file_name in file_names:
            try:
                file_path = f"{dir_path}/{file_name}"
                f = open(file_path, "rb+")
                content = f.read()
                m = re.search(OLD_HEADER, content)
                if not m:
                    continue
                print(f"{file_path}: {m.group('year')}")
                content = content.replace(m.group(0), NEW_HEADER % m.group("year"))
                f.seek(0)
                f.write(content)
            except:
                continue
    Some files had the copyright headers inside a """ comment and needed manual changes before applying the script.

Related PRs in other Mandiant repositories: mandiant/capa#2556, mandiant/flare-vm#638, mandiant/VM-Packages#1238, mandiant/capa-rules#980

Ana06 added 3 commits January 14, 2025 17:52
Replace the header from source code files using the following script:
```Python
for dir_path, dir_names, file_names in os.walk("flare-floss"):
    for file_name in file_names:
        try:
            file_path = f"{dir_path}/{file_name}"
            f = open(file_path, "rb+")
            content = f.read()
            m = re.search(OLD_HEADER, content)
            if not m:
                continue
            print(f"{file_path}: {m.group('year')}")
            content = content.replace(m.group(0), NEW_HEADER % m.group("year"))
            f.seek(0)
            f.write(content)
        except:
            continue
```

Some files had the copyright headers inside a `"""` comment and needed
manual changes before applying the script.

The old header had the confusing sentence `All rights reserved`, which
does not make sense for an open source license. Replace the header by
the default Google header that corrects this issue and keep floss
consistent with other Google projects.
Replace LICENSE text file with the official Apache one:
https://www.apache.org/licenses/LICENSE-2.0.txt

This changes `Copyright (C) 2021 Mandiant, Inc.` by the following
template language that had been incorrectly replaced:
`Copyright [yyyy] [name of copyright owner]`
Add CONTRIBUTING file with information about CLA and Google's code of
conduct to follow Google conventions/policies. We should add other
information to this file in the future to make contributing to the
project easier.
@Ana06 Ana06 requested a review from williballenthin January 15, 2025 16:05
@Ana06 Ana06 changed the title Legal Improve LICENSE + copyright information & add CONTRIBUTING file Jan 15, 2025
Copy link
Collaborator

@williballenthin williballenthin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @Ana06 !

@williballenthin williballenthin merged commit 35e4167 into mandiant:master Jan 15, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants