Repository navigation
Conversation
|
Yeah, I'd like to move away from manually assembling SQL queries where possible, bandit is complaining about potential SQL injection. Utilizing sqlalchemy more would be great but avoiding injection is the main issue. Github mobile is being annoying so I'll leave some more thoughts here:
I'm also realizing this is a much bigger change than I thought it was when I suggested having the check/export in one step. I think maybe if we can get the internal infrastructure in place to query all data tied to a person (maybe sqlalchemy can help traverse the foreign keys for us???) Figured out first, adding a CLI layer on top of that will be relatively easier than trying both at once. Also you point out a valid issue with the CLI connection test printing and messing with any ability to pipe from the CLI. IMO that should be opened as a new issue so we can resolve that and figure out how best to support outputting data (and whether the CLI output is considered a stable api surface or not) |
|
Thanks, this all makes sense. I’ll rework this: drop Source, use the model metadata to find tables referencing contributors.cntrb_id plus a short list of plain-text email columns, use SQLAlchemy select() instead of SQL strings, and put the DB access in application/db/lib.py. I’ll drop the CLI from this PR and open it as a follow-up, and verify on Postgres with real collected data instead of SQLite. I believe that once i use sqlAlchemy, I wont need to manually assemble sql queries, and that will remove the bandit error. The use of Source was just a wrong implementation decision, I felt it will be faster just listing out the tables and columns to check, but now I will use sql alchemy' model metadata to find tables that are connected to the foreign key I will open a new issue for the connectivity test message issue, and link it here |
Adds 'collectoss privacy query EMAIL [-o FILE] [--schema TEXT]', which reports the personal data an instance holds about one person. No schema changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X2DzVeoy7oZojjFABexuFf Signed-off-by: Inengiye Emmanuel <inengiyeeemmanuel@gmail.com>
Add functions in db/lib.py that find every row tied to a person, starting from an email. Read-only, built with SQLAlchemy select(). Contributor references are found by walking foreign keys; plain-text email columns are listed explicitly, with a test that fails if a new email column is added without being covered. Replaces the earlier CLI-based approach; the CLI layer will follow. Signed-off-by: Inengiye Emmanuel <inengiyeeemmanuel@gmail.com>
4027f12 to
f55d969
Compare
|
Thanks for the detailed review. I've reworked the PR along those lines and force-pushed. What changed
Known limits
Not covered, for discussion
Testing The CLI connectivity output going to stdout is filed separately as #<548>. The CLI layer will be a follow-up PR on top of this. |
Description
Adds
collectoss privacy query EMAIL [-o FILE] [--schema TEXT], a read-only command that reports the personal data an instance holds about one person.collectoss/application/privacy.py, CLI incollectoss/application/cli/privacy.py, tests intests/test_application/test_cli/test_privacy_query.py.Part of #523
Notes for Reviewers
data, and a fake contributor is found end to end.-o FILEto save a report (written with mode 0600). stdout also receives the existing "Connectivity test" line fromtest_connection, so redirecting stdout does not give valid JSON.limitations._ident. Values are bound parameters. I'm happy to rewrite it with SQLAlchemy Core if you prefer.Signed commits
Generative AI disclosure
If AI tools were used, please provide details below:
- What tools were used? Claude (Claude Code)
- How were these tools used? Drafting the module, CLI and tests, based on the design agreed in the epic. Also used for explaining the codebase and reviewing my test results.
- Did you review these outputs before submitting this PR? Yes. I made sure it was coherent with existing codebase patterns, I made sure to test properly, I also walked through some parts of the codes and made tweeks.
🤖 Generated with Claude Code
https://claude.ai/code/session_01X2DzVeoy7oZojjFABexuFf