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

Refactor backend code #509

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Refactor backend code #509

wants to merge 4 commits into from

Conversation

maia-iyer
Copy link
Collaborator

@maia-iyer maia-iyer commented Sep 30, 2024

Refactors backend code by splitting two files into five.

Before, the structure followed within /api/agent:

  • server.go
    • Contained definition of server type
    • Contained configuration parsing and plugin initialization logic
    • Contained Handlers for all main functions
  • api.go
    • Contained SPIRE API implementation
    • Contained Tornjak API implementation

Revised structure gives a file to each of these concerns:

  • server.go: contains definition of server type
  • config.go: contains config parsing and plugin initialization logic
  • handlers.go: contains handlers for all main functions
  • spire_apis.go: contains SPIRE API implementations
  • tornjak_apis.go: contains Tornjak API implementations

Additionally to pass the CodeQL warning, I revised the code here to check for file traversal attack AFTER joining paths instead of BEFORE joining paths.

@maia-iyer maia-iyer added the backend Tornjak API (Backend) label Sep 30, 2024
@maia-iyer maia-iyer added this to the 1.9.0 milestone Sep 30, 2024
@maia-iyer maia-iyer self-assigned this Sep 30, 2024
api/agent/server.go Fixed Show fixed Hide fixed
Signed-off-by: Maia Iyer <[email protected]>
Signed-off-by: Maia Iyer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Tornjak API (Backend)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant