Commit graph

171 commits

Author SHA1 Message Date
Jennifer Richards c26ba974ba
refactor: use form for search_submission (#8065)
* refactor: use form for search_submission

* chore: remove lint

* style: Black
2024-10-22 10:51:16 -05:00
Jennifer Richards 6aff818b72
feat: remove deprecated /api/submit/ endpoint (#8017)
* feat: remove deprecated /api/submit endpoint

* chore: remove unused imports

* test: test api_submit_tombstone view
2024-10-09 10:56:00 -05:00
Jennifer Richards 08e953995a
feat: better reject null characters in forms (#7472)
* feat: subclass ModelMultipleChoiceField to reject nuls

* refactor: Use custom ModelMultipleChoiceField

* fix: handle value=None
2024-05-28 10:34:55 -05:00
Robert Sparks 03e161bae9
chore: merge branch 'main' into feat/rfc 2023-12-05 09:12:11 -06:00
Paul Selkirk 5006ea53e6
fix: Reject obvious bad encoding pastes into the Submitter field in submissions (#6702) 2023-12-04 13:10:36 -06:00
Robert Sparks 28c3e1bd5d
chore: merge branch 'main' into feat/rfc 2023-11-01 10:54:29 -05:00
Jennifer Richards dc14308700
refactor: Drop submission validation via libmagic (#6500)
* refactor: Update parsers/base.py for Python3

* style: Black

* refactor: Remove mime type check from FileParser

* refactor: Validate that submission is UTF-8

The mime check distinguished us-ascii from UTF-8,
but as far as I can tell the code relying on it
treated both as equally valid.

* feat: Clear error when file is not valid XML

* chore: Remove unused import

* test: Update tests to match changes

* fix: Count bytes starting from 1

* test: Add tests of FileParser validations

* fix: Fix / simplify regexp

* test: Test error caused by bad XML submission

---------

Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
2023-10-23 10:00:04 -05:00
Robert Sparks c8684f727a
Merge branch 'main' into related_no_alias 2023-07-20 09:31:52 -05:00
Robert Sparks 59c0a1f7f9
chore: repair merge damage 2023-07-19 18:09:23 -05:00
Robert Sparks cf3a270cd2
Merge branch 'feat/rfc' into related_no_alias 2023-07-19 17:48:22 -05:00
Robert Sparks 3fe1fcf122
fix: send the whole txt submission to te DraftParser (#5956) 2023-07-12 08:58:08 -05:00
Robert Sparks 457b95094a
fix: improvements to submit form validation 2023-07-07 15:08:41 -05:00
Robert Sparks db670dadc5
chore: continued refactor 2023-06-30 17:27:27 -05:00
Paul Selkirk 37118a623a
fix: change api_submission blackout message to match web ui (#5623)
* test: api_submission returns an error in the blackout period

* fix: change api_submission blackout message to match web ui (#5350)
2023-05-16 09:43:20 -05:00
Jennifer Richards a0f6cdb661
feat: Process uploaded submissions asynchronously (#5580)
* fix: Use relative URL for submission status link

* refactor: Refactor/rename process_uploaded_submission async task

* feat: Add async task to process but not accept a submission

* feat: Replace upload_submission() with an async implementation (WIP)

* fix: Do not put Submission in "uploaded" state if an error occured

* refactor: Improve text/XML draft processing flow

* feat: Extract authors from text in async processing

* fix: Fix call signatures and abort submission on failed validation

* feat: Validate submission name format

* fix: Correctly validate emails from text submission

* fix: Clean up submission validation

* fix: Better display errors on upload_submission page

* feat: Reload submission status page when awaiting validation

* test: Fix call signatures; remove unused imports

* chore: Add type hint

* test: Update tests to match renamed task

* fix: Fix typo in error message

* test: Fix failing Api- and AsyncSubmissionTests

* Rename process_uploaded_submission to process_and_accept_...
* Remove outdated tests

Does not yet test new behavior.

* refactor: Break up submission_file() helper

* test: Refactor tests to run the async processing (wip)

* test: Drop test of bad PDF submission

The PDF submission field was removed, so no need to test it.

* test: Update more tests

* test: Bring back create_and_post_submission() and fix more tests

* fix: Drop to manual, don't cancel, on revision inconsistency

Fixes remaining failing SubmitTest tests

* style: Restyle upload_submission() with black

* test: Verify that async submission processing is invoked on upload

* test: Bring back old do_submission and fix tests

Properly separating the upload and async processing stages of submission
is a bigger refactoring than will fit right now. This better exercises
the submission pipeline.

* fix: Accept only XML for API submissions

* test: Test submission processing utilities

* feat: Improve status display for "validating" submissions

* chore: Remove obsolete code

* test: Update test to match amended text

---------

Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
2023-05-09 15:21:46 -05:00
Robert Sparks e1206fa91e
Merge remote-tracking branch 'upstream/main' into feat/postgres 2023-02-13 09:17:05 -06:00
Lars Eggert f8b48f4c43
fix: use Internet-Draft more consistently across the UI (#5104)
* s/Internet Draft/Internet-Draft/i

* s/draft/Internet-Draft/i or s/draft/I-D/i

* s/ID/I-D/

* Fix tests

* a -> an

* Undo case-change to ASCII

* Address code review comments

* Add migrations

* Add merged migration

* fix: straighten out migrations

* fix: finish straightening out migrations

---------

Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
2023-02-11 10:09:28 -06:00
Robert Sparks 189018a879
feat: disallow collisions with legacy draft names with capital letters (#5068) 2023-02-01 15:11:19 -06:00
Lars Eggert 220be21998
chore: Use codespell to fix typos in code. (#4797)
* chore: Use codespell to fix typos in code.

Second part of replacement of #4651

@rjsparks, I probably need to revert some things here, and I also
still need to add that new migration - how do I do that?

* Revert migrations

* Migrate "Whitelisted" to "Allowlisted"

* TEST_COVERAGE_MASTER_FILE -> TEST_COVERAGE_MAIN_FILE

* Fix permissions

* Add suggestions from @jennifer-richards
2022-12-07 15:10:35 -06:00
Lars Eggert 6eabd4a3a1
chore: Use codespell to fix typos in comments. (#4794)
First part of replacement of #4651
2022-11-28 10:36:36 -06:00
Jennifer Richards 3220bf3c40
chore: replace last few datetime.date.today() calls with date_today() 2022-10-18 12:45:47 -03:00
Jennifer Richards a653582cf7
fix: timezone fixes from last few comparisons with tzaware-obe 2022-09-28 13:21:50 -03:00
Jennifer Richards ebebdbed3e
refactor: replace datetime.now and datetime.today with timezone.now (#4211)
* refactor: replace datetime.now with timezone.now

* refactor: migrate model fields to use timezone.now as default

* refactor: replace datetime.today with timezone.now

datetime.datetime.today() is equivalent to datetime.datetime.now(); both
return a naive datetime with the current local time.

* refactor: rephrase datetime.now(tz) as timezone.now().astimezone(tz)

This is effectively the same, but is less likely to encourage accidental
use of naive datetimes.

* refactor: revert datetime.today() change to old migrations

* refactor: change a missed datetime.now to timezone.now

* chore: renumber timezone_now migration

* chore: renumber migrations
2022-08-25 13:45:16 -03:00
Jennifer Richards 3705bedfcd
feat: Celery support and asynchronous draft submission API (#4037)
* ci: add Dockerfile and action to build celery worker image

* ci: build celery worker on push to jennifer/celery branch

* ci: also build celery worker for main branch

* ci: Add comment to celery Dockerfile

* chore: first stab at a celery/rabbitmq docker-compose

* feat: add celery configuration and test task / endpoint

* chore: run mq/celery containers for dev work

* chore: point to ghcr.io image for celery worker

* refactor: move XML parsing duties into XMLDraft

Move some PlaintextDraft methods into the Draft base class and
implement for the XMLDraft class. Use xml2rfc code from ietf.submit
as a model for the parsing.

This leaves some mismatch between the PlaintextDraft and the Draft
class spec for the get_author_list() method to be resolved.

* feat: add api_upload endpoint and beginnings of async processing

This adds an api_upload() that behaves analogously to the api_submit()
endpoint. Celery tasks to handle asynchronous processing are added but
are not yet functional enough to be useful.

* perf: index Submission table on submission_date

This substantially speeds up submission rate threshold checks.

* feat: remove existing files when accepting a new submission

After checking that a submission is not in progress, remove any files
in staging that have the same name/rev with any extension. This should
guard against stale files confusing the submission process if the
usual cleanup fails or is skipped for some reason.

* refactor: make clear that deduce_group() uses only the draft name

* refactor: extract only draft name/revision in clean() method

Minimizing the amount of validation done when accepting a file. The
data extraction will be moved to asynchronous processing.

* refactor: minimize checks and data extraction in api_upload() view

* ci: fix dockerfiles to match sandbox testing

* ci: tweak celery container docker-compose settings

* refactor: clean up Draft parsing API and usage

  * remove get_draftname() from Draft api; set filename during init
  * further XMLDraft work
    - remember xml_version after parsing
    - extract filename/revision during init
    - comment out long broken get_abstract() method
  * adjust form clean() method to use changed API

* feat: flesh out async submission processing

First basically working pass!

* feat: add state name for submission being validated asynchronously

* feat: cancel submissions that async processing can't handle

* refactor: simplify/consolidate async tasks and improve error handling

* feat: add api_submission_status endpoint

* refactor: return JSON from submission api endpoints

* refactor: reuse cancel_submission method

* refactor: clean up error reporting a bit

* feat: guard against cancellation of a submission while validating

Not bulletproof but should prevent

* feat: indicate that a submission is still being validated

* fix: do not delete submission files after creating them

* chore: remove debug statement

* test: add tests of the api_upload and api_submission_status endpoints

* test: add tests and stubs for async side of submission handling

* fix: gracefully handle (ignore) invalid IDs in async submit task

* test: test process_uploaded_submission method

* fix: fix failures of new tests

* refactor: fix type checker complaints

* test: test submission_status view of submission in "validating" state

* fix: fix up migrations

* fix: use the streamlined SubmissionBaseUploadForm for api_upload

* feat: show submission history event timestamp as mouse-over text

* fix: remove 'manual' as next state for 'validating' submission state

* refactor: share SubmissionBaseUploadForm code with Deprecated version

* fix: validate text submission title, update a couple comments

* chore: disable requirements updating when celery dev container starts

* feat: log traceback on unexpected error during submission processing

* feat: allow secretariat to cancel "validating" submission

* feat: indicate time since submission on the status page

* perf: check submission rate thresholds earlier when possible

No sense parsing details of a draft that is going to be dropped regardless
of those details!

* fix: create Submission before saving to reduce race condition window

* fix: call deduce_group() with filename

* refactor: remove code lint

* refactor: change the api_upload URL to api/submission

* docs: update submission API documentation

* test: add tests of api_submission's text draft consistency checks

* refactor: rename api_upload to api_submission to agree with new URL

* test: test API documentation and submission thresholds

* fix: fix a couple api_submission view renames missed in templates

* chore: use base image + add arm64 support

* ci: try to fix workflow_dispatch for celery worker

* ci: another attempt to fix workflow_dispatch

* ci: build celery image for submit-async branch

* ci: fix typo

* ci: publish celery worker to ghcr.io/painless-security

* ci: install python requirements in celery image

* ci: fix up requirements install on celery image

* chore: remove XML_LIBRARY references that crept back in

* feat: accept 'replaces' field in api_submission

* docs: update api_submission documentation

* fix: remove unused import

* test: test "replaces" validation for submission API

* test: test that "replaces" is set by api_submission

* feat: trap TERM to gracefully stop celery container

* chore: tweak celery/mq settings

* docs: update installation instructions

* ci: adjust paths that trigger celery worker image  build

* ci: fix branches/repo names left over from dev

* ci: run manage.py check when initializing celery container

Driver here is applying the patches. Starting the celery workers
also invokes the check task, but this should cause a clearer failure
if something fails.

* docs: revise INSTALL instructions

* ci: pass filename to pip update in celery container

* docs: update INSTALL to include freezing pip versions

Will be used to coordinate package versions with the celery
container in production.

* docs: add explanation of frozen-requirements.txt

* ci: build image for sandbox deployment

* ci: add additional build trigger path

* docs: tweak INSTALL

* fix: change INSTALL process to stop datatracker before running migrations

* chore: use ietf.settings for manage.py check in celery container

* chore: set uid/gid for celery worker

* chore: create user/group in celery container if needed

* chore: tweak docker compose/init so celery container works in dev

* ci: build mq docker image

* fix: move rabbitmq.pid to writeable location

* fix: clear password when CELERY_PASSWORD is empty

Setting to an empty password is really not a good plan!

* chore: add shutdown debugging option to celery image

* chore: add django-celery-beat package

* chore: run "celery beat" in datatracker-celery image

* chore: fix docker image name

* feat: add task to cancel stale submissions

* test: test the cancel_stale_submissions task

* chore: make f-string with no interpolation a plain string

Co-authored-by: Nicolas Giard <github@ngpixel.com>
Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
2022-08-22 13:29:31 -05:00
Robert Sparks 10396d6f01
chore: remove more tools.ietf.org server only related things. (#4103)
* chore: remove more tools.ietf.org server only related things.

* chore: remove use of tools.ietf.org floorplans\n\nThe data will move into the FloorPlan models instead.
2022-06-22 14:11:46 -05:00
Jennifer Richards c0c8771370
Merge branch 'main' into main-merge
# Conflicts:
#	.devcontainer/docker-compose.extend.yml
#	.github/workflows/build-test-base.yml
#	.github/workflows/build.yml
#	README.md
#	docker/app.Dockerfile
#	docker/configs/settings_local.py
#	docker/docker-compose.extend.yml
#	docker/scripts/app-init.sh
#	ietf/release/tests.py
#	ietf/release/urls.py
#	ietf/templates/500.html
#	ietf/templates/api/index.html
#	ietf/templates/base.html
#	ietf/templates/base/menu.html
#	ietf/templates/group/group_about_status_edit.html
#	ietf/templates/meeting/agenda_filter.html
#	ietf/templates/release/about.html
#	ietf/utils/tests.py
#	package-lock.json
2022-03-25 11:15:05 -03:00
Robert Sparks 902e37d24d
fix: improve looking into submission request for remote ip. (#3720) 2022-03-22 13:04:50 -05:00
Lars Eggert eb5423d084
ci: Also check generated HTML with the "vnu" validator (#3682)
* ci: Also check generated HTML with the "vnu" validator

Because HTML Tidy apparently misses a bunch of errors.

* thead -> tbody

* More fixes

* More fixes

* Start checker in test runner
2022-03-21 12:50:23 -05:00
Russ Housley 71b1f13a79
fix: improfe draft name syntax checks (#3703)
* fix: Include blocked charters in AD dashboard that are ub external review

* fix: Improve draft name syntax checks. Fixes #3677
2022-03-20 06:59:29 -05:00
Robert Sparks 9df659b06e
fix: better draft name validation. Fixes #3539. (#3671) 2022-03-18 18:01:25 -05:00
Jennifer Richards 6c260a5b7e Merge 7.45.1.dev0 into Bootstrap 5 update branch. Made a first pass at reconciling differences.
- Legacy-Id: 19945
2022-02-17 20:09:49 +00:00
Lars Eggert ed30521e14 Many more HTML fixes.
- Legacy-Id: 19908
2022-02-03 07:49:34 +00:00
Jennifer Richards cf62b46093 Find references from submitted XML instead of rendering to text and parsing. Fixes #3342. Commit ready for merge.
- Legacy-Id: 19825
2022-01-07 17:53:23 +00:00
Lars Eggert b058ba28ec Remove the ability to submit Postscript I-Ds.
Commit ready for merge. Fixes #3448.
 - Legacy-Id: 19486
2021-10-28 16:24:29 +00:00
Robert Sparks 47082fe4c5 Allow submit and expire_drafts to succeed when there is no "next" IETF meeting in the database. Fixes #3370. Commit ready for merge.
- Legacy-Id: 19269
2021-08-01 17:50:35 +00:00
Jennifer Richards 9ef3764ad7 Run v2v3 converter internally when v2 XML is submitted. Fixes #3305. Commit ready for merge.
- Legacy-Id: 19242
2021-07-20 18:13:41 +00:00
Robert Sparks 3697180cc1 Reverted merge of timezone-aware migration efforts.
- Legacy-Id: 18792
2021-01-12 16:54:20 +00:00
Henrik Levkowetz 774e752a54 Snapshot of timezone-aware datatracker code. Tests pass, and the test-crawler shows only expected differences. Trunk changes merged in up to r18768.
- Legacy-Id: 18770
2020-12-16 23:53:37 +00:00
Henrik Levkowetz 15ea994266 Added an xml_version field to Submission objects, to capture the schema version of submitted XML files (if any). Related to issue #3067.
- Legacy-Id: 18440
2020-08-28 14:31:36 +00:00
Henrik Levkowetz f10ddadc0e Merged in changes from trunk up to r17584.
- Legacy-Id: 17593
2020-04-07 16:02:52 +00:00
Henrik Levkowetz 4d345573ae Check if any files matching the submitted draft name and revision already exists on disk in the active drafts or archived drafts directories, and if so reject the submission. Fixes issue #2908
- Legacy-Id: 17498
2020-03-21 22:56:57 +00:00
Henrik Levkowetz e99fa4be40 Merged in [17419] from rjsparks@nostrum.com:
Don't warn about idcutoff when the cutoff is after the meeting starts. Fixes #2907.
 - Legacy-Id: 17422
Note: SVN reference [17419] has been migrated to Git commit edc41a8705
2020-03-11 21:46:02 +00:00
Robert Sparks edc41a8705 Don't warn about idcutoff when the cutoff is after the meeting starts. Fixes #2907. Commit ready for merge.
- Legacy-Id: 17419
2020-03-11 16:15:40 +00:00
Henrik Levkowetz 0f6a886ae0 Corrected the extent of a try/except block, moving more code inside the block. Fixes a submission exception that should just be a document error reported back to the user.
- Legacy-Id: 17411
2020-03-09 14:13:37 +00:00
Henrik Levkowetz 726fcbf27d Removed all __future__ imports.
- Legacy-Id: 17391
2020-03-05 23:53:42 +00:00
Henrik Levkowetz e9a37d8ac8 Removed six.text_type(), changed six.moves.urllib to plain urllib, and removed now unused six imports.
- Legacy-Id: 17385
2020-03-05 14:41:41 +00:00
Henrik Levkowetz 095c3a2ccb Fixed an issue where the lookup of recognized country names during draft submission grabbed the unicode name instead of the ascii name for non-ascii country strings in XML submissions.
- Legacy-Id: 17345
2020-02-26 17:20:13 +00:00
Henrik Levkowetz 9439f718d4 Wrapped more code in an exception block, in order not to continue processing after an XML parse exception. Fixes issue #2885.
- Legacy-Id: 17305
2020-02-18 20:20:09 +00:00
Henrik Levkowetz e79eb56c01 Changed the xml parser settings for legacy xml draft submissions to remove comments before converting to .txt. Fixes and issue with comments in <artwork> text.
- Legacy-Id: 17297
2020-02-16 15:48:45 +00:00
Henrik Levkowetz edf28348aa Changed draft submission field validation taking place in clean() to associate the errors with the field in question, rather than raising them as general form errors.
- Legacy-Id: 17249
2020-01-18 15:01:35 +00:00